Add a language
- The app speaks Korean (
ko), English (en), Japanese (ja) and Simplified Chinese (zh-hans). - Codes are lowercase BCP 47.
- A language with two writing systems uses the full code, such as
zh-hans. When the system reports onlyzh-CN, the region tells which writing system it is. - Add two string files and register them, then update the site and installer language lists below.
- The Korean file is the reference: copy its key order and placeholders (
{name}) as they are. - The tests tell you what is missing.
- The language list has two sources:
NAMESinsrc/core/strings/names.js(page) andALLinsrc-tauri/src/i18n/mod.rs(backend). - The list in the Settings tab, the capture script and the site tests read from those two.
1. Page strings
Copy
src/core/strings/ko.jstosrc/core/strings/<code>.jsand translate the sentences. The file exports two required things and two optional ones:Export What it holds sentenceA regular expression that recognizes a sentence in that language ( text.jsuses it to tell error sentences from codes). Use a character range when the writing system gives the language away, otherwise punctuationstringsKey → sentence. Keys whose value is a list (greetings, chatter) stay lists listSeparator(optional)The separator when listing names. Default ', '; Japanese uses'、'sentenceSeparator(optional)What goes between two sentences shown in a row. Default ' '; Japanese and Chinese use''Add one entry to
NAMESinsrc/core/strings/names.js: the code and what the language calls itself. The language list in the Settings tab comes from here, and a page loadsstrings/<code>.jsby that code only when it speaks the language.Use plain placeholders.
words.jsadds Korean particles (a placeholder with the two particle forms after a colon) for Korean only. When listing names,joinListpicks that language's comma; sentences shown in a row go throughjoinSentences.For a different writing system, add a font stack for the language in
src/styles/base.css, like:root:lang(ja)(Chinese drawn with Japanese fonts gets different glyph shapes).
2. Backend strings
- Copy
src-tauri/src/i18n/ko.rstosrc-tauri/src/i18n/<module>.rs.- The module name is the code with
-turned into_(a Rust module name cannot contain a hyphen):zh-hansiszh_hans.rs. - Keep rows in the same order as
ko.rs. The test checks the order too, so the files can be edited side by side.
- The module name is the code with
- Put the code and the English name in
SPECat the top of the file. The AI gets the English name when told "answer in this language". - In
src-tauri/src/i18n/mod.rs:- Add
mod <module>;(for examplemod zh_hans;). - Add
&<module>::SPECtoALL. - Increase the array length in its type (
[&Spec; 4]) by one.
- Nothing else changes:
Langrefers to a language by its position inALL.
- Add
3. Other places
| Place | What to change |
|---|---|
| Site | locales in website/.vitepress/config.mts and the docs in website/<code>/guide/. Register the locale in scripts/site-content.mjs, add theme/landing-<code>.ts and its active copy contract, and update theme/words.ts and the creator components. Add an Open Graph card, guide pages and release notes, then test canonical and alternate links |
| Captures | Add the language's names, personalities and sample conversation to script in scripts/shots.mjs; pnpm run shots then captures screens in that language too (it reads the language list from strings.js). Choose languages with SHOT_LANGS=ko,en |
docs/standards/i18n.md | The supported-languages line |
| OG images | scripts/make-og.mjs makes one image per language the site has. Add the language once the site has it |
README.md and this doc | The language line in README.md and the first line of this doc |
| Windows installer | The NSIS language name in bundle.windows.nsis.languages in src-tauri/tauri.conf.json and the locale in packaging/windows/msix/AppxManifest.xml. Update the expected mappings in tests/repository-config.test.mjs |
- The site picks its languages separately, so it can have fewer than the app.
- Today the landing page, user guide and release pages are in Korean, English, Japanese and Simplified Chinese.
- The developer docs are in English only.
Landing.vuecomposes the landing modules.- Publishing, captures and release validation share the locale registry.
- Once the site has docs in that language,
tests/website.test.mjslooks for the captures used bywebsite/<code>/in that language's folder. - Windows installer:
- Keep the language selector enabled.
- NSIS uses names such as
English,Korean,JapaneseandSimpChinese; MSIX uses locale tags. - Inspect the installer and uninstaller on Windows.
4. Check
pnpm testtests/i18n.test.mjschecks that every language file has the same keys and placeholders, that no Korean is left in a module, that every key the code asks for is in the table, and that every key in the table is one the code uses.i18n::testsincargo testchecks the backend side the same way.- Then run the app with
PLAYPETS_LANG=<code>and pick the language in the Settings tab.