XML (Android)

Translations with plurals

res/values/strings.xml
<resources>
    <string name="greeting">Hello, %1$s!</string>
    <plurals name="items_in_cart">
        <item quantity="one">You have %d item in your cart</item>
        <item quantity="other">You have %d items in your cart</item>
    </plurals>
</resources>
res/values-es/strings.xml
<resources>
    <string name="greeting">Hola, %1$s!</string>
    <plurals name="items_in_cart">
        <item quantity="one">Tienes %d artículo en tu carrito</item>
        <item quantity="other">Tienes %d artículos en tu carrito</item>
    </plurals>
</resources>
res/values-de/strings.xml
<resources>
    <string name="greeting">Hallo, %1$s!</string>
    <plurals name="items_in_cart">
        <item quantity="one">Sie haben %d Artikel in Ihrem Warenkorb</item>
        <item quantity="other">Sie haben %d Artikel in Ihrem Warenkorb</item>
    </plurals>
</resources>
res/values-ja/strings.xml
<resources>
    <string name="greeting">こんにちは、%1$sさん!</string>
    <plurals name="items_in_cart">
        <item quantity="one">カートには%dアイテムがあります</item>
        <item quantity="other">カートには%dアイテムがあります</item>
    </plurals>
</resources>

Last updated