Skip to content

#2126: Fix language selection drop down - #2234

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

#2126: Fix language selection drop down#2234
oanding-blrng wants to merge 3 commits into
devonfw:mainfrom
oanding-blrng:fix/2126-fix-only-german-is-listed-in-language-selection-dropdown-2

Conversation

@oanding-blrng

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

Copy link
Copy Markdown
Contributor

This PR fixes #2126

Identification of root cause:

In the current setup of property files for localization, the method

private ResourceBundle loadBundle(Locale locale) {
return ResourceBundle.getBundle(BUNDLE_NAME, locale);
}
returns the German ResourceBundle instead of the English one (located in the root properties file) with Locale.ENGLISH as an argument. This leads to a list with only one entry for the language selection dropdown, because for both locals (en and de) the German ResourceBundle gets returned.

This behaviour is "normal" in the sense, that ResourceBundle first tries to find a properties file for en_UK, can't find one and goes up the chain for en and after that the root file. But before the root is being used, ResourceBundle also tries the system locale (for me this would return de_DE). So ResourceBundle would search for de_DE, and after that de. Because of this "missing link" in the chain for English, this results in the observed behaviour mentioned in the issue #2126. Additional information are in #2221.

Implemented changes:

  • Created messages_en.properties, so the ResourceBundle can find the correct bundle and fallbacks automatically for the keys to the root properties, because no keys are being overwritten
  • Extended testGetInstanceWithLocale(..) test method in NlsServiceTest.java to cover additional machine setups

Testing instructions

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

  1. Run the test of the GUI module with mvn test -pl gui. The tests mentioned in the issue only german is listed in language selection dropdown #2126 should pass now
  2. Run the AppLauncher via RunConfiguration
  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

Retest:

  1. Run ide gui. The language selection dropdown should now list English and German

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"

… property files for i18n. Extend testGetInstanceWithLocale() test method to inculde additional test cases. Added ticket to the CHANGELOG.adoc.
@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Jul 29, 2026
@oanding-blrng oanding-blrng self-assigned this Jul 29, 2026
@oanding-blrng oanding-blrng moved this from 🆕 New to 🏗 In progress in IDEasy board Jul 29, 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 29, 2026
@oanding-blrng
oanding-blrng marked this pull request as ready for review July 29, 2026 14:03

@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 this PR with your new approach. Looks great to me👍
I only have some rather cosmetic remarks before we will merge.

NlsService service = new NlsService(Locale.ENGLISH);
@ParameterizedTest
@MethodSource("testGetInstanceWithLocaleProvider")
public void testGetInstanceWithLocale(Locale systemLocale, Locale providedLocal, Locale expectedServiceLocal, String expectedString) {

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.

2nd and 3rd param seem to lack a trailing e.

Comment on lines +77 to +83
arguments(Locale.GERMANY, Locale.ENGLISH, Locale.ENGLISH, "English (en)"),
arguments(Locale.GERMANY, Locale.GERMAN, Locale.GERMAN, "Deutsch (de)"),
arguments(Locale.GERMANY, null, Locale.GERMANY, "Deutsch (de)"),
arguments(Locale.UK, Locale.ENGLISH, Locale.ENGLISH, "English (en)"),
arguments(Locale.UK, Locale.GERMAN, Locale.GERMAN, "Deutsch (de)"),
arguments(Locale.UK, null, Locale.UK, "English (en)"),
arguments(Locale.FRANCE, null, Locale.FRANCE, "English (en)")

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.

Wouldn't it make sense to use this test to also test that our NLS is working in a way it can actually translate so we also test that Deutsch (de) becomes German (de) if the locale language is English and vice versa for German we would get Englisch (en) instead of English (en)?

@github-project-automation github-project-automation Bot moved this from 🏗 In progress to 👀 In review in IDEasy board 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: 👀 In review

Development

Successfully merging this pull request may close these issues.

only german is listed in language selection dropdown

2 participants