androidstringlanguage-translation

How to translate string-array using the Android Studio Translations Editor


In my strings.xml I have several string-arrays. I would like to translate them in the same way as I have translated other strings - using the Translations Editor in Android Studio. However, I cannot see the string-arrays in the Translations Editor. Is there any way how can I use the Translations Editor for the string-array as well as for strings? What is the best practise for translating string-arrays?


Solution

  • Let the array to use the string in strings.xml like following:

    In arrays.xml:

    <string-array name="countries">
        <item>@string/contry_option_0</item>
        <item>@string/contry_option_1</item>
    </string-array>
    

    In strings.xml:

    <string name="country_option_0">Japan</string>
    <string name="country_option_1">Thailand</string>
    

    After doing that, you can see the key contry_option_0 and contry_option_1 in Translations Editor.