medic / translation-checker

Check translations from .properties files with Mustache placeholders markup or messageformat syntax.
https://www.npmjs.com/package/@medic/translation-checker
GNU Affero General Public License v3.0
2 stars 0 forks source link

Add validation for messageformat interpolation #11

Open garethbowen opened 2 months ago

garethbowen commented 2 months ago

If a translation value changes the variable name then the translation doesn't work. Add a validation check to ensure that the variable name in each translation file matches the reference (English) translation.

Steps to reproduce:

  1. Have an English file with line: test = {DAYS, plural, one{1 day left} other{\# days left}}
  2. Have a French file with line: test = {JOURS, plural, one{1 jour restant} other{\# jours restants}}

Expected: Validation failure Actual: No warnings

If this is missed you end up with issues like: https://github.com/medic/cht-core/issues/9384

garethbowen commented 2 months ago

@1yuv Is this something you'd be willing to pick up?

1yuv commented 2 months ago

Hi @garethbowen , If I read the document correctly, I think this is already supported

garethbowen commented 2 months ago

@1yuv In that example, I think it checks the "uno" but not the "MONTHS". This would be an expansion of that. I'm confident it's not already working because if it was then the French issue you found would have been picked up in the linting stage.

1yuv commented 2 months ago

I see that, I thought we were being lenient with use of this tool. I unfortunately don't have a bandwidth to take this immediately. I will pick this in October if it's not worked on.