Change Lang & Words and Translate
Our Team made it for you easy to translate your own words in your app and change the labels as you want, our android app support 200 languages to be added, so lets start.
English strings (default locale), /values/strings.xml:
<resources>
<string name="hello_world">Hello World!</string>
</resources>
Spanish strings (es locale), /values-es/strings.xml:<br>
<resources>
<string name="hello_world">¡Hola Mundo!</string>
</resources>
By default the folder Values >> String.xml contains all the English words in the app.
Generally, android consider English is a default language and it loads the string resources from /res/values/strings.xml. In case, if we want to add a support for other languages, we need to create a values folder by appending the Hyphen and ISO language code.
For example, if we want to add support for Japanese, then we need to create a values folder named values-ja under the res folder and add a strings.xml file in it with all the strings that need to translate into the Japanese Language.
The value-ar or value-ru has a String.xml file which contains same labels but translated to Turkish or Russian or Arabic and etc..
If you want to add your own new language, Create a new value-** folder under Resources folder
then copy the main English string file string.xml and pasta it inside the new value-** folder then you can translate your strings as you like
The folder name of Android string files is formatted as the following:
- without region variant: values-[locale]
- with region variant: values-[locale]-r[region]
- For example: values-en, values-en-rGB, values-el-rGR.
EX: In your case where you want to add greek lets say, you will just need to create a folder values-el for the Greek translation, and values-el-rGR for the country-specific Greek translation if you like to extended the lang more.
For example, suppose you have a string called “R.string.title” and the locale is ‘el-GR’, Android will look for a value of “R.string.title” by searching the files in the following order:
- res/values-el-rGR/strings.xml
- res/values-el/strings.xml
- res/values/strings.xml
Once we create required files and change the device language through Settings > Language & Input >Select Language (Japanese), android OS will check for the appropriate language resources available in the app.
In case, if the app supports a selected language, then android will look for the string resources in values-(ISO language code) folder of the project. For example, the selected language is Japanese, then it will load the string values from a values-ja/strings.xml file.
If any string value missing from supported language (strings.xml) file, then android will load the missing strings from default strings.xml file i.e. values/strings.xml.
Force your App to use a default language?
From your settings class you can set your own default language which the app will open first time
Also you can force the RTL system by setting the variable FlowDirection_RightToLeft to True
//Language Settings >>
public static bool FlowDirection_RightToLeft = false;
public static string Lang = "ar"; //Default language