Leading/following whitespace is stripped from translations, allowing entering duplicates
Circumstances
This was observed on the tok localization project for Mozilla Common Voice here.
Expected Behavior
Inputting a translation to Pontoon should compare the final string, with stripped leading and following whitespace, against existing translated strings and reject a duplicate.
Actual Behavior
It is possible to enter duplicate translations by inputting a string that contains leading or following whitespace.
Reproducing
- Enter a translation.
- Copy and paste the same translation into the suggestion box.
- Add whitespace to the beginning or end of the translation.
- Suggest the translation.
This will enter the same translation again, even though the translation is identical after stripping the spare whitespace.
Update: this only seems to apply when the input strings are multiline, such as if there are multiple substitution strings. I cannot replicate it for any particular string, only the case I gave.
This should no longer be possible, as Fluent translations are now normalised before storing or comparing them. The translations in the given example are about two years old, before the current behaviour was implemented.