-
-
Notifications
You must be signed in to change notification settings - Fork 628
Description
Description
When switching between languages in the FXGL default menu, the "Fullscreen" option text does not update correctly. It remains in the initial language (e.g., Chinese) even after switching to English.
Expected Behavior
All menu options, including "Fullscreen", should update their text when the selected language changes.
Actual Behavior
All menu options except "Fullscreen" correctly update their text when switching languages. The "Fullscreen" option remains in the initial language.
Steps to Reproduce
- Run a FXGL game with multiple languages supported (e.g., English and Chinese)
- Go to the Settings menu
- Switch the language from Chinese to English (or vice versa)
- Observe that all menu options update their text except for "Fullscreen"
Root Cause
In FXGLDefaultMenu.kt at line 684, the "Fullscreen" option text is created using the localize() method:
vbox.children.add(HBox(25.0, getUIFactoryService().newText(localize("menu.fullscreen") + ": "), cbFullScreen))This method returns a static string value, which does not update when the language changes. In contrast, other menu options (like the language selection itself) use localizedStringProperty() which returns a bindable property that automatically updates when the language changes:
HBox(25.0, getUIFactoryService().newText(localizedStringProperty("menu.language").concat(":")), languageBox)Fix
Change line 684 in FXGLDefaultMenu.kt from:
vbox.children.add(HBox(25.0, getUIFactoryService().newText(localize("menu.fullscreen") + ": "), cbFullScreen))To:
vbox.children.add(HBox(25.0, getUIFactoryService().newText(localizedStringProperty("menu.fullscreen").concat(": ")), cbFullScreen))This ensures that the "Fullscreen" option text is bound to the current language and will update automatically when the language changes.
Affected Files
fxgl/src/main/kotlin/com/almasb/fxgl/app/scene/FXGLDefaultMenu.kt
Environment
- FXGL version: [21.1]
- Java version: [21.0.6]
- OS: [win 11]
Additional Notes
This bug only affects the "Fullscreen" option in the default FXGL menu. Other menu options correctly use bindable properties for localization.