The editor supports the following locale codes:
| Code | Language | Role |
|---|---|---|
en |
Neutral English | Default and fallback locale. |
es |
Neutral Spanish | User-selectable locale. |
pt |
Neutral Portuguese | User-selectable locale. |
Locale catalogs are stored in locales/<code>.json. Every catalog must expose
the same keys under the strings object.
The language selector is located in the application header. A locale change is
applied without reloading the page and is persisted under the local-storage key
mapbuilder.locale. A new browser profile starts in English regardless
of the browser language.
The runtime loads locale files through repository-relative HTTP requests. If a stored non-English locale cannot be loaded, the editor retries with English.
English source text is the translation key. Static DOM text and translatable
attributes are resolved against the active catalog. Dynamic messages call the
t function directly and may provide named interpolation values:
t("{count} tiles connected.", { count: formatNumber(reached) });Placeholders use braces and must remain identical across locales. Do not translate technical identifiers, keyboard keys, file extensions, item names, or monster names.
- Copy
locales/en.jsontolocales/<code>.json. - Translate every value without changing its key.
- Add the locale code to
SUPPORTED_LOCALES. - Add a native-language option to
#language-select. - Confirm that all catalogs have identical key sets.
- Test static text, dynamic messages, dialogs, accessibility labels, and persistence after reload.
Run JSON syntax validation for every catalog:
for file in locales/*.json; do jq empty "$file"; doneConfirm key parity against the English catalog:
for file in locales/*.json; do
echo "$file"
diff <(jq -r '.strings | keys[]' locales/en.json) <(jq -r '.strings | keys[]' "$file")
doneLocale changes must also confirm that English remains the default when no saved preference exists, and that a locale switch leaves no untranslated node in the document.