4 ms·
> Almost no software handles this correctly Gettext solved it 20 years ago. The problem is that people try to reinvent the wheel instead of looking at existing
by babuskov 8y ago
> Almost no software handles this correctly
Gettext solved it 20 years ago. The problem is that people try to reinvent the wheel instead of looking at existing solutions. So, they make their own inferior versions.
The rule for plural has 3 cases.
1. When n mod 10 = 1
2. When n mod 10 is 2,3,4
3. Everything else
And there's a special rule that the first 2 cases are not used when n mod 100 is between 11 and 29. For such numbers, the 3rd case is used instead.
This is actually not that complex. Compare to Arabic, where you have 9 cases IIRC.
- ajuc 8y agoDoesn't solve the problem with "X out of Y".
- babuskov 8y agoIt does. You have two numbers, so you have to split it into X and Y part. When I look at your example, 1 plik is always 1 plik regardless of the Y quantity and 100 always go with "ze" regardless of X quantity. It's a little bit tricky to set up, but it works. "Copied X of Y files" needs to split into two translation units: "Copied X" and "of Y files".
- ajuc 8y agoThat's "not supported" in my book. How should English or Chinese developer know to split this? What about translating to other languages with different splits? There's no system to handle this, so each special case must be embedded in the software itself, instead of properly doing it in internationalization package. So - in effect - nobody even tries.