Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android supporting different languages.

Tags:

android

I have one android application supporting diff languages.
I have different versions of string for every language like.

values-aa, values-bb and values-cc etc.

But my application is not displaying strings in diff languages. I have done all the necessary thing for multiple language support but still some times app does not display text in diff. languages.

What can be the cause?

like image 424
User7723337 Avatar asked Jan 28 '26 12:01

User7723337


1 Answers

Take a look here; as stated:

Create Locale Directories and String Files

To add support for more languages, create additional values directories inside res/ that include a hyphen and the ISO country code at the end of the directory name. For example, values-es/ is the directory containing simple resourcess for the Locales with the language code "es". Android loads the appropriate resources according to the locale settings of the device at run time.

Once you’ve decided on the languages you will support, create the resource subdirectories and string resource files. For example:

MyProject/ res/ values/ strings.xml values-es/ strings.xml values-fr/ strings.xml

Add the string values for each locale into the appropriate file.

At runtime, the Android system uses the appropriate set of string resources based on the locale currently set for the user's device.

For example, the following are some different string resource files for different languages.

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

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="title">My Application</string>
    <string name="hello_world">Hello World!</string>
</resources>

Spanish, /values-es/strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="title">Mi Aplicación</string>
    <string name="hello_world">Hola Mundo!</string>
</resources>

French, /values-fr/strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="title">Mon Application</string>
    <string name="hello_world">Bonjour le monde !</string>
</resources>

Note: You can use the locale qualifier (or any configuration qualifer) on any resource type, such as if you want to provide localized versions of your bitmap drawable. For more information, see Localization.

I guess that at first glimpse you have to change the folder names.

like image 136
g00dy Avatar answered Feb 02 '26 08:02

g00dy