Skip to content

CFM-19, CFM-20: add Slovenian translation and English fallback (backport of #434) - #436

Merged
kswenson merged 3 commits into
v2.2.xfrom
CFM-19-add-slovenian-translation-2.2.x
Aug 27, 2026
Merged

CFM-19, CFM-20: add Slovenian translation and English fallback (backport of #434)#436
kswenson merged 3 commits into
v2.2.xfrom
CFM-19-add-slovenian-translation-2.2.x

Conversation

@kswenson

Copy link
Copy Markdown
Member

Backport of #434 (CFM-19, CFM-20) from master to v2.2.x.

This is the release that unblocks CODAP-1484: CODAP v3's main pins ~2.2.12, so it consumes the 2.2.x line via the npm latest tag. The master landing ships only to next, which CODAP main does not consume.

Contents

Three commits cherry-picked with git cherry-pick -x, applied cleanly with no conflicts:

Commit Work
c066da4 CFM-19 — add Slovenian (sl) translation
6593780 CFM-20 — fall back to English rather than the raw key
51c6e9e Review feedback from #434

CFM-19 — Slovenian is complete in CFM's POEditor project (163/163 keys, none empty, verified against en-US.json). Adds src/code/utils/lang/sl.json, registers it in languageFiles, and adds "sl" to LANGUAGES in the pull script.

CFM-20translate() resolved a string as translations[lang][key] and fell back to the key itself, so an unrecognized language rendered every string as its own key (~MENUBAR.UNTITLED_DOCUMENT in the title bar). Now resolves against 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.

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

Check Result
npm test 26 suites, 218 tests passing
npx tsc --noEmit clean
npm run lint clean
npm run build compiled successfully

The four touched files (translate.ts, translate.test.ts, lang/sl.json, strings-pull-project.sh) are byte-identical to master — confirmed with git diff origin/master HEAD over those paths, which returns empty.

218 tests here versus 237 on master is expected: v2.2.x does 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.13 PR should follow this one.

🤖 Generated with Claude Code

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
kswenson marked this pull request as ready for review August 27, 2026 05:20
@kswenson

Copy link
Copy Markdown
Member Author

Merging without review since it was already reviewed in #434.

@kswenson
kswenson merged commit ac9d8e8 into v2.2.x Aug 27, 2026
2 checks passed
@kswenson
kswenson deleted the CFM-19-add-slovenian-translation-2.2.x branch August 27, 2026 05:25
@kswenson kswenson mentioned this pull request Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant