Banana.Translations.Translator

文件资料 •
在此文中

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);

请帮助我们完善必备文件

我们非常欢迎您发送宝贵的反馈意见

请告诉我们什么主题需要更好的解释或如何才能更好的对其诠释。

分享这篇文章: Twitter | Facebook | LinkedIn | Email