3 ms·
All Slavic languages are quite quirky in this regard. Most native speakers don't realize it, but when you try to write correct message parametrized with numbers
by ajuc 8y ago
All Slavic languages are quite quirky in this regard. Most native speakers don't realize it, but when you try to write correct message parametrized with numbers in Polish, you need 3 or 4 special cases:
- 1
- 2-4, 22-24, 32-34, ...
- 5-21, 25-31, 35-41, ...
If you say "out of X" you also need to handle numbers 100-199, 100 000-199 000, 100 000 000-199 000 000, ... separately (because 100 = sto, and if number begins with "s" - "out of X" is "ze" instead if "z") - this is in combination with previous 3 cases, so "199 ouf of 199" is different from "99 out of 99", and different from "122 out of 122".
So "Copied X file(s) out of Y" would be:
- "Skopiowano 1 plik"
- "Skopiowano 2 pliki z 3"
- "Skopiowano 5 plików z 5"
- "Skopiowano 1 plik ze 100"
- "Skopiowano 2 pliki ze 100"
- "Skopiowano 5 plików ze 100".
Almost no software handles this correctly :) But spell checkers work OK (they just ignore relationships between words usually).
- miki123211 8y agoAlmost no software handles this correctly because almost no software gives us the tools to handle it correctly. I've translated some software to polish once or twice and they've been using a simple templating system, like message from {name}: {content}, {time} minutes ago. I didn't have access to the source code. As a consequence of that design, some messages were very malformed. Also there were some overused strings, like "liked" for "You've just liked this", "liked" for "things you've liked" and "liked" as in "someone liked your post". Also untranslatable.
- ajuc 8y agoQt framework has system in place for several plural forms, so plik/pliki/plików problem is solved, and quite elegantly. If the application programmer gives a damn, that is. There's also a way to add context to the strings for translation, so that you can see this "like" is used in this meaning, and that other "like" is used in another meaning. But there's no generic solution to "z/ze" problem as far as I know, you need to do it by hand if you want correct messages. And most of the time programmers don't even realize they need to parametrize such stuff, so the systems don't do any good :)
- dullgiulio 8y agoI imagine that before we have a technical solution that works well enough to be used, natural language (guided by the technological limits) will have dropped such rule in ordinary use.
- ajuc 8y agoUnlikely. The rule is dictated by ease of pronunciation. It's hard to say "z stu", much easier to say "ze stu". The rule isn't hard to implement, it's just not expected to be a thing by framework/library creators.
- 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.