What is the difference between country and region translation in android translations editor

Viewed 272

I am currently translating my android app via the embedded translations editor of android studio. Within the locale menu, I could either choose a general language or a language/dialect connected to a specific country. For instance German (de) or German (de) in Austria (at) or German (de) in Belgium (Be) etc.. In case I would like to reach users in all Spanish speaking countries, is it enough to add just a general Spanish locale in my values-es folder or should I create a Spanish locale for each hispanophone country? The second option would not make sense to me, especially since the app is not that complex, that it has to support dialects or varieties.

1 Answers

In the Project, at the left side, select option Project Files, so one can see the directory structure of the current project.

Under the res directory, there is a folder values... for each desired language and country combination, and within each one there is a strings.xml file created. That files should contain all the words translated in the related language.

The simplest way is to initially create a general file with the Spanish language (es): it would be the values-es folder (created by right clicking mouse on the res directory, option, then new, Android Resource Directory and selecting the Spanish language.

After one should create a new empty strings.xml file, created under this new folder (value-es) Right mouse click in the new folder, select option new, Values Resource File, named it strings.xml.

This file will contain all the words in your app, under the common general structure, that should be in each strings.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <-!--strings-->
</resources>

However, there are some cases that will be exceptions and you will need to create more specific files. Let's assume the one needs the app for Chile. So it to be created a new folder. Also use new, Android Resource Director, and choose Spanish and Chile. The new folder will be called values-es-rCL. Under this folder, one needs to create other empty Strings.xml with the above initial content.

This file will be almost empty

Howeever there are exceptions: savories is tapa in Spain, but in Chile is picoteos.

If default language is English put:

Under values folder in strings.xml: savories

Under values-es folder in strings.xml: tapas

Under values-es-rCL folder in strings.xml: picoteos

So where appear savories, the app searchs in specific country (values-es-rCL), if it didn't find, it search in language (values-es),if it also didn't find, it search in default language (values)

For a normal word, like tap, it just necessary put the word grifo in spanish language, with no worry about chilean strings.xml

if someone needs to be compatible with Mexico, then it will be necessary to create strings.xml and the folder values-mx-rMX for this "dialect". local translatio for 'savories' is the word botanas

Related