length-ratio
Translation much shorter or longer than the source.
Default severity: warning
What it checks
A translation far shorter or longer than its source is often truncated, left half-done, or a different message pasted in. The ratio uses characters without placeholders and tags; bounds default to 0.3–2.5 and the lower bound is halved for Chinese, Japanese, Korean, Thai and Indic scripts. Short sources (under 10 characters) are skipped.
Example
A translation more than 2.5 times the length of its source. Config used for both runs:
{
"sourceLocale": "en",
"files": [
{
"format": "next-intl-json",
"path": "messages/{locale}.json"
}
]
}Fails
messages/en.json
{
"retry": "Try again later"
}messages/fr.json
{
"retry": "Veuillez réessayer un peu plus tard, lorsque la connexion sera rétablie."
}Gate output
retrytranslation is 4.80× the source length (72 vs 15 characters; allowed 0.3–2.5)messages/fr.json:2
Passes
messages/en.json
{
"retry": "Try again later"
}messages/fr.json
{
"retry": "Réessayez plus tard"
}Gate output
No length-ratio finding.
Change its severity
{
"checks": {
"length-ratio": "error"
}
}Use "off" to disable it. To hide one finding, add "suppress": ["length-ratio:retry"]; a suppress rule that stops matching is reported so it can be removed.