Banana.Translations.Translator

Dokumentation •
In diesem Artikel

The class Banana.Translations.Translator let you translate strings.

Properties

context

Returns the context of the translator.

language

Returns the language of the translator.

valid

Returns true if the translator is valid.

An invalid translator simply returns the text untranslated as written in the source code.

Methods

tr(text [, disambiguation , n])

Translate a string in the language and context of the translator


// Get translator for the document's language
var documentLanguage = "en"; //default
if (Banana.document) {
    documentLanguage = Banana.document.locale.substring(0,2);
}
var docTranslator = Banana.Translations.getTranslator(documentLanguage, "MyReport");

// Translate to the document's language
var myReportTranslatedText = docTranslator.tr(myReportTexts.account_card);

translate(context, text [, disambiguation , n])

Translate a string in the language of the translator in the specified context.


// Get translator for the document's language
var documentLanguage = "en"; //default
if (Banana.document) {
    documentLanguage = Banana.document.locale.substring(0,2);
}
var docTranslator = Banana.Translations.getTranslator(documentLanguage, "MyReport");

// Translate to the document's language
var myReportTranslatedText = docTranslator.translate("MyReport", myReportTexts.account_card);
Wie können wir Ihnen besser helfen?
Wenn die Informationen auf dieser Seite nicht das sind, was Sie suchen, nicht klar genug sind oder nicht aktuell sind, lassen Sie es uns wissen.

Diesen Artikel teilen: Twitter | Facebook | LinkedIn | Email