CFM-19, CFM-20: add Slovenian translation and English fallback (backport of #434) - #436
Merged
Merged
Conversation
Slovenian is complete in CFM's POEditor project (163/163 keys, none empty) but was never bundled. CODAP v3 cannot offer Slovenian until CFM does: translate() falls back to the raw key rather than English, so a Slovenian user would see ~MENUBAR.UNTITLED_DOCUMENT in the title bar. - pull src/code/utils/lang/sl.json from POEditor project 125177 - register it in the languageFiles list in translate.ts - add "sl" to LANGUAGES in bin/strings-pull-project.sh translate.test.ts asserts the bundled list stays in sync with the pull script, so both halves are required together. Unblocks CODAP-1484. (cherry picked from commit 4e1960e)
translate() resolved a string as translations[lang][key] and fell back to the key itself when that was missing. An unrecognized language therefore rendered every string as its own key -- a consumer selecting a language CFM lacks saw ~MENUBAR.UNTITLED_DOCUMENT rather than "Untitled Document". The same applied per key: a key missing from an otherwise-present locale also rendered as the key. Fall back to en-US before falling back to the key. A key that exists in no locale still renders as itself, so nothing that works today changes. This is what made Slovenian unshippable in CODAP 3.1.0: a 98%-translated locale could not ship at all, because the failure mode for the residual 2% was raw keys rather than English. Tests cover all three acceptance cases; the three fallback tests were confirmed to fail against the previous implementation. (cherry picked from commit 14936d2)
Addresses review feedback on #434. The bundled-language assertion hardcoded "Nov". sl.json is regenerated by every POEditor pull, so a translator reworking that string would fail a test about fallback behavior. Compare against the imported JSON instead, with a not.toBe against the English value so the assertion still proves Slovenian was selected rather than falling through. Left the English-valued assertions as literals: en-US is not pulled from POEditor (LANGUAGES excludes it; en-US.json is generated locally from en-US-master.json), so they carry no churn risk. The "Nov" inside the isolateModules block is the mock's own literal, not sl.json data, and the interpolation test would have to reimplement translate()'s substitution to avoid its literal. Also adds the missing `th` comment in the pull script's language list, which had 17 comments against 18 entries. (cherry picked from commit 36ca512)
kswenson
marked this pull request as ready for review
August 27, 2026 05:20
Member
Author
|
Merging without review since it was already reviewed in #434. |
Merged
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.
Backport of #434 (CFM-19, CFM-20) from
mastertov2.2.x.This is the release that unblocks CODAP-1484: CODAP v3's
mainpins~2.2.12, so it consumes the 2.2.x line via the npmlatesttag. Themasterlanding ships only tonext, which CODAPmaindoes not consume.Contents
Three commits cherry-picked with
git cherry-pick -x, applied cleanly with no conflicts:c066da4sl) translation659378051c6e9eCFM-19 — Slovenian is complete in CFM's POEditor project (163/163 keys, none empty, verified against
en-US.json). Addssrc/code/utils/lang/sl.json, registers it inlanguageFiles, and adds"sl"toLANGUAGESin the pull script.CFM-20 —
translate()resolved a string astranslations[lang][key]and fell back to the key itself, so an unrecognized language rendered every string as its own key (~MENUBAR.UNTITLED_DOCUMENTin the title bar). Now resolves againsten-USbefore falling back to the key. A key that exists in no locale still renders as itself, so nothing that works today changes.The two are bundled because CFM-20 is what makes CFM-19 safe downstream: without the fallback, a locale short of 100% renders raw keys rather than English for the gap.
Verification
npm testnpx tsc --noEmitnpm run lintnpm run buildThe four touched files (
translate.ts,translate.test.ts,lang/sl.json,strings-pull-project.sh) are byte-identical tomaster— confirmed withgit diff origin/master HEADover those paths, which returns empty.218 tests here versus 237 on
masteris expected:v2.2.xdoes not carry CFM-15's testid suites.Not included
The version bump stays out of this PR, following the #429 → #431 precedent where the CFM-18 backport and the release were separate. A
Release v2.2.13PR should follow this one.🤖 Generated with Claude Code