Translate item given its path.
For translation inheritance, see the Example section of .loadTranslations().
path
String or Array containing the translation item path, eg. "greetings/bye"
, or
[ "greetings", "bye" ]
.
You can use the static method Globalize.translate()
, which uses the default
locale.
Globalize.loadTranslations({
greetings: {
bye: "Tchau"
}
});
Globalize.locale( "pt-BR" );
Globalize.translate( "greetings/bye" );
// ➡ "Tchau"
You can use the instance method .translate()
, which uses the instance locale.
var ptBr = new Globalize( "pt-BR" );
ptBr.translate( "greetings/bye" );
// ➡ "Tchau"