Skip to main content

MatchingTranslations

Identifies missing or additional translations in locale files.


The following examples contain code snippets that either fail or pass this check.

The following locale files aren't consistent:

en.default.json

{
"greeting": "Hello, world",
"goodbye": "Bye, world"
}

es.json is missing greeting and goodbye translations:

es.json

{
}

fr.json is missing greeting and has a goodby tag that isn't present in the default locale:

fr.json

{
"goodby": "Au revoir, monde"
}

The following locale files are consistent:

en.default.json

{
"greeting": "Hello, world",
"goodbye": "Bye, world",
"pluralized_greeting": {
"one": "Hello, you",
"other": "Hello, y'all",
}
}

fr.json

{
"greeting": "Bonjour, monde",
"goodbye": "Au revoir, monde",
"pluralized_greeting": {
"zero": "Je suis seul :(",
"few": "Salut, groupe!"
}
}

Theme Check can correct this error using the --auto-correct flag. When the flag is specified, Theme Check automatically adds missing translation keys and removes extra translation keys for all non-default locales.


The following example contains the default configuration for this check:

MatchingTranslations:
enabled: true
severity: error
ParameterDescription
enabledWhether the check is enabled.
severityThe severity of the check.

Anchor to Disabling this checkDisabling this check

Disabling this check isn't recommended because it might result in an inconsistent translation experience for some users.


Was this page helpful?