translations
Translated interfaces: next-intl message files that parse and hold every key of the base locale. Level all adds no literal text in components. It requires javascript.
Selected when
Section titled “Selected when”A scope has a dependency on next-intl, react-i18next, i18next, react-intl, or @lingui/core.
Checks
Section titled “Checks”messages
Section titled “messages”Checks the next-intl JSON/ICU files under translations.messages_folder: each message parses, none stays empty, and each locale holds all keys of the base, and holds no key the base lacks.
Runs at the push stage, once per scope. It skips until you set translations.messages_folder.
next-intl loads one locale at a time, so only a comparison with the base finds a missing key.
What to do
Section titled “What to do”Correct the message, or add the missing key to the locale.
Example
Section titled “Example”When the base locale defines welcome and another lacks it, the check reports the missing key. Add the translation with the same placeholders.
Lint rules
Section titled “Lint rules”| Rule | What it checks | What to do |
|---|---|---|
message |
Each message parses as an ICU message. | Fix the message syntax, such as an unclosed brace. |
missing-key |
Each locale has a message for each key of the base locale. | Translate the message into this locale. |
extra-key |
Each key of a locale exists in the base locale. | Remove the key from this locale, or add the source text to the base locale. |
message-arguments |
A translated message uses the arguments and choice forms of its base message. | Use the argument names and choice forms of the base message. |
base-locale |
The file of the base locale, such as en.json, exists beside the other locale files. |
Restore the base locale file, or set translations.base_locale to the locale that the project writes first. |
syntax |
A file that the check reads parses without errors. | Fix the syntax at the reported line. |
Turn it off
Section titled “Turn it off”gspot ignore translations/messages --paths "<path>" --reason "<why>"gspot ignore translations/messages --rule message --reason "<why>"Settings
Section titled “Settings”| Setting | What it sets |
|---|---|
translations.base_locale |
The locale whose message keys every other locale must contain. |
translations.messages_folder |
The folder of the <locale>.json message files. |
Lint rules turned off
Section titled “Lint rules turned off”| Lint rules | Files | Why |
|---|---|---|
import-x/no-default-export |
**/i18n/request.{js,ts} |
next-intl reads the default export of its request configuration file. |
Rules for coding agents
Section titled “Rules for coding agents”| Rule file | Installed when |
|---|---|
.gspot/rules/NEXT-INTL.md |
The repository has a dependency on next-intl. |
.gspot/rules/TRANSLATIONS.md |
Always |
Tools and versions
Section titled “Tools and versions”| Tool | Version |
|---|---|
| eslint-plugin-i18next | 6.1.5 |