X18N2004: Locale file is not static

Locale file is not static. Use JSON or YAML, or opt in to execution with `execute: true` on the resource pattern.

Message

[X18N2004] Locale file is not static <detail>
├▶ fix: Use JSON or YAML, or opt in to execution with `execute: true` on the resource pattern.
╰▶ see: https://x18n.antfu.dev/errors/x18n2004

The CLI prints the code and why the error happened, with details such as a file name or a field. The fix and a link to this page follow. With --json, the same parts are in errors of the envelope.

What to do

x18n reads JS and TS locale files as text and does not run them. A file that computes its messages cannot be read that way.

  1. Move the messages to a JSON or YAML file.
  2. Or set execute: true on the resource pattern. x18n then runs the file in Node, and the messages become read-only.

Exit code

The CLI exits with code 1.

Source