max-length
Translation longer than the declared maximum.
Default severity: error
What it checks
Some strings have a hard length limit (buttons, tabs, app store fields, SMS). The limit comes from the file (XLIFF maxwidth, xcstrings, Android tools:maxLength-style metadata) or from `maxLength` globs in the config. Length is counted in characters as displayed, with tags removed and placeholders counted as written.
Example
Navigation labels limited to 12 characters with a maxLength glob in the config. Config used for both runs:
{
"sourceLocale": "en",
"files": [
{
"format": "next-intl-json",
"path": "messages/{locale}.json"
}
],
"maxLength": {
"nav.*": 12
}
}Fails
messages/en.json
{
"nav": {
"settings": "Settings"
}
}messages/fr.json
{
"nav": {
"settings": "Paramètres du compte"
}
}Gate output
nav.settings20 characters, maximum is 12messages/fr.json:3
Passes
messages/en.json
{
"nav": {
"settings": "Settings"
}
}messages/fr.json
{
"nav": {
"settings": "Paramètres"
}
}Gate output
No max-length finding.
Change its severity
{
"checks": {
"max-length": "warning"
}
}Use "off" to disable it. To hide one finding, add "suppress": ["max-length:nav.settings"]; a suppress rule that stops matching is reported so it can be removed.