Android XML

Format is automatically detected based on the file extension, so there’s no need to specify the format type when using it. ✨

Dashes (-) are automatically converted to underscores (_) for unique keys embedded within the name attribute to comply with Android syntax.

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