Skip to main content

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​

SettingTypeDefaultDescription
namespacestringderivedOverrides the core.register scan; required only when the scan fails. Must match ^[a-z0-9_]+$
defaultLocalestring"en_US"The locale whose file defines the shape and the types
sourceDirstring"data/i18n"Where the per-locale resource modules live, relative to the Regolith temp workspace
vanillabooleanfalseGenerate the $.vanilla.* tree and bundle referenced vanilla strings. Off by default: fetches and diffs the vanilla .lang files on every build
vanillaLangUrlTemplatestringbedrock-samples URLWhere vanilla .lang is fetched from — {locale} is replaced
cacheMaxAgeHoursnumber24Hours before a locale's cached vanilla .lang is stale
strictbooleantrueFail the build on check violations instead of warning
prettyfalse | { indent?, size? }falseHow 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.

On this page