Skip to content

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.

A scope has a dependency on next-intl, react-i18next, i18next, react-intl, or @lingui/core.

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.

Correct the message, or add the missing key to the locale.

When the base locale defines welcome and another lacks it, the check reports the missing key. Add the translation with the same placeholders.

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.
gspot ignore translations/messages --paths "<path>" --reason "<why>"
gspot ignore translations/messages --rule message --reason "<why>"
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 Files Why
import-x/no-default-export **/i18n/request.{js,ts} next-intl reads the default export of its request configuration file.
Rule file Installed when
.gspot/rules/NEXT-INTL.md The repository has a dependency on next-intl.
.gspot/rules/TRANSLATIONS.md Always
Tool Version
eslint-plugin-i18next 6.1.5