As
@GameTheory mentioned, if you should not hardcoding your text which should be placed in res/values/string.xml . This is the origin string file.
You should create several language folders in res , for example , res/values-zh-rCN (for Chinese),res/values-de-rDE(for German),etc. A strings.xml file should be created in each of these folders .
Next, translate the text in the origin string file and put them in the strings.xml in the according language folder.
for example:
values/strings.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">hello</string>
<string name="bye">bye</string>
</resources>
and we should translate the string and place it in others language strings.xml
res/values-zh-rCN/strings.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">你好</string>
<string name="bye">再见</string>
</resources>
res/values-de-rDE/strings.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hallo</string>
<string name="bye">Auf Wiedersehen</string>
</resources>
you can translate as many languages as you like , just create the according files to support it .
you can switch the displaying language by the following code:
Code:
getAppContext().setLocaleSetting(Locale.ENGLISH); //switch to English
getAppContext().setLocaleSetting(Locale.SIMPLIFIED_CHINESE); //switch to Chinese