Skip to content

#2126 fix only german is listed in language selection dropdown - #2221

Closed
oanding-blrng wants to merge 9 commits into
devonfw:mainfrom
oanding-blrng:fix/2126-fix-only-german-is-listed-in-language-selection-dropdown
Closed

#2126 fix only german is listed in language selection dropdown#2221
oanding-blrng wants to merge 9 commits into
devonfw:mainfrom
oanding-blrng:fix/2126-fix-only-german-is-listed-in-language-selection-dropdown

Conversation

@oanding-blrng

@oanding-blrng oanding-blrng commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #2126

Implemented changes:

  • ResourceBundle.getBundle(...) with Locale.ENGLISH would return messages_de.properties, because no messages_en.properties could be found. Therefore check for Locale.ENGLISH was added to use Locale.ROOT instead, which would result in wanted messages.properties
  • Extended initialize() method in NlsService.java to convert de-DE to de, because they are NOT the same. The current behaviour is the following:
    1. Get system locale with Locale.getDefault() and generalize it (de-DE to de and en-US to en, etc.)
    2. Check if system locale is contained in supported locales of GUI
    3. If this is the case, this locale will be used. Otherwise fallback to english
  • To confirm new behaviour, the test method testGetInstanceWithLocale(...) was extended to cover other machine setups

Testing instructions

Please add conscise, understandable instructions on how a reviewer can test/verify the functionality of your contribution here:

  1. Run all tests of GUI module (mvn test -pl gui). The the tests mentioned in the issue should run successfully again
  2. Start the GUI with a run configuration pointing to AppLauncher.java (if #1987: Fixed GUI not launching for snapshot versions #2036 is merged, ./build-local-dev.sh could also be used)
  3. Depending on the locale settings of the machine, the language should either be the system setting or English for the start
  4. German and English are both listed in the dropdown menu and selecting a different language should take effect in the GUI

Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled
    with internal
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Jul 28, 2026
@oanding-blrng oanding-blrng self-assigned this Jul 28, 2026
@oanding-blrng oanding-blrng moved this from 🆕 New to 🏗 In progress in IDEasy board Jul 28, 2026
@oanding-blrng oanding-blrng added GUI Graphical User Interface of IDEasy (aka dashboard) build with JavaFx bugfix PR that fixes a bug issue labels Jul 28, 2026
@coveralls

coveralls commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 30353297832

Coverage increased (+0.006%) to 72.608%

Details

  • Coverage increased (+0.006%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 24 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

24 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/ide/gui/nls/NlsService.java 23 79.52%
com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java 1 78.33%

Coverage Stats

Coverage Status
Relevant Lines: 17002
Covered Lines: 12870
Line Coverage: 75.7%
Relevant Branches: 7607
Covered Branches: 4998
Branch Coverage: 65.7%
Branches in Coverage %: Yes
Coverage Strength: 3.21 hits per line

💛 - Coveralls

@oanding-blrng
oanding-blrng marked this pull request as ready for review July 28, 2026 11:16
@oanding-blrng oanding-blrng moved this from 🏗 In progress to Team Review in IDEasy board Jul 28, 2026
@MeShehi MeShehi self-assigned this Jul 28, 2026
@MeShehi
MeShehi self-requested a review July 28, 2026 11:46
@MeShehi

MeShehi commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

I have tested on my machine, which has an English Locale, and the software starts with the right language. In addition, changing the language does indeed affect the texts in the GUI. All tests are passing too.

@MeShehi
MeShehi requested a review from hohwille July 28, 2026 11:48
@oanding-blrng
oanding-blrng removed the request for review from MeShehi July 28, 2026 11:53
@oanding-blrng oanding-blrng moved this from Team Review to 👀 In review in IDEasy board Jul 28, 2026

@hohwille hohwille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oanding-blrng thanks for analysing the root of this problem. That is always the most important part of the fix. 👍
I do not agree with the fix itself. Please have a look. If there are questions remaining, please do not hesitate to ask me...

Comment on lines +83 to 89
// Locale.getDefault() returns "de_DE" (for systems set to German) which isn't the same as "de"
localeToApply = Locale.of(Locale.getDefault().getLanguage());
if (!availableLocales.contains(localeToApply)) {
localeToApply = Locale.ENGLISH;
}
}
applyLocale(localeToApply, false);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO there is a small misunderstanding of the Locale concept.
Internationalisation (l18n) defines a inheritance tree of:

  • root (the "empty" locale as Locale.ROOT)
  • the language level (e.g. de, en, es, etc.)
  • country specific aspects within a language (e.g. British English as en_GB uses different spelling than American English en_US, you could even differentiate aspects to German for Austria in de_AT).
  • there is even another level below but lets stop at this point.

So we can have a resource bundle with de for German translation.
However, we could also have en_US for American English specialities.

You might think that this does not matter since IDEasy does not do country specific differentiations. However, JavaFx does a lot of things when the locale changes.
For that we cannot simply remove such aspects here since the localeToApply is actually what is applied to JavaFx.
Therefore line 84 will sooner or later cause undesired bugs.

Great that you traced down the reason why our language dropdown was having problems because the implemented in our team was not aware of the difference between de and de_DE.
However, only consider this for the dropdown but do not change the Locale that is applied.
Some users with LTR instead of RTL writing will not like if their GUI behaves broken...
Also bear in mind that with AI translation becomes cheap.
We might introduce en_US with many other languages one day via automatic translation.

@oanding-blrng oanding-blrng Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the explanation. After some testing (documented with a comment under the issue #2126 (comment)) on a clean branch I came up with a different solution. We could just introduce a new messages_en.properties file. This would mean, that the ResourceBundle would find the proper bundle and because of how ResourceBundle is working, he would go up the chain (in this case) to the root properties, which is containing the English localization.

messages_en.properties would be completely empty with just a comment to make additions/edits to the English localization within the root properties file.

Therefore no assumptions had to made about the structure and we don't remove certain information about the locale the user is using.

Would this be a better solution @hohwille ?

@oanding-blrng oanding-blrng Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a new pr #2234 with the new approach. This pr is ready for the team-review, but I wanted to wait for your opinion before kicking of the process of the team review.

If the new approach is suitable, we can close this pr and work with the new one.

Comment on lines +246 to 251
// ResourceBundle.getBundle(...) with Locale.ENGLISH would return German properties on system locale = German
if (locale.equals(Locale.ENGLISH)) {
return ResourceBundle.getBundle(BUNDLE_NAME, Locale.ROOT);
}
return ResourceBundle.getBundle(BUNDLE_NAME, locale);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same kind of error here:
The resource bundle will do the proper inheritance automatically.
Our code shall not hard-code crazy assumptions about the current structure of our *_de.properties and *.properties vs. *_en.properties, etc.

@hohwille

Copy link
Copy Markdown
Member

This PR is replaced by PR #2234 and I therefore close it now.

@hohwille hohwille closed this Jul 30, 2026
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in IDEasy board Jul 30, 2026
@hohwille hohwille added this to the rejected milestone Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR that fixes a bug issue GUI Graphical User Interface of IDEasy (aka dashboard) build with JavaFx

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

only german is listed in language selection dropdown

4 participants