Translations
The editor's own words can be shown in another language; a map's text is never translated. English and Korean ship today, chosen in Preferences ▸ General or following the browser.
- Writing a string. The English text is the key:
t("Save {name}", { name }). The argument must be a string literal, since the extractor reads the source. A string kept in a table is markedmsg("…")where it is written and shown withtranslate(value). Never callt()at module scope, where the language is not yet known. Where one English word means two things,tc("menu", "Open")adds a context. - Placeholders are a small subset of ICU MessageFormat:
{name},{n, plural, …}and{x, select, …}. Korean particles agree with the word before them through{name|을}. - The catalogues.
src/i18n/ko.jsonmaps the English text to the Korean. After adding a string, runnpm run i18n -- --write, which adds the new key with an empty value (shown in English until filled in) and drops keys nothing uses.tests/i18n.test.tsfails on a missing or unused key, a placeholder mismatch, or at()whose argument is not a literal. - Reviewing.
npm run i18n -- --export ko ko.csvwrites the catalogue as a spreadsheet with the source files each string appears in;--import ko ko.csvreads it back. The Korean was not written by a native speaker, and a native reader's review is welcome.
The scmjs command line has its own catalogue, cli/src/ko.json, kept the same way: the
extractor reads cli/src/ into it as it reads src/ into src/i18n/ko.json, so neither
bundle carries the other's words. What the command leaves English is in
cli.md.
Plugins get the same translator on api.i18n; see plugins.md.
.claude/internals/i18n.md covers adding a language and the Korean particle rules.