From: Tomas K. <to...@us...> - 2006-12-09 11:01:19
|
> 2006/12/5, Tomas Kuliavas <to...@us...>: >> >> Hi, >> >> Gettext plurals manual shows that Lithuanian should use >> >> Plural-Forms: nplurals=3; \ >> plural=n%10==1 && n%100!=11 ? 0 : \ >> n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2; >> >> msgfmt -c (gettext v.0.15) recommends 'Plural-Forms: nplurals=3; >> plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? >> 1 >> : 2);\n' >> >> I've used PHP gettext extension for testing and it does not work >> correctly >> with negative numbers. How can I modify evaluation in order to make sure >> that absolute n value is evaluated? > > > Hi, > the point you raise makes me wonder, do some languages have different > plural forms for negative numbers? > Despite of the fact that negative numbers probably call for a different > string altogether in most contexts. "You gave me 5 bucks." vs. "I owe you > 5 bucks." degrees (Celsius or Fahrenheit) and not bucks --- test.sh --- for i in -101 -21 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 21 101; do echo -n "$i " ngettext -d test "degree" "degrees" $i echo "" done ---- ---- test.po ... "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n" msgid "degree" msgid_plural "degrees" msgstr[0] "laipsnis (singular form)" msgstr[1] "laipsniai (first form)" msgstr[2] "laipsniu (second form)" ---- ---- script output -101 laipsniai (first form) <- wrong, should be '-101 laipsnis' -21 laipsniai (first form) <- wrong, should be '-21 laipsnis' -11 laipsniai (first form) <- wrong, should be '-11 laipsniu' -10 laipsniai (first form) <- wrong, should be '-10 laipsniu' -9 laipsniai (first form) -8 laipsniai (first form) -7 laipsniai (first form) -6 laipsniu (second form) <- wrong, should be '-6 laipsniai' -5 laipsnis (singular form) <- wrong, should be '-5 laipsniai' -4 laipsniai (first form) -3 laipsniai (first form) -2 laipsniai (first form) -1 laipsniai (first form) <- wrong, should be '-1 laipsnis' 0 laipsniu (second form) 1 laipsnis (singular form) 2 laipsniai (first form) 3 laipsniai (first form) 4 laipsniai (first form) 5 laipsniai (first form) 6 laipsniai (first form) 7 laipsniai (first form) 8 laipsniai (first form) 9 laipsniai (first form) 10 laipsniu (second form) 11 laipsniu (second form) 21 laipsnis (singular form) 101 laipsnis (singular form) ---- |