shipglot

plural-forms

Plural categories missing or wrong for the target locale.

Default severity: error

What it checks

Each language needs its own set of plural forms: Japanese has one, English two, Russian four (one, few, many, other), Arabic six. A missing category makes the app fall back to `other`, which is ungrammatical ("1 файлов"). Categories come from CLDR through Intl.PluralRules; gettext files follow their Plural-Forms header, Laravel its MessageSelector rules. Extra categories are warnings.

Example

Polish needs one, few, many and other. Config used for both runs:

{
  "sourceLocale": "en",
  "files": [
    {
      "format": "next-intl-json",
      "path": "messages/{locale}.json"
    }
  ]
}

Fails

messages/en.json

{
  "files": "{count, plural, one {# file} other {# files}}"
}

messages/pl.json

{
  "files": "{count, plural, one {# plik} other {# plików}}"
}

Gate output

  • files
    plural {count} is missing categories few, many required by pl
    messages/pl.json:2

Passes

messages/en.json

{
  "files": "{count, plural, one {# file} other {# files}}"
}

messages/pl.json

{
  "files": "{count, plural, one {# plik} few {# pliki} many {# plików} other {# pliku}}"
}

Gate output

No plural-forms finding.

Change its severity

{
  "checks": {
    "plural-forms": "warning"
  }
}

Use "off" to disable it. To hide one finding, add "suppress": ["plural-forms:files"]; a suppress rule that stops matching is reported so it can be removed.

All checks