Repository navigation
iOS shell texts are lines of the language files, its catalogs are generated (#388) - #482
Merged
Merged
Conversation
…#388) A lookup names only keys en.json has, a key built at run time needs a declared prefix, and a key no source uses fails. The rules file frontend/Tests/l10n-key-rules.json is shared by the Mac and the Qt test. Windows showed the key msg.done after a build, it is back in every language with msg.ipaAt. 26 keys no code used, the three opt.* ones and the settings.language.<code> names are removed from every language file.
…re generated (#388) The 126 texts of ShellUI and ShellHost are now keys of frontend/l10n/en.json and zh.json, under ios.ui. and ios.host. tools/l10n_shell_catalogs.py writes the two Localizable.xcstrings from the files, with a localization for every language file that has the key. The generated catalogs are byte for byte the ones that were committed, so no visible text changes and the Swift code stays as it is. A test fails when a committed catalog differs from what the files give, or when the Demo app, try-local or the engine's shell app do not declare every language file. Patch 0056 declares de, fr and sv next to en and zh-Hans in the shell app of the engine. The key checks count the ios.* keys as used (catalogKeys in l10n-key-rules.json).
4 of 6 tasks
# Conflicts: # frontend-qt/nspb_qt/localization.py # frontend/Sources/NX2Apple/ContentView.swift # frontend/Sources/NXCore/Localization.swift # frontend/Sources/NXCore/ShellInstall.swift # frontend/Tests/NX2AppleTests/ShellInstallTests.swift
# Conflicts: # frontend/Sources/NXModel/BuildStore+ShellRoot.swift
# Conflicts: # frontend-qt/nspb_qt/localization.py # frontend/Sources/NX2Apple/ContentView.swift # frontend/Sources/NXCore/Localization.swift # frontend/Sources/NXCore/ShellInstall.swift # frontend/Tests/NX2AppleTests/ShellInstallTests.swift
# Conflicts: # frontend/Sources/NXModel/BuildStore+ShellRoot.swift
# Conflicts: # AGENTS.md
3 of 4 tasks
5 of 6 tasks
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.
Stacked on #481 (stack #459), retarget to main after the ones below merge.
Fix or feature
Feature from outside: not applicable, this is part of the agreed plan in #388.
What and why
Part of #388, step 5.
The iOS shell had its own two string catalogs,
Localizable.xcstringsin ShellUI and ShellHost, with English and Chinese only. They were separate from the launchers' texts and could not take a new language without a hand edit. Now the shell's texts are lines offrontend/l10n/<code>.json, next to the launchers' texts.ios.ui.*(ShellUI, 67) andios.host.*(ShellHost, 59) inen.jsonandzh.json. The names are plain (ios.ui.performanceOverlay,ios.host.manifestMissing). I did not reuse launcher keys with the same English words. A launcher text can change for the launcher alone, and six of the shared words (Play, On, Off and others) have a different Chinese text in the launcher.tools/l10n_shell_catalogs.pywrites both catalogs from the files. The Swift code asks for a text by its English words (ShellStrings.text("Done")), so the catalog key is the English text of the JSON key, with%@and%lldunchanged. Every language file that has the key adds a localization (zhbecomeszh-Hans). The languages are the files of the folder, a new file needs no change in the tool.--checkexits 1 when a committed catalog is out of date. Format:sourceLanguageen,version1.0, no plural variations, statetranslated.sv.json,de.jsonandfr.json.CFBundleLocalizations. The Demo app (project.ymlandGen/Info.plist) now declares en, de, fr, sv and zh-Hans, astools/try-localalready did. The shell app of the engine had en and zh-Hans, so patch 0056 adds the others (fork-only, same as 0055). Patch numbers are renumbered at merge from main's series.catalogKeysinfrontend/Tests/l10n-key-rules.jsonlists the two prefixes, so theios.*keys do not count as unused. The Mac test and the Qt test both read it. The German prose test in the Qt tests skipsios.*, the launcher never shows them.frontend/README.md,frontend/ARCHITECTURE.md,AGENTS.mdandfrontend-ios/README.mdsay where the shell texts live. The "later step of One JSON file per language, read by the Mac launcher, the Windows launcher and the iOS shell #388" notes from The language list comes from the language files (#388, step 2) #479 are gone.Tests
tools/tests/test_l10n_shell_catalogs.py(14 tests): the committed catalogs equal the generated ones, Xcode format, format specifiers kept in every language, English and Chinese have every shell text, a new language file shows up, a duplicate English text fails, and the Demo app,tools/try-localand the engine's shell app declare every language file. It is in the "Patch, engine and release tool tests" step oftests.yml.LocalizationKeyTestsandtest_localization_keys.pygot one test each for thecatalogKeysentries.About #429
I did not fix #429. The English rows on a Chinese device are not a missing catalog entry. A game's settings page (section, label, note, options) is drawn from the game's
launcher.json, which is English, and the shell has no table that translates it. The shell's own texts were already Chinese. The plan in #429 builds on theios.*keys of this step.Checked
cd frontend && swift test(639 tests, 17 skipped, 0 failures),cd frontend-ios && swift test(110 Swift Testing tests and the XCTest ones, 0 failures),python3 -m unittest discover -s frontend-qt/tests(238, 14 skipped),python3 -m unittest discover -s tools/tests(162),python3 tools/engine.py check(35 patches apply).Screenshots
None, no visible change.
Scope
dm/,scripts/,docs/,ref/) is added to the repository: a change there is a patch inpatches/(a commit inengine/, thentools/engine.py export, andtools/engine.py checkpasses), with itsUpstream-Statusfork-only, it lists the languages of this fork'sfrontend/l10n