placeholders
Error · The translation does not keep the placeholders of the source.
git8n check fails on this rule.
Why it matters
The application fills each placeholder with a value. A translation that loses one hides the value, and a translation that adds one shows the raw placeholder.
Invalid
locales/en/common.json
json
{
"greeting": "Hello {{name}}"
}locales/fr/common.json
json
{
"greeting": "Bonjour"
}text
$ git8n check --source en
locales/fr/common.json
error common:greeting: lost {{name}}. placeholders
Read more:
placeholders https://git8n.sakuga.dev/docs/reference/rules/placeholders.html
1 error, 0 warnings in 2 files (en → fr, 1 key).Valid
locales/en/common.json
json
{
"greeting": "Hello {{name}}"
}locales/fr/common.json
json
{
"greeting": "Bonjour {{name}}"
}text
$ git8n check --source en
0 errors, 0 warnings in 2 files (en → fr, 1 key).What to do
Keep every placeholder of the source in the translation: {{name}}, {name}, {0}, $t(…), a tag such as <0> or <br/>, %s, and with --syntax vue-i18n a linked message @:key. The branches of an ICU plural are text: translate them. The modifier of a linked message, @.lower:key, can change.