Antoine Murion
Antoine Murion

Reputation: 813

Android: "String Array" in Different Languages, put in "Assets" or "strings.xml"?

I want to know the best location for me to put the following string resources. I want to create a location filter box which users would select the location based on "District", "Subway Station","landmark",etc in at least 2-3 languages.

In the mean time, i achieve this feature by using "Sring-array" in "strings.xml" in my project, which should allow me to handle multi-languages.

<string-array name="HK_Districts">
  <item >Tsim Sha Tsui</item>  
  <item >Causeway Bay</item> 
   ....
</string-array> 

This method should work in a single city but if i want to make expansion into other cities, i just think this will create over 10'000 lines in "strings.xml " and this seems to be very complicated for data management.

I am new to Android and want to know if there are better alternatives to work it out, like using the "assets" folder, etc.

enter image description here

Upvotes: 5

Views: 3194

Answers (1)

Ren&#233; Cadenas
Ren&#233; Cadenas

Reputation: 51

just put your file in /values-{language}/arrays.xml

if folder doesn't exists, you should create it.

example: /values-es/arrays.xml

Upvotes: 5

Related Questions