Language and Translate

Estimated reading: 4 minutes 287 views

App 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 let’s start.

English strings (default locale), /values/strings.xml:

Spanish strings (es locale), /values-es/strings.xml:

By default, the folder Values > String.xml contains all the English words in the app.
Language

Generally, android considers English as a default language and it loads the string resources from /res/values/strings.xml. In case, if we want to add 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 Japanese Language.

The value-ar or value-ru has a String.xml file that contains the same labels but is translated to Turkish or Russian or Arabic and etc.

If you want to add your own new language, Create a new value-** folder under the Resources folder
then copy the main English string file string.xml and paste 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 let’s 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 extend 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 the 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 the values-(ISO language code) folder of the project. For example, if 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 the supported language (strings.xml) file, then android will load the missing strings from the default strings.xml file i.e. values/strings.xml.

 

Force your App to use a default language?
From your AppSettings.cs class, you can set your own default language which the app will open the first time. Also, you can force the RTL system by the variable FlowDirectionRightToLeft to True.
 
You can find what is name ISO Language Code from here
Notes
  • If the text is marked Please replace with the symbol ' and add at the beginning and end of the sentence
    Example: Lets get started! >> Let's get started!
         
  • If the text is marked & Please replace it with the symbol &
    Example: Movies & Animation >> Movies & Animation
Note

From your AppSettings.cs class, you can set the user language on the site as language on your phone by the variable SetLangUser to True.

Leave a Comment