To support internationalization, Android has "resource" files called resource
in XML, containing the texts to be displayed in the application. By default, the /res/values/strings.xml
file has the texts of an Android application.
Example:
<string name="str_titulo">Nome</string>
Each string
within the XML is compiled and associated with id
as shown in the String Resources . These ids
are placed in a resource files, R
, as public static final
variables. It is possible to assign any chave
to each string , however this key is created warmly without definitive standardization, for example:
-
str_titulo_nome
: name -
str_actionbar_titulo_nome
: name -
str_toolbar_titulo_nome
: name
The Android API already brings natively and even encourages the use of resources
external to display the application texts, making internationalization work easier. By default the string.xml
file is in the values
folder and you can insert another language by creating another directory for example: values-es
, which would be the Spanish language.
Doubt
Is there a standardization of the nomenclature attributed to String Resources
that is defined for improved understanding and clarity in coding?