Skip to content

Add XUI localization support with Swedish translations#2837

Open
yeager wants to merge 4 commits into
xemu-project:masterfrom
yeager:i18n-sv-xui
Open

Add XUI localization support with Swedish translations#2837
yeager wants to merge 4 commits into
xemu-project:masterfrom
yeager:i18n-sv-xui

Conversation

@yeager
Copy link
Copy Markdown

@yeager yeager commented Apr 25, 2026

Summary

  • initialize gettext for the XUI HUD/menu path
  • add XUI source files and custom widget helpers to gettext extraction
  • mark core XUI menu, settings, notification, update, snapshot, and compatibility-reporting strings for translation
  • update Swedish translations for the newly extracted strings

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.pot
  • msgmerge --backup=off --update po/sv.po /tmp/xemu.pot
  • msgfmt --check-format --check-domain -o /dev/null po/sv.po

A local compile was not completed because this machine does not have the required libpcap pkg-config dependency installed; Meson stops before generating build targets.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread po/meson.build
Comment on lines +8 to +9
'--keyword=Toggle:1',
'--keyword=Slider:1',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

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',

Comment thread ui/xui/main-menu.cc Outdated
Comment on lines +58 to +59
Toggle("Check for updates", &g_config.general.updates.check,
"Check for updates whenever xemu is opened");
_("Check for updates whenever xemu is opened"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

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");

Comment thread ui/xui/main-menu.cc Outdated
Comment on lines +64 to +65
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)"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Redundant _() wrapping for the description argument. See previous comment regarding Toggle keyword extraction and internal translation.

    Toggle("Hard FPU emulation", &g_config.perf.hard_fpu,
           "Use hardware-accelerated floating point emulation (requires restart)");

Comment thread ui/xui/main-menu.cc Outdated
Comment on lines +68 to +69
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"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Redundant _() wrapping for the description argument.

    Toggle("Cache shaders to disk", &g_config.perf.cache_shaders,
           "Reduce stutter in games by caching previously generated shaders");

Comment thread ui/xui/main-menu.cc Outdated
Comment on lines +72 to +73
Toggle("Skip startup animation", &g_config.general.skip_boot_anim,
"Skip the full Xbox boot animation sequence");
_("Skip the full Xbox boot animation sequence"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Redundant _() wrapping for the description argument.

    Toggle("Skip startup animation", &g_config.general.skip_boot_anim,
           "Skip the full Xbox boot animation sequence");

Comment thread ui/xui/main-menu.cc Outdated
SectionTitle("Window");
bool fs = xemu_is_fullscreen();
if (Toggle("Fullscreen", &fs, "Enable fullscreen now")) {
if (Toggle("Fullscreen", &fs, _("Enable fullscreen now"))) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Redundant _() wrapping for the description argument.

    if (Toggle("Fullscreen", &fs, "Enable fullscreen now")) {

@mborgerson
Copy link
Copy Markdown
Member

Do you plan to test any of your changes?

@yeager
Copy link
Copy Markdown
Author

yeager commented Apr 28, 2026

Tested the XUI localization path on Fedora 43 (Burken2) with a fresh local build of the updated PR branch.

Build/test notes:

  • Built commit 0e9eaac on Fedora 43
  • Ran xemu under Xvfb with Swedish locale:
    • LANG=sv_SE.UTF-8
    • LC_ALL=sv_SE.UTF-8
    • LANGUAGE=sv
  • Verified the runtime loads Swedish XUI strings from qemu.mo
  • Verified the previously half-English settings/input views are now localized

Screenshots are attached to this comment only; they are not stored in the repository.

Swedish system settings

Swedish input settings

@yeager
Copy link
Copy Markdown
Author

yeager commented Apr 28, 2026

Follow-up from screenshot review: fixed remaining untranslated XUI settings/menu text visible in the Swedish UI.

Changes:

  • Localized main settings navigation tabs: General/Input/Display/Audio/Network/System/About
  • Localized System settings labels, descriptions, combo previews, and file picker labels
  • Localized Input settings values/messages such as Xbox Controller, Not Connected, and the empty input-device prompt
  • Made chevron combo preview/items pass through gettext at render time
  • Added extraction keywords for XUI tab buttons and chevron combo labels/descriptions

Validation:

  • msgfmt --check-format --check-domain -o /tmp/xemu-sv.mo po/sv.po
  • Fedora 43 rebuild: make -C build -j2 qemu-system-i386
  • Ran under Xvfb with LANG=sv_SE.UTF-8, LC_ALL=sv_SE.UTF-8, LANGUAGE=sv

Screenshots were used for validation only and are not stored in the repository.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants