i18n
The build half of the localization system. Nested TypeScript objects under packs/data/i18n/ are the source of truth for your addon's text, and the filter generates everything downstream: the .lang files Bedrock resolves on each player's client, the runtime bundle @bedrock-core/i18n resolves on the server, and the types that make every key and interpolation variable autocomplete.
Install
regolith install github.com/bedrock-core/regolith-filters/i18n
Add it to config.json before the bundler filter, and after guides if you use it:
config.json
{
"regolith": {
"profiles": {
"default": {
"filters": [
{ "filter": "guides" },
{ "filter": "i18n" },
{ "filter": "bundler" }
]
}
}
}
}
No settings are required when the namespace scan succeeds.
Settings
| Setting | Type | Default | Description |
|---|---|---|---|
namespace | string | derived | Overrides the core.register scan; required only when the scan fails. Must match ^[a-z0-9_]+$ |
defaultLocale | string | "en_US" | The locale whose file defines the shape and the types |
sourceDir | string | "data/i18n" | Where the per-locale resource modules live, relative to the Regolith temp workspace |
vanilla | boolean | false | Generate the $.vanilla.* tree and bundle referenced vanilla strings. Off by default: fetches and diffs the vanilla .lang files on every build |
vanillaLangUrlTemplate | string | bedrock-samples URL | Where vanilla .lang is fetched from — {locale} is replaced |
cacheMaxAgeHours | number | 24 | Hours before a locale's cached vanilla .lang is stale |
strict | boolean | true | Fail the build on check violations instead of warning |
pretty | false | { indent?, size? } | false | How generated JSON is laid out. Absent or false writes it minified. An object lays it out: indent is "tab" or "space", size the characters per level (2 for spaces, 1 for tabs when omitted) |
If data/i18n does not exist, or contains no locale files, the filter logs and exits cleanly — there is nothing to compile.
See i18n for authoring locale resources, libraries and overrides, and the runtime API.