7
To support internationalization, the Android has "features" files called resource
in XML, containing the texts to be displayed in the application. By default, the file /res/values/strings.xml
has the texts of an Android application.
Example:
<string name="str_titulo">Nome</string>
Each string
within XML is compiled and associated with a id
as shown in String Resources. These ids
are placed in a resource files, R
, as variables public static final
. It is possible to assign any chave
for each string, but this key is created lukewarm without a definitive standardization, for example:
str_titulo_nome
: namestr_actionbar_titulo_nome
: namestr_toolbar_titulo_nome
: name
The Android API already brings natively and even encourages the use of resources
external to display the texts of the application, making easier the work of internationalization. By default the file string.xml
stays in the folder values
and it is possible to insert another language by creating another directory for example: values-es
, which would be of the Spanish language.
Doubt
There is a standardization of the nomenclature assigned to String Resources
which is defined for improved understanding and clarity in the codification?
As I said there in our friend’s reply the point
.
I have a little "bias" to use because when I use thegetString(R.string.bla.bla)
within theclasse
, Android recognizes onlyR.string.bla
and ignores everything that is in front. I have using the underscore to separate eachlabel
.– viana
The point should only be used to indicate the beginning of the file extension, in the case of Resources in archives
– ramaral
Therefore, Leonardo Dias' answer is not valid?
– viana
The example presented is not valid for the reason stated by you.
– ramaral