Skip to content

feat(strings): add canonical locales.json (RFC 0003) - #53

Merged
willwade merged 2 commits into
mainfrom
locale/canonical-locales-json
Aug 2, 2026
Merged

feat(strings): add canonical locales.json (RFC 0003)#53
willwade merged 2 commits into
mainfrom
locale/canonical-locales-json

Conversation

@willwade

@willwade willwade commented Aug 2, 2026

Copy link
Copy Markdown

Summary

Adds the canonical locale list for DasherCore (RFC 0003) and a CI guard that keeps it in sync — the DasherCore-first step of the multilingual-UI work.

1. Strings/locales.json — the locale SSOT

DasherCore ships 33 strings_*.json translation files but had no canonical list of those locales (code, endonym, RTL), so every frontend hardcoded its own subset picker (Apple 9, Windows 10, GTK 0) and they drifted. locales.json is the single source of truth those pickers read.

{ "_comment", "locales": [ { "code", "endonym", "rtl" } ] } for all 33 shipped locales — generated from the strings_*.json filenames merged with the endonym/RTL table in RFC 0003. RTL flags: ar, fa, ur. Ordered by code; display ordering is the frontend's concern. Pure data; no engine or API change.

2. tests/test_locales_sync.cpp — drift guard

A doctest that fails if locales.json and the shipped strings_<code>.json files drift apart in either direction — a new strings_xx.json missing from locales.json, or a locales.json entry with no file. Registered via dasher_add_test, so it runs in every CI matrix job.

Self-contained (no JSON dependency): codes come from the filenames and a focused scan of locales.json. Verified locally — passes at 33==33, and fails loudly with a diagnostic when a strings_*.json is removed.

Out of scope (follow-ups)

  • Per-frontend work (separate repos): replace hardcoded pickers with one bound to this file.
  • Optional C API to query the locale list at runtime (dasher_get_locale_count / dasher_get_locale_info) — deferred until a frontend needs runtime access instead of codegen.

Verification

json.load succeeds; 33 codes match the 33 strings_*.json filenames; the guard test builds and passes (and fails on simulated drift).

Add Strings/locales.json — the canonical, machine-readable list of locales
DasherCore supports: {code, endonym, rtl} for all 33 locales that ship a
strings_*.json file. This is the single source of truth for every frontend's
locale picker, so they stop hardcoding divergent subsets (Apple 9, Windows 10,
GTK 0).

Pure data; no engine or API change. Generated to match the strings_*.json
files exactly (33 == 33; RTL: ar, fa, ur). Frontends codegen/bind their
pickers from this file (RFC 0003).

Follow-ups (separate): a CI guard that asserts locales.json stays in sync
with strings_*.json, and optionally a C API to query the list at runtime.

Signed-off-by: will wade <willwade@gmail.com>
Add tests/test_locales_sync.cpp: a doctest that fails if Strings/locales.json
and the shipped strings_<code>.json files drift apart in either direction — a
new strings_xx.json missing from locales.json, or a locales.json entry with no
file. Registered via dasher_add_test, so it runs in every CI matrix job.

Self-contained (no JSON dependency): codes come from the filenames and a
focused scan of locales.json. Verified locally — passes at 33==33, and fails
loudly with a diagnostic when a strings_*.json is removed (restored after).

Signed-off-by: will wade <willwade@gmail.com>
@willwade
willwade merged commit 8bb4ed9 into main Aug 2, 2026
14 checks passed
willwade added a commit to dasher-project/Dasher-Apple that referenced this pull request Aug 2, 2026
Updates the `DasherCore` submodule from **v0.2.1** (`541c6bc8`) to
**v0.2.2** (`8bb4ed98`).

**v0.2.2 adds** ([DasherCore
#53](dasher-project/DasherCore#53)):
- `Strings/locales.json` — the canonical locale list (code / endonym /
rtl) for RFC 0003.
- A CI sync-guard (`tests/test_locales_sync.cpp`) that fails if it
drifts from `strings_*.json`.

This unblocks the frontend localisation work (binding locale pickers to
`locales.json`) on the feature branch.

Submodule pointer only; no Dasher-Apple source changes.

Signed-off-by: will wade <willwade@gmail.com>
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