.js, .jsx, .mjs, .cjs, .ts, .tsx, .mts, .cts.
Source file
Save this example aslocales/en-US/messages.ts.
Configure your files
Use thisi18n.yml for the example, or add its file mapping to your existing bucket.
See path templates for other layouts.
Translate
Install the CLI and setOPENAI_API_KEY in your
project’s .env.local or shell. You can also configure another
AI provider.
Behavior and limitations
-
Supports static locale objects exported with
export default,export const, ormodule.exports, including a static variable followed by a default export. -
Nested objects and string arrays are supported. Strict FormatJS message objects can include
defaultMessageanddescription. - Imports, comments, export syntax, and unrelated module text are preserved. Only message string literals are replaced.
- Dynamic values, computed keys, spreads, multiple exported locale objects, and interpolated template literals are rejected. These are locale modules, not arbitrary application source files.
Next steps
- Check translations before committing generated files.
- Local translation workflow explains repeat runs.
- Browse all file formats.

