Closed veelo closed 2 years ago
Firstly, the format string is not actually invalid, it just means that an argument will be ignored.
Ignoring information in the translation that the programmer intends to be included is, by definition and self-evidently, invalid. It breaks the software being translated!
This is not Poedit's behavior, but GNU gettext's, so I can't change it in Poedit. Furthermore, the behavior is correct and identifies a serious bug in the translation.
As you see in the screenshot, the argument is being ignored by the programmer as well.
My program works as intended with the MO file that is currently produced by Poedit. All is good, except the error message.
Again:
This is not Poedit's behavior, but GNU gettext's, so I can't change it in Poedit
Again, GNU gettext's msgfmt
works excellently with this:
#: source/app.d:19(main.report)
#, c-format
msgid "On %2$s I eat %3$s and walk for one hour."
msgid_plural "On %2$s I eat %3$s and walk for %1$d hours."
This produces a valid C format string, as in: it works for printf
.
Everything works as intended, except that Poedit flags an error which should at most be a warning.
This is a validation error from msgfmt -c
. If you think msgfmt -c
shouldn't report an error in this case, fix it upstream.
Poedit will not ignore msgfmt -c
validation errors.
First off, great project!
Problem
Currently a hard "invalid C format string" error is flagged when format specifiers have a position argument and the positions are not continuous, meaning that a format argument is omitted:
Firstly, the format string is not actually invalid, it just means that an argument will be ignored. Consider this valid source code:
Secondly, this may very well be intentional when the counter in the singular case has been replaced with a word, as is the case here.
possible solution
If the same argument is being ignored in the source text as well, no error or warning should be flagged.
If the argument is only ignored in the translation then it could still be intentional, but a warning is probably helpful in case it wasn't.