mirror of
https://github.com/CharlesWiltgen/Axiom.git
synced 2026-09-20 19:58:20 +08:00
e8a51cace9
Writing a catalog from a script: the layout Xcode expects, measured on a 970-key catalog where a generic JSON writer produced a 26,531-line diff that buried the actual translation. The two Apple writers order the top-level keys differently — the editor by `localizedStandardCompare`, `xcstringstool` by code point — so a sync over an editor-maintained catalog re-sorts every key. `xcstringstool` is the headless path in and out of a catalog, through `xcrun`. It prunes: an entry missing from the `.stringsdata` is marked stale if it has translations and deleted outright if it has none, exit 0 and no warning, which makes `--skip-marking-strings-stale` the guard worth knowing before the first run. It re-emits the canonical layout only when it has something to write. Key styles: the source string is `localizations[sourceLanguage]` if present, else the key itself — a tool has to handle both, and `sourceLanguage` is not always `en`. Homographs: a comment gives a translator context, it does not split a key. One English word used for two concepts is one entry with one translation and merged comments; each meaning needs its own key with the English in a default value. Terminology: the simulator runtime ships Apple's own localized bundles, which are the exact UI strings, alongside hundreds of AppShortcuts phrase files — more precise than a support page for the form of a string, though the support pages still win for what a user says aloud.