Issue
When I use quantity string resources in Android, it's easy for English and works as expected:
String output = getResources().getQuantityString(R.plurals.my_resource, i, i);
For 1
, this returns the string defined in the quantity one
, for 2
to 70
, it returns the quantity string other
, for example.
But when I use the same code with Russian Locale
set, the output is different:
It uses the quantity string one
not only for input 1
, but also for inputs 21
, 31
, 41
, 51
- for all numbers that end with "1". Why? Is that intended (even correct) behaviour? I can just say that, to me, this looks very strange. Well, when I let google translate the strings 30 dogs
, 31 dogs
and 32 dogs
- the output for the noun is always the same.
I've seen similar behaviour for Lithuanian language, by the way.
Solution
Is that intended (even correct) behaviour?
I don't speak Russian, but a quick search suggests this is correct:
Counting
When denoting how many of something you have, we usually place the object in question in the genitive case. However, Russian has some key differences to English:
- If there is 1, 21, 31, 41, etc, of something, they go in the nominative singular.
- If there is 2, 3, 4, 22, 23, 24, 32, 33, 34, etc, of something, use the genitive singular.
- If there is 5 to 19, 25 to 29, 35 to 39, etc, or something, use the genitive plural.
Answered By - Sam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.