Skip to content

Add Japanese support and repair double-encoded locale files - #49

Merged
Charlie-Carson merged 1 commit into
mainfrom
feature-japanese-support
Sep 4, 2026
Merged

Add Japanese support and repair double-encoded locale files#49
Charlie-Carson merged 1 commit into
mainfrom
feature-japanese-support

Conversation

@Charlie-Carson

@Charlie-Carson Charlie-Carson commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Closes the Japanese half of https://github.com/orgs/ChurchApps/discussions/707 for the web apps (B1Mobile is out of scope here).

Japanese was never switched on

Every app already ships a ja.json, but ja was missing from Locale.supportedLanguages, so a ja-JP browser silently fell through to English. Added to all four Locale copies (helpers, forms, donations, login).

The locale files were double-encoded

public/locales/*.json held UTF-8 bytes that had been read back as windows-1252, so text was mangled on disk:

language on disk should be
ja キャンセル キャンセル
es Número de Cuenta Número de Cuenta
de Schließen Schließen
ru ПожалуйÑта Пожалуйста

This hit all 27 non-ASCII locale files, so turning Japanese on without fixing it would just have swapped English for garbage — and Spanish, the language the discussion opened about, was already showing it on donation forms.

The mangling used the WHATWG windows-1252 table rather than strict CP1252 (0x81 0x8D 0x8F 0x90 0x9D pass through as their own code points), which is why a plain cp1252 round-trip only recovers part of it.

Tests

Locale.test.ts gains a per-file check that fails if double-encoded text is committed again, plus coverage for ja being supported. Verified the check actually fires by re-mangling a string. Full suite: 113 passing.

Rollout

B1Admin and B1App consume this from npm, so they need an apphelper release before Japanese turns on for them. Their translation-side changes are in ChurchApps/B1Admin#516 and ChurchApps/B1App#540.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KZcActb7JW6orsPWtVMHRs

"ja" was missing from Locale.supportedLanguages even though every app
already ships a ja.json, so Japanese browsers silently fell back to
English. Add it to all four Locale copies.

The locale JSON files were also stored double-encoded: UTF-8 bytes that
had been read back as windows-1252, so "キャンセル" was on disk as
"キャンセル". This affected every non-ASCII language, not just
Japanese - Spanish showed "Número de Cuenta", German "Schließen".
Decode them back to real UTF-8 and add a test that fails if mangled text
is ever committed again.

Also finishes the Japanese translations: ja.json now covers all 237 keys
(was 194 translated, 2 missing).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KZcActb7JW6orsPWtVMHRs
@Charlie-Carson
Charlie-Carson merged commit b6b5426 into main Sep 4, 2026
1 check passed
@Charlie-Carson
Charlie-Carson deleted the feature-japanese-support branch September 4, 2026 09:05
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