Skip to content

Move localization tables into one file per language - #5

Open
wanming wants to merge 1 commit into
mainfrom
claude/project-thread-oj33qx
Open

wanming wants to merge 1 commit into
mainfrom
claude/project-thread-oj33qx

Conversation

@wanming

@wanming wanming commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Before: all ten interface languages lived in one 3,341-line InkletLocalization.swift. To add a string, you had to find ten spots in that file.

After: each language has its own file under Sources/InkletApp/Localization/ (L10n+en.swift, L10n+ja.swift, and so on). InkletLocalization.swift is down to about 190 lines of lookup logic. The app looks and behaves exactly the same, including switching languages from inside the app.

The tables are still Swift dictionaries, not .strings resource files. That keeps L10n lookup, fallback and runtime switching unchanged, and it avoids any change to how the app bundle is packaged. A script confirmed that all 312 keys in all 10 tables match the old file exactly.

How: each private static let <lang> table became a static let in an extension L10n file. The localization source tests now read the split files through a shared LocalizationSourceFixture, which joins them in translationTables order, so their ordering assertions still hold. CONTRIBUTING.md now says where interface text lives and that the localization check fails when a key is missing from any table.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DzisdHuvFVePscX66cn3Lw


Generated by Claude Code

Each interface language now has its own file under
Sources/InkletApp/Localization, so adding a key means editing ten small
files instead of scrolling one 3,300-line dictionary. Lookup, fallback
and in-app language switching are unchanged. Localization source tests
read the split files through a shared fixture.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DzisdHuvFVePscX66cn3Lw
@wanming
wanming marked this pull request as ready for review October 4, 2026 23:31
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.

2 participants