Ship localized extension metadata and UI strings with predictable _locales handling in both development and production builds.
Extension.js discovers locale files next to your manifest, validates locale requirements, emits locale JSON assets, and watches them for updates.
| Capability | What it gives you |
|---|---|
| Locale discovery | Detect _locales/<locale>/messages.json from manifest location |
| Validation | Catch missing default locale files and unresolved __MSG_*__ keys |
| Build output mapping | Emit locale files in the expected extension output structure |
| Dev watch support | Reload on locale file changes during development |
default_locale in manifest.json should map to an existing _locales/<default>/messages.json.
manifest.jsonHere's how to declare locales in your manifest.json:
You would then include JSON files for each locale inside the _locales folder:
messages.json fileHere's an example of a messages.json file used for translations:
Locale JSON files are emitted under:
Extension.js validates:
default_locale presence when _locales is used_locales/<default>/messages.json__MSG_*__ references in manifest against default locale keysIf your manifest uses __MSG_extension_description__, ensure the default locale file contains extension_description:
If the key is missing in the default locale, build/validation diagnostics will surface the mismatch.
messages.json keys consistent across locales.manifestDir/_locales) for predictable resolution.