Repository navigation
Conversation
…SETTINGS_LANG=it The settings window of a Mac app is in English only. With DM_SETTINGS_LANG=<lang> set for the NSP script, settings.py reads dm/games/settings.<lang>.tsv (one key and its text per line: <VAR>.label, <VAR>.note, <VAR>=<value> for a choice's option, section:<Name>, ui:<the window's own English string>) and writes the translated labels, notes, options and sections into launcher.json, plus a ui table for the window's own strings. Launcher.swift (the window, its menu, and the cloud-save questions before the game, with the window on or off) and LauncherRow.swift look those up through L(), which falls back to the English string, so a build without the variable, or a string the table lacks, stays as it was. settings.it.tsv is the Italian table. The cloud-save choice's own texts (SaveSyncReport) stay English. Checked: on swordboiMacNative's branch, the Ocarina of Time v131072 Mac app built with DM_SETTINGS_LANG=it shows its labels, notes, options, sections and buttons in Italian. On main: the Mac launcher's Swift typechecks with the four sources pack_app.py compiles; settings.build() for Ocarina of Time gives Italian labels and the ui table for mac and ios with the variable, and no ui table and the English labels without it; test_settings and test_launcher_settings pass. Upstream PR seedds#780 localizes the built-in launchers with stable keys inside the app; this is the smaller build-time form. Front-ends: new: dm/launcher.json may carry a "ui" table (English string → translation) when the app is built with DM_SETTINGS_LANG; its settings' labels, notes and options are then translated. A front end may ignore it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
A Mac app's settings window is English only. This adds a build-time translation: with
DM_SETTINGS_LANG=itset for the NSP script,dm/games/settings.pyreadsdm/games/settings.it.tsvand writes intodm/launcher.json:uitable for the window's own strings, including the cloud-save questions before the game, with the window on or off.Launcher.swiftandLauncherRow.swiftlook the strings up throughL(), which falls back to English. A build without the variable gives the samelauncher.jsonas before, and a string the table lacks stays English. The table format is one key and its text per line (<VAR>.label,<VAR>.note,<VAR>=<value>,section:<Name>,ui:<English>), so another language only needs its ownsettings.<lang>.tsv.#780 localizes the built-in launchers inside the app with stable keys. This is a smaller build-time form that needs no app changes per language. If #780 is preferred, the Italian strings here can move into it.
Not translated:
SaveSyncReport's own texts (the cloud-save choice's title and message), which the iPhone app shares.Checked
dm.tools.tests.test_settingsandtest_launcher_settingspass.test_env_switches/test_docsshow the same failures asmainwithout this change (switches quoted but read nowhere,DM_GL_RENDERPROGS/DM_NVN_UNBIND_DEFERwithout a row).dm/tools/lint_python.py --against main: 0 new.test_env_switches, with the same list as on60284e79without this change. Host unit tests aborted int_pad_hid_mac(theHIDPAD_NIN_TRIESassertion,t_pad_hid_mac.m:236), which this change does not reach; it passes 6 of 6 runs here, andmain's host job has failed on other tests too (t_dirty_reuseon b04c42b).main: the Mac launcher's Swift typechecks with the four sourcespack_app.pycompiles (swiftc -typecheck, macOS 26 target).settings.build()for Ocarina of Time (0400486024DEC000v131072):uitable for bothSETTINGS_PLATFORM=macandios;uitable.main.Front ends
Front-ends: new:
dm/launcher.jsonmay carry a"ui"table (English string → translation) when the app is built withDM_SETTINGS_LANG; its settings' labels, notes and options are then translated. A front end may ignore it.Docs
docs/settings.mdsays how to use it;docs/env_switches.tsvlistsDM_SETTINGS_LANG🤖 Generated with Claude Code