Hi, I happen to be i18nspector upstream.
* BenWiederhake.GitHub <benwiederhake.git...@gmx.de>, 2016-01-02, 20:31:
- i18nspector and Transifex (the service we use for our translation)
heavily disagree about how a po-file should look like,
Care to elaborate on how they "heavily disagree"?
and how Russion plurals work(?!).
The Russian PO file reads:
Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ?
1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);
Even though I don't speak Russian, I can tell that this Plural-Forms
can't possibly be correct. Here 4 plural forms are declared, but the
expression never evaluates to 3.
I'm too lazy to make a mathematical proof that this the case, so instead
I wrote a small program that demonstrates it. Please see the attachment.
Let me know if the program ever stops. :-P
Now, it would be cool if i18nspector explained better what is wrong
here. That is, instead of
E: ru_RU.po: incorrect-plural-forms 'nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9)
|| (n%100>=11 && n%100<=14)? 2 : 3);' => 'nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;' or 'nplurals=4;
plural=n==1 ? 3 : n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;'
which is likely to make your eyes bleed, said something like this:
E: ru_RU.po: codomain-error-in-plural-forms f(x) != 3
I hope to implement this in the future.
- include-what-you-use Is completely useless: It doesn't recognize <stddef.h>,
This is bug #722132, which is super-annoying (and I would consider it RC
if I were the maintainer), but IME you can often just ignore iwyu's
moaning about missing standard headers.
- The following check complains loudly about plurals:
"find -type f \( -iname '*.po' -o -iname '*.pot' \) -exec msgfmt
--check --check-compatibility --check-accelerators
--output-file=/dev/null {} \;"
Using --check-compatibility is probably a bad idea. It will complain
about things that almost everyone wants, like the header entry or plural
forms.
--
Jakub Wilk
#include <stdio.h>
unsigned long f(unsigned long n)
{
return n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3;
}
int main(int argc, char **argv)
{
unsigned long i;
for (i = 0; ; i++) {
printf("f(%lu) = %lu\n", i, f(i));
if (f(i) == 3)
break;
}
}