Open claudep opened 10 years ago
I can confirm the issue. I have faced this problem trying to translate django into Russian. Russian has three forms, first form is used for any number that number%10 == 1 && number != 11, so I cannot just drop the placeholder %(count)s from the msgstr[0]. So, this is effectively blocking me from changing Russian translation of some strings that have no placeholder in msgid.
I also confirm the issue, happened with me while trying to translate django-two-factor-auth into arabic and had forcibly placed the expression although its not needed
I also have this issue. Example: In english: Rice will give +15% more food In french : Le riz permet d'obtenir + 15% de nourriture. = ERROR :( % d is not present in the translation.
@claudep Do you have any idea on how we can determinate which languages should or should not require it?
Looking at plural strings (http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html), I think it affects all languages where the equation preceding the ? 0
contains &&
or ||
.
Uhmm that's kind tough to rely on. I'm trying to find a good reference about the matter. I searched in the gettext docs but didn't have success. If you guys have any hint, let me know.
gettext does indeed apply some clever stuff when deciding if format checking between msgstr and msgid[0] must be strict or not (see check_msgid_msgstr_format_i
in format.c). If you fear entering this track, I'd then suggest to simply be more liberal when accepting a format string in msgid[0] if msgstr[0] doesn't have one (maybe check against msgstr[1]?).
@claudep that could be an option. We will need to investigate further. However I can tell it will require changes in the way our validators are implemented in general. Right now it just takes 1 source string and 1 translation string into account for every check.
years later... and I experience this issue too.
I can't add %d
to languages which have more than one singular, for example in ukranian:
The currently translation accepted by transifex is erroneus, it gives me this error with "msgfmt -c uk.po":
uk.po:2131: number of format specifications in 'msgid_plural' and
'msgstr[0]' does not match
msgfmt: found 1 fatal error
With %d in singular fixes the problem, it is impossible to do the job at transifex, it says error at website and there is no error.
Russian is also affected, and all the languages which have more than one singular.
Take this translation unit:
In languages where the first translation form in the plural definitions is not only for one element (e.g Lithuanian), gettext requires that the placeholder (
%(count)s
here) is also in the msgstr[0] content. Unfortunately in Transifex, doing so raises an unvalid error (Error:The expression '%(count)s' is not present in the original phrase.
).