Skip to content

#1936: Improve localization of gui#1979

Open
KarimALotfy wants to merge 60 commits into
devonfw:mainfrom
KarimALotfy:feature/1936-improve-localization-of-gui
Open

#1936: Improve localization of gui#1979
KarimALotfy wants to merge 60 commits into
devonfw:mainfrom
KarimALotfy:feature/1936-improve-localization-of-gui

Conversation

@KarimALotfy

@KarimALotfy KarimALotfy commented May 27, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #1936

Implemented changes:

  • Add interactive i18n support: app can switch locales (English/Deutsch) via combo box
  • I18nService manages locale state with listener notifications for UI text updates
  • MainController registers locale change listener to refresh all UI labels and prompts on language switch

Testing instructions

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

  1. Run in /ide-gui AppLauncher , interact with the third combo box (Language) -- check if language is correctly switched
  2. Add and remove properties to messages.properties and messages_de.properties--> run I18nServiceTest

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"

laim2003 added 30 commits March 27, 2026 17:52
- Added logging to IdeGuiStateManager.
- Added functionality, that selecting a different project now switches the IdeContext to the new project.
- Added logging to IdeGuiStateManager.
- Added functionality, that selecting a different project now switches the IdeContext to the new project.
- Added functionality, that selecting a different project now switches the IdeContext to the new project.
- added DI for IdeGuiStateManager.switchContext
…reading the list of workspaces/projects instead of reading those from the UI
…nager, when switchContext(Path rootDirectory, ...) is called.
…tateManager is now set when calling getInstance(), allowing us to provide a getInstance() method with a DI parameter
laim2003 and others added 10 commits May 12, 2026 13:34
- Add interactive i18n support: app can switch locales (English/Deutsch) via combo box
- I18nService manages locale state with listener notifications for UI text updates
- MainController registers locale change listener to refresh all UI labels and prompts on language switch

 Testing:
   - I18nServiceTest: verify service behavior
   - AppBaseTest: new interactive UI test
@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board May 27, 2026
@KarimALotfy KarimALotfy changed the title Feature/1936 improve localization of gui #1936: Improve localization of gui May 27, 2026
@KarimALotfy KarimALotfy added the GUI Graphical User Interface of IDEasy (aka dashboard) build with JavaFx label May 27, 2026
@coveralls

coveralls commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 27685523323

Coverage decreased (-0.04%) to 71.243%

Details

  • Coverage decreased (-0.04%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 34 coverage regressions across 4 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

34 previously-covered lines in 4 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/ide/gui/MainController.java 20 70.79%
com/devonfw/ide/gui/App.java 12 0.0%
com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java 1 78.33%
com/devonfw/tools/ide/version/VersionSegment.java 1 89.76%

Coverage Stats

Coverage Status
Relevant Lines: 16301
Covered Lines: 12114
Line Coverage: 74.31%
Relevant Branches: 7272
Covered Branches: 4680
Branch Coverage: 64.36%
Branches in Coverage %: Yes
Coverage Strength: 3.14 hits per line

💛 - Coveralls

@KarimALotfy KarimALotfy moved this from 🆕 New to 🏗 In progress in IDEasy board May 27, 2026
@KarimALotfy KarimALotfy self-assigned this May 27, 2026
@hohwille hohwille moved this from 🏗 In progress to Team Review in IDEasy board May 28, 2026
@hohwille hohwille moved this from Team Review to 🏗 In progress in IDEasy board May 28, 2026
@laim2003 laim2003 self-assigned this Jun 16, 2026
@laim2003 laim2003 self-requested a review June 16, 2026 13:20
@KarimALotfy KarimALotfy moved this from 🏗 In progress to Team Review in IDEasy board Jun 16, 2026

@laim2003 laim2003 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good! just left some thoughts😊


private static final Logger LOG = LoggerFactory.getLogger(I18nService.class);

private static final String BUNDLE_NAME = "i18n.messages";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i would say that naming this something like "localization" would probably be a bit more readable (altough i understand where you are coming from with i18n)

At least that what I would think coming from an android development background, where this is how they name it😅

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 agree with you, it would be clearer to be named as "Localization", done ✅

Comment on lines +51 to +57
public static synchronized I18nService getInstance() {

if (instance == null) {
return getInstance(null);
}
return instance;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@hohwille said that we should avoid Singleton patterns where possible and use Dependency Injection. I know i used this pattern a lot in my own state management implementation, but I will also be moving away from Singeltons there. Maybe we can discuss about whether its okay to use them in some instances in the Next daily, probably would also help me clear up some questions. I would probably leave this how it is here for now, but then open a second issue for the future where we update this to DI.

Comment thread gui/src/main/java/com/devonfw/ide/gui/i18n/I18nService.java Outdated
Comment thread gui/src/main/java/com/devonfw/ide/gui/i18n/I18nService.java Outdated
try {
return this.resourceBundle.getString(key);
} catch (MissingResourceException e) {
LOG.warn("Missing translation key: {} for locale: {}", key, this.locale);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think if no string is found, this probably should be an error rather than a warning. Maybe you can help me here, basically if the string is not found in ANY translation, this error will occur? Or does it already occur if the key is simply not found in the specified Locale?

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 noticed actually that if a resource key is missing, the application fails to start. This is because fxmlLoader.load() in the application's start method throws an exception before the custom exception in the get method is reached.

Resulting error:

Failed to load the application: Resource "button.open" not found
/C:/.../main-view.fxml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GUI Graphical User Interface of IDEasy (aka dashboard) build with JavaFx

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

Improve localization of the GUI

4 participants