-1

I created an Android app that is provided in several countries (no surprise so far ;-)). But I want to use the resource file, that contains German strings in Germany, Swiss and Austria. Do have to copy the file two times or is there better way how to handle this?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • Simply **don't** use the region code. Use only the language code. I.e.: use `values-de` instead of `values-de-rDE`. One string file will work for Switzerland, Austria, Lichtenstein and - of course - Germany. – Phantômaxx Aug 31 '19 at 09:16
  • Ah okay, thank you! This is the answer I was looking for! Question marked as soled – Gerrit Humberg Sep 01 '19 at 06:38
  • I don't know why this question was down rated to -1... I guess there will be other guys who are interested in this solution. – Gerrit Humberg Sep 01 '19 at 06:48
  • I don't know why you didn't do your homework... Just google for "android localization" and you'd avoid asking this question has been asked for the nth time on this site. – Phantômaxx Sep 01 '19 at 15:48

2 Answers2

0

You put language specific files(string, images, styles, etc) to language specific values folder. For instance for German, create a folder named values-de, can also use country specific codes too. values-pt for Portuguese, and values-pt-rBR for Brazilian.

You can find the codes for languages or use Translation Editor of Android Studio which creates folders for you. Another thing with Translation Editor it helps you to filter for text and has some other extra cool features.

Thracian
  • 43,021
  • 16
  • 133
  • 222
0

You can use the translation editor (open your "string.xml" and click on "Open editor" at the top right corner). It will manage the other files for you.

Zelig63
  • 1,592
  • 1
  • 23
  • 40