HelloCW
HelloCW

Reputation: 2255

The item in string-array can be directly localized in android?

I know I can use string resource to localize item in string-array, just like Method 1 do.

Is it OK to localize the item in string-array directly ? just like Method 2

Thanks!

--------------------------Method 1-----------------------------------------

   <string-array name="Box">
        <item>@string/Inbox</item>
        <item>@string/Sent</item>
        <item>@string/Outbox</item>
        <item>@string/Draft</item>
    </string-array>


    <string name="Inbox">Inbox</string>
    <string name="Sent">Sent</string>
    <string name="Outbox">Outbox</string>
    <string name="Draft">Draft</string>


    <string name="Inbox">收件</string>
    <string name="Sent">发件</string>
    <string name="Outbox">已发</string>
    <string name="Draft">草稿</string>

-----------------------------Method 2-----------------------------------------

   <string-array name="Box">
        <item>Inbox</item>
        <item>Sent</item>
        <item>Outbox</item>
        <item>Draft</item>
    </string-array>

   <string-array name="Box">
        <item>收件</item>
        <item>发件</item>
        <item>已发</item>
        <item>草稿</item>
    </string-array>

Upvotes: 0

Views: 279

Answers (1)

Mohammad Rahchamani
Mohammad Rahchamani

Reputation: 5220

yes you can use Method2.

you just have to create localized resource folder.

here is a complete reference.

Upvotes: 1

Related Questions