I was wondering if someone could document the R.plurals localization
construct. From what I can gather it works similar to other resources
however a bit different,

<string name="some_string">Only %1$d more things left</string>
...
looked up as:
int quantity = 4;
context.getString(R.string.some_string, quantity);

To do a correct localized entry, it would become:

<plurals name="some_string">
<item quantity="one">Only 1 more thing left</item>
<item quantity="two">Only a couple more things left</item>
<item quantity="zero">Congrats you have nothing left</item>
<item quantity="other">Only %1$d more things left</item>
<item quantity="few">Apparently there are only a few things left</
item> <!-- Stumped as to the means of few-->
<item quantity="many">Apparently there are many things left</item><!--
Stumped as to what qualifies as MANY? -->
</plurals>

and looked up as:
int quantity = 4;
context.getResources().getQuantityString(R.plurals.some_string,
quantity, quantity);

The Many and Few don't seem to have clear implementations. Could you
elaborate on this construct?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to