Generic file /values/strings.xml
, will be used when locale does not match with one's present in your app. To create locales see these examples.
Please note that you have to create folders for each locale like value-de
for German language, then create strings.xml
file inside.
Generic strings.xml
file:
app/src/main/res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">Spin The Bottle</string>
<string name="text_hint">Tap on screen to spin the bottle</string>
</resources>
For Arabic language:
app/src/main/res/values-ar/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="text_hint">اضغط على الشاشة لتدور الزجاجة</string>
</resources>
For German language:
app/src/main/res/values-de/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="text_hint">Tippen Sie auf den Bildschirm, um die Flasche zu drehen</string>
Remarks
- It is not necessary to translate each and every
<string>
inside strings.xml
.
- Notice I have placed
translatable="false"
on app_name
as I wanted my app name to show the same for all locales.
- Also
app_name
is not included in any other locale except generic values
folder.