Add XUI localization support with Swedish translations#2837
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements internationalization (i18n) for the XUI interface by introducing a gettext-based translation system, updating the build configuration, and wrapping UI strings in the translation macro. Feedback focuses on optimizing string extraction by updating xgettext keywords in the build system to include widget descriptions, which would eliminate the need for redundant manual translation wraps in the UI code.
| '--keyword=Toggle:1', | ||
| '--keyword=Slider:1', |
There was a problem hiding this comment.
The Toggle and Slider widgets both take a description string as their third argument. To ensure these strings are automatically extracted by xgettext without needing manual _() wrapping at every call site, you should update the keyword definitions to include the third argument (e.g., Toggle:1,3).
'--keyword=Toggle:1,3',
'--keyword=Slider:1,3',
| Toggle("Check for updates", &g_config.general.updates.check, | ||
| "Check for updates whenever xemu is opened"); | ||
| _("Check for updates whenever xemu is opened")); |
There was a problem hiding this comment.
Since the Toggle implementation in widgets.cc already calls _() on the description argument, wrapping it in _() here is redundant and leads to double translation lookups at runtime. Once the xgettext keywords in po/meson.build are updated to include the third argument, these manual wraps can be removed for better consistency with how titles are handled.
Toggle("Check for updates", &g_config.general.updates.check,
"Check for updates whenever xemu is opened");| Toggle("Hard FPU emulation", &g_config.perf.hard_fpu, | ||
| "Use hardware-accelerated floating point emulation (requires restart)"); | ||
| _("Use hardware-accelerated floating point emulation (requires restart)")); |
There was a problem hiding this comment.
| Toggle("Cache shaders to disk", &g_config.perf.cache_shaders, | ||
| "Reduce stutter in games by caching previously generated shaders"); | ||
| _("Reduce stutter in games by caching previously generated shaders")); |
| Toggle("Skip startup animation", &g_config.general.skip_boot_anim, | ||
| "Skip the full Xbox boot animation sequence"); | ||
| _("Skip the full Xbox boot animation sequence")); |
| SectionTitle("Window"); | ||
| bool fs = xemu_is_fullscreen(); | ||
| if (Toggle("Fullscreen", &fs, "Enable fullscreen now")) { | ||
| if (Toggle("Fullscreen", &fs, _("Enable fullscreen now"))) { |
|
Do you plan to test any of your changes? |
|
Tested the XUI localization path on Fedora 43 (Burken2) with a fresh local build of the updated PR branch. Build/test notes:
Screenshots are attached to this comment only; they are not stored in the repository. |
|
Follow-up from screenshot review: fixed remaining untranslated XUI settings/menu text visible in the Swedish UI. Changes:
Validation:
Screenshots were used for validation only and are not stored in the repository. |


Summary
Tests
xgettext --from-code=UTF-8 --language=C++ --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dcgettext:2 --keyword=g_dngettext:2,3 --keyword=g_dpgettext2:2c,3 --keyword=SectionTitle:1 --keyword=Toggle:1 --keyword=Slider:1 --keyword=FilePicker:1 --keyword=PopupMenuButton:1 --keyword=PopupMenuSubmenuButton:1 --keyword=PopupMenuToggle:1 --msgid-bugs-address=qemu-devel@nongnu.org -f po/POTFILES -o /tmp/xemu.potmsgmerge --backup=off --update po/sv.po /tmp/xemu.potmsgfmt --check-format --check-domain -o /dev/null po/sv.poA local compile was not completed because this machine does not have the required
libpcappkg-config dependency installed; Meson stops before generating build targets.