Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of using translatable in Android strings?

Tags:

What does the translatable attribute, like translatable="false", mean?

like image 793
Yousuf Avatar asked Oct 13 '10 15:10

Yousuf


People also ask

What is translatable in Android?

The Translations Editor provides a consolidated and editable view of all of your default and translated string resources. For an introduction to translating your app for different languages, read Supporting different languages and cultures.

What is a translatable string?

Translation strings in a resource are identified by two elements: the key and the context. The key is the actual identifier for a translation. Each file format has its own way to specify keys. For instance, for PO files the key is the msgid attribute for each entry.

What is the use of string xml file in Android?

String. xml file contains all the strings which will be used frequently in Android project. String. xml file present in the values folder which is sub folder of res folder in project structure.In Android Studio, we have many Views such as TextView,Button,EditText,CheckBox,RadioButton etc.


2 Answers

This attribute points out that this attribute will be the same for all locales. Why is it useful?

  1. The localization files are more readable for human and saves time.
  2. It tells the Lint tool that everything is fine and that Android does not need to look for this resource translation.

Full explanation: http://tools.android.com/recent/non-translatablestrings

So, generally, this means if don't put this attribute, you should always localize this resource, otherwise tell people and compiler that this is unique for all locales by specifying this attribute.

like image 86
Taras Leskiv Avatar answered Oct 15 '22 02:10

Taras Leskiv


If you are supporting multiple languages, and there are some strings which should not be translated (that means same across all languages) then you can use translatable="false"

For ex: Numbers<string name="account_setup_imap" translatable="false">IMAP</string>

Detailed Description

like image 35
Vins Avatar answered Oct 15 '22 02:10

Vins