feat(menu): localize UI overlays and startup screen into 16 languages #2417
Closed
oscarlosu-lab wants to merge 1 commit from
oscarlosu-lab/main into main
pull from: oscarlosu-lab/main
merge into: MagicBeanDev:main
MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2834
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2417
Loading…
Reference in a new issue
No description provided.
Delete branch "oscarlosu-lab/main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Players running the game in non-English languages currently see the pause menu (
F1/Insert/Esc), startup preparation banner, and debug overlays in English. This PR localizes Hookshot's Vulkan UI overlays and startup preparation screen into all 16 game languages matching the console's language selection.What changed
i18n::Langmapping for all 16 Switch language codes (en-US,en-GB,fr,fr-CA,de,it,es,es-419,pt-BR,nl,pl,ru,ja,ko,zh-Hans,zh-Hant),oe: languagehook setter, fallbackLANG/LC_ALL/ Windows UI locale detection, and thread-safe active-language state (init(),state_ready(),set_active_lang(),current_lang()).i18n::tr) covering menu tabs, rows, hints, dialogs, startup/preparation screen, and debug overlays (including#2378/#1859strings), plus pattern/unit translator (i18n::tr_dyn) for dynamic values (%d nits, countdowns, key/device labels) using%nend-of-string checks so unrelated numeric labels (such as speed multipliers or volumes) are not misparsed.i18n::tr/i18n::tr_dyn, keeping option keys and.inistorage identifiers in English.RX_VK_UI_LANGoverride behavior.test_menu_tune.pyto match localized prompt lookups.Screenshots (1280x720 Vulkan capture)
de, Mediummenu_size=2)de, Smallmenu_size=1)ru, Medium)ja)zh-Hans)draw_startup,de/ja/ru)Fallback and switches
RX_VK_UI_FONT=<ttf/ttc>points it at a font;RX_VK_UI_LANG=<code>overrides the language. Both are in docs/development.md.eaef1460: #2177's Graphics section headings are in the catalog in all 16 languages.Checks
python -I -B tests/test_menu_i18n.py-> OK (16 languages verified)python -I -B tests/run_all.py menu prompt font utf8 run_all_declarations nup_read_name bake_portability-> 28 passed, 0 failed, 0 skipped (Windows,clang++fromllvm-mingw)Translating the menu and the start-up screen is a real gain for players who don't read English, and keeping the
.inikeys and the strings the tests inspect in English was the right call. I covered the language detection, the font fallback, the glyph prebaking and the tests. I spot-checked the catalog but didn't review the 16 languages' wording. Thevk_menu.cppchecks pass at this head on Linux (51), and the branch merges cleanly with main.tests/test_menu_i18n.pyfails on Windows CI (Python source checks (windows-2022, part 1/2)). The fixture is built with-Werror(line 442), and the Windows CRT marksstd::fopen(gpu/vk/vk_menu_lang.h:93) andstd::getenv(lines 117 and 121) deprecated. Main fixed the same thing for another test in #2397 by putting#define _CRT_SECURE_NO_WARNINGSat the top of the fixture source. Adding-D_CRT_SECURE_NO_WARNINGSto the compile line would work too. Part 2/2's failure (test_native_astc_texture_count.py) is the one #2397 fixed, and goes away on rebase.merge_language_fallbacks(gpu/vk/vk_imgui.cpp) looks for system fonts: Windows' Yu Gothic, Malgun, YaHei or JhengHei, and Noto CJK or a few others on Linux. If none is found, it only logsno system CJK font found(line 215), buti18n::trstill returns the Japanese, Korean or Chinese strings. The menu is then drawn in glyphs the font doesn't have, which is worse than today's English. This will happen on any Linux system without Noto CJK or one of the listed fonts at those exact paths: minimal installs, and possibly SteamOS, which I haven't checked. The Linux list also only looks at fixed paths, so a font installed elsewhere, or found only through fontconfig, is missed. When the probe glyph still isn't in the font after the merge, fall back to English for the UI: set the active language tokEnUSand log it. The game's own font may already cover CJK when it's used, which theneeds()check handles.RX_VK_UI_LANG(vk_menu_lang.h:117) andRX_VK_UI_FONT(vk_imgui.cpp:132), aren't documented. CONTRIBUTING asks for a row next toRX_VK_UI_GAME_FONTindocs/development.md.RX_VK_SHOTS, or even a phone photo, would do. A long-string language (de or ru), a CJK one, and the start-up screen at 1280x720 and at the smallest Menu size would cover it.vk_menu_i18n.h:662and:714: the description says the active language is "thread-safe atomic", butstate_lang()/state_ready()are plain statics, initialised on first use.next_buf()hands out a shared 16-slot ring with a non-atomicpos. As far as I can tell every caller runs on the thread that draws the menu, so this is fine today. Please either make the comment and description match, or make them atomic orthread_localso a later caller on another thread can't corrupt the strings.bake_some()(vk_imgui.cpp:484): for CJK,prebake_extraholds every distinct character of the translated catalog, likely several hundred. Each prebake frame then rasterizes all of them for one font size, during play before the menu is first opened. Did you see a frame-time spike on the start-up screen or in the first minutes withjaorzh-Hans? On a Steam Deck that could be noticeable. Spreading the extra glyphs over a few frames would bound it.^[n-US,ests/...).Thanks for the thorough review @Joey-Magnus! All requested changes have been addressed and rebased onto the latest
main:vk_imgui.cpp/vk_menu_lang.h): Movedstate_lang(),state_ready(),init(),set_active_lang(),set_lang_for_test(), andcurrent_lang()(plus<atomic>) intogpu/vk/vk_menu_lang.hsovk_imgui.cppcompiles cleanly without forward-declaration issues, and wiredactive_ui_lang()consistently.origin/main(including#2378,#1859, and#2197) and added 16-language translations forRestart needed,Compact,Full menu,Right Shift, and2.2 GB (4GB preset).tests/test_menu_tune.pyassertions for localized prompts, added coverage intests/test_menu_i18n.py(includingset_active_lang(i18n::kJa)fallback behavior and#2378/#1859translations).python -I -B tests/run_all.py menu prompt font utf8 run_all_declarations nup_read_name bake_portabilitypasses 28 passed, 0 failed, 0 skipped on Windows (llvm-mingw).1280x720, Vulkan capture):de, Mediummenu_size=2& Audio tab): de Medium, de Audio tabde, Smallmenu_size=1): de Smallru): ru Mediumja&zh-Hans): ja CJK, zh-Hans CJKdraw_startup): startup de, startup ja, startup ru(Fixed markdown escaping in the PR body as well.)
It needs a rebase (
vk_menu.cpp/vk_imgui.cppchanged in #2378, #1859 and #2342). Windows part 1 fails on this PR's owntests/test_menu_i18n.py:-Werrorplus the CRT'sfopen/getenvdeprecation needs_CRT_SECURE_NO_WARNINGS. Part 2 is main's old ASTC failure.Also:
This now conflicts with main in
gpu/vk/vk_menu.cpp,tests/test_menu_tune.py. Could you merge main into the branch (or rebase) when you get a chance? I'll take another look once it's up to date.Rebased onto
eaef1460(#2177's Graphics sections included: their five headings are in the catalog in all 16 languages) and pushed as192f79fc. Status of the review points:_CRT_SECURE_NO_WARNINGS, as #2397 did (tests/test_menu_i18n.py).merge_language_fallbacks).RX_VK_UI_FONT=<ttf/ttc>points it at a font.RX_VK_UI_LANGandRX_VK_UI_FONTare in docs/development.md.Local checks with llvm-mingw's clang++: test_menu_i18n (16 languages), test_menu_sections, test_menu_tune, test_pipeline_share, and run_all.py's menu/prompt/font/utf8 groups pass.
Note on the current CI failures on
192f79fc— none of them are from this PR (tests/test_menu_i18n.py,test_menu_tune.py,test_pipeline_share.py,Python source checks (ubuntu-24.04, part 1/2), Windows Vulkan,Hookshot Builder,appimage,dav1d, andSPIR-V fixturesall passed):Python source checks (ubuntu-24.04, part 2/2): fails only intests/test_env_on.py(HOS_FPS_LOGinhost/oot_high_fps.c:15, from8fcc8c22/ #2470;221 passed, 1 failed).Python source checks (windows-2022, part 1/2): fails intests/test_env_on.py(upstream #2470),tests/test_pcache_header_read.py(fopenunder-Werror,-Wdeprecated-declarations, upstream #2488), andtests/test_driver_faults.py(Assertion failed: most > 1timing flake under Windows runner load; passed in Ubuntupart 2/2).Python source checks (windows-2022, part 2/2): fails only intests/test_psychov35.py(std::scanfunder-Werror,-Wdeprecated-declarations, missing_CRT_SECURE_NO_WARNINGS, upstream #2481).Happy to rebase again once
mainpicks up those fixes.github-sync referenced this pull request2026-11-12 06:22:58 +00:00
#1864 landed with the same system, so this branch is superseded. What #1864 lacked (the start-up screen and FPS counter in the menu's language, and English where no font draws a script) is in #2679, rebuilt on #1864's tables. Thanks for the review, Joey-Magnus.