Skip to content

One rules test per front end for every language file (#388 step 3) - #480

Merged
v0lumehi merged 7 commits into
v0lumehi/l10n-language-listfrom
v0lumehi/l10n-rules-tests
Nov 2, 2026
Merged

v0lumehi merged 7 commits into
v0lumehi/l10n-language-listfrom
v0lumehi/l10n-rules-tests

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #479 (stack #459), retarget to main after the ones below merge.

Fix or feature

  • Fix
  • Feature

What and why

Part of #388, step 3.

The language files in frontend/l10n had one German test and one French test per front end. They checked their own language only, and a new language had no test at all. Now there is one rules test per front end. It finds the languages in the folder, so a sixth file is checked without a change to the test.

The rules, for every file found:

  • en.json and zh.json have the same keys.
  • No language has a key that en.json does not have. A missing key is allowed, it shows English.
  • Placeholders match the English text of the same key (%@, %d, %ld, %.1f, %%, positional %2$@, and {0} or {name}). A positional placeholder may be reordered, as in launch.scaleOfDocked in zh.json.
  • No empty value, and every value is a text.
  • _language is there with a name and locales (lowercase, including the code), and no two files claim the same locale.
  • Keys are flat, sorted by code point, with _language first, no duplicates, one entry per line, and the file ends with a newline.

Tests:

  • frontend/Tests/NXCoreTests/LocalizationRulesTests.swift (7 tests)
  • frontend-qt/tests/test_localization_rules.py (7 tests)

Removed because the new tests cover them:

  • Swift: testEveryKeyHasAGermanEntry, testFormatPlaceholdersMatchEnglishInCountAndOrder, testEveryKeyHasFrenchText, testPlaceholdersMatchTheEnglishText and the two placeholder helpers.
  • Python: test_placeholders_match_english_in_count_and_order (German), test_every_row_has_french_and_its_placeholders, and the empty check in the German test.

Everything else in the German and French tests stays: the not-left-in-English checks, the text rules and the checks that the catalogs are used.

Checked

  • Tests: swift test in frontend passes except ConsoleTests.testFirstTileRingIsNotClippedAfterScrollingBack (a focus ring in a rendered view, it does not touch localization). Qt tests and tools/tests pass. The pre-push hook passes.
  • Visual QA: not applicable.
  • Run on a device or Mac: not run, tests only.

Screenshots

None, no visible change.

Scope

  • No engine file (dm/, scripts/, docs/, ref/) is added to the repository: a change there is a patch in patches/ (a commit in engine/, then tools/engine.py export, and tools/engine.py check passes), with its Upstream-Status
  • A fix to the engine or a game profile also goes to seedds/nxnative as a PR in parallel: this PR's patch says forwarded seedds/nxnative#..., or pending until that PR is open
  • A change to a launcher view has before and after screenshots above
  • No keys, game files or data extracted from a game in the change or the attachments

@v0lumehi v0lumehi added this to the v1.0.2 milestone Nov 2, 2026
@v0lumehi v0lumehi added enhancement New feature or request launcher The NX2Apple launcher app mac Mac windows Windows (the Qt front end) labels Nov 2, 2026
@v0lumehi
v0lumehi added this pull request to stack #459 November 2, 2026 05:22
# 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
@v0lumehi
v0lumehi merged commit d9ae970 into main Nov 2, 2026
16 of 28 checks passed
@v0lumehi
v0lumehi deleted the v0lumehi/l10n-rules-tests branch November 2, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request launcher The NX2Apple launcher app mac Mac windows Windows (the Qt front end)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant