How to use the i18n.t function in i18n

To help you get started, we’ve selected a few i18n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adapt-it / adapt-it-mobile / www / js / views / HomeViews.js View on Github external
if (navigator.notification) {
                        // on mobile device
                        navigator.notification.prompt(i18n.t('view.dscPassword'), function (results) {
                            if (results.buttonIndex === 1 && results.input1 === strPassword) {
                                navigator.notification.confirm(i18n.t('view.dscReset'), function (buttonIndex) {
                                    if (buttonIndex === 1) {
                                        resetAIM();
                                    }
                                }, i18n.t('view.ttlReset'));
                            }
                        }, i18n.t('view.ttlReset'));
                    } else {
                        // in browser
                        if (prompt(i18n.t('view.dscPassword')) === strPassword) {
                            if (confirm(i18n.t('view.dscReset'))) {
                                resetAIM();
                            }
                        }
                    }
                }
            },
            // User clicked on the Continue button (initial startup screen). Redirects the user to
github adapt-it / adapt-it-mobile / www / js / views / AdaptViews.js View on Github external
// swap the start and end so that placeholders, etc. insert
                        // at the correct location
                        tmpItem = selectedEnd;
                        selectedEnd = selectedStart;
                        selectedStart = tmpItem;
                        tmpIdx = idxEnd;
                        idxEnd = idxStart;
                        idxStart = tmpIdx;
                    }
                    // ** Icons and labels for the toolbar **
                    spid = $(selectedStart).attr('id');
                    // did the user select a placeholder?
                    if (spid.indexOf("plc") !== -1) {
                        // placeholder -- can remove it, but not add a new one
                        isPlaceholder = true;
                        $("#Placeholder").prop('title', i18next.t("view.dscDelPlaceholder"));
                        $("#Placeholder .topcoat-icon").removeClass("topcoat-icon--placeholder-new");
                        $("#Placeholder .topcoat-icon").addClass("topcoat-icon--placeholder-delete");
                        $("#mnuPlaceholder .topcoat-icon").removeClass("topcoat-icon--placeholder-new");
                        $("#mnuPlaceholder .topcoat-icon").addClass("topcoat-icon--placeholder-delete");
                    } else {
                        // not a placeholder -- can add a new one
                        isPlaceholder = false;
                        $("#Placeholder").prop('title', i18next.t("view.dscNewPlaceholder"));
                        $("#Placeholder .topcoat-icon").removeClass("topcoat-icon--placeholder-delete");
                        $("#Placeholder .topcoat-icon").addClass("topcoat-icon--placeholder-new");
                        $("#mnuPlaceholder .topcoat-icon").removeClass("topcoat-icon--placeholder-delete");
                        $("#mnuPlaceholder .topcoat-icon").addClass("topcoat-icon--placeholder-new");
                    }
                    // did the user select a phrase?
                    if ((spid.indexOf("phr") !== -1) && (selectedStart === selectedEnd)) {
                        // phrase (single selection) -- can remove it, but not add a new one
github adapt-it / adapt-it-mobile / www / js / views / NewProjectView.js View on Github external
case 3: // fonts
                currentView = projFontsView;
                // title
                $("#StepTitle").html(i18n.t('view.lblCreateProject'));
                // instructions
                $("#StepInstructions").html(i18n.t('view.dscProjectFonts'));
                // controls
                $('#StepContainer').html(currentView.render().el.childNodes);
                // Second step -- enable the prev button
                break;
            case 4: // punctuation
                currentView = projPunctuationView;
                // title
                this.$("#StepTitle").html(i18n.t('view.lblCreateProject'));
                // instructions
                this.$("#StepInstructions").html(i18n.t('view.dscProjectPunctuation'));
                // controls
                this.$('#StepContainer').html(currentView.render().el.childNodes);
                break;
            case 5: // cases
                currentView = projCasesView;
                // title
                this.$("#StepTitle").html(i18n.t('view.lblCreateProject'));
                // instructions
                this.$("#StepInstructions").html(i18n.t('view.dscProjectCases'));
                // controls
                this.$('#StepContainer').html(currentView.render().el.childNodes);
                // Penultimate step -- enable the next button (only needed
                // if the user happens to back up from the last one)
                this.$("#lblNext").html(i18n.t('view.lblNext'));
                this.$("#imgNext").removeAttr("style");
                break;
github adapt-it / adapt-it-mobile / www / js / views / AdaptViews.js View on Github external
}
                    // did the user select a phrase?
                    if ((spid.indexOf("phr") !== -1) && (selectedStart === selectedEnd)) {
                        // phrase (single selection) -- can remove it, but not add a new one
                        isPhrase = true;
                        $("#Phrase").prop('title', i18next.t("view.dscDelPhrase"));
                        $("#Phrase .topcoat-icon").removeClass("topcoat-icon--phrase-new");
                        $("#Phrase .topcoat-icon").addClass("topcoat-icon--phrase-delete");
                        $("#mnuPhrase .topcoat-icon").removeClass("topcoat-icon--phrase-new");
                        $("#mnuPhrase .topcoat-icon").addClass("topcoat-icon--phrase-delete");
                        $("#Phrase").prop('disabled', false); // enable toolbar button (to delete phrase)
                        $("#mnuPhrase").prop('disabled', false); // enable toolbar button (to delete phrase)
                    } else {
                        // not a placeholder -- can add a new one
                        isPhrase = false;
                        $("#Phrase").prop('title', i18next.t("view.dscNewPhrase"));
                        $("#Phrase .topcoat-icon").removeClass("topcoat-icon--phrase-delete");
                        $("#Phrase .topcoat-icon").addClass("topcoat-icon--phrase-new");
                        $("#mnuPhrase .topcoat-icon").removeClass("topcoat-icon--phrase-delete");
                        $("#mnuPhrase .topcoat-icon").addClass("topcoat-icon--phrase-new");
                    }
                    // did the user select a retranslation?
                    if (spid.indexOf("ret") !== -1) {
                        // retranslation -- can remove it, but not add a new one
                        isRetranslation = true;
                        $("#Retranslation").prop('title', i18next.t("view.dscDelRetranslation"));
                        $("#Retranslation .topcoat-icon").removeClass("topcoat-icon--retranslation-new");
                        $("#Retranslation .topcoat-icon").addClass("topcoat-icon--retranslation-delete");
                        $("#mnuRetranslation .topcoat-icon").removeClass("topcoat-icon--retranslation-new");
                        $("#mnuRetranslation .topcoat-icon").addClass("topcoat-icon--retranslation-delete");
                        $("#Retranslation").prop('disabled', false); // enable toolbar button (to delete retranslation)
                        $("#mnuRetranslation").prop('disabled', false); // enable toolbar button (to delete retranslation)
github KleeGroup / focus-core / lib / definition / validator / validate.js View on Github external
function getErrorLalel(type, fieldName) {
    var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];

    options = options || {};
    var i18n = require('i18n');
    if (!i18n) {
        throw new DependencyException('Dependency not resolved: i18n.js');
    }
    var translationKey = options.translationKey ? options.translationKey : 'domain.validation.' + type;
    var opts = assign({ fieldName: i18n.t(fieldName) }, options);
    return i18n.t(translationKey, opts);
}
github Scintillo / eppabasic / runtime / main / panic.js View on Github external
onPanic: function onPanic(errCode, line) {
            var short = i18n.t('runtime:errors.' + errCode + '.short');
            var long = i18n.t('runtime:errors.' + errCode + '.long');
            var atLine = i18n.t('runtime:errors.at.line', { line: line });
            this.editor.ace.gotoLine(line);
            alert(short + ' ' + atLine + '\n\n' + long);
        }
    };
github cocos-creator / example-cases / assets / cases / 05_scripting / 11_network / NetworkCtrl.js View on Github external
this._wsiSendBinary.onopen = function(evt) {
            websocketLabel.textKey = i18n.t("cases/05_scripting/11_network/NetworkCtrl.js.5");
        };
github adapt-it / adapt-it-mobile / www / js / views / AdaptViews.js View on Github external
var stepToggleBtns = [
                    {
                        title: i18next.t('view.hlpttlPlaceholder'),
                        content: i18next.t('view.hlpdscPlaceholder'),
                        target: "Placeholder",
                        placement: "bottom"
                    },
                    {
                        title: i18next.t('view.hlpttlPhrase'),
                        content: i18next.t('view.hlpdscPhrase'),
                        target: "Phrase",
                        placement: "bottom"
                    },
                    {
                        title: i18next.t('view.hlpttlRetranslation'),
                        content: i18next.t('view.hlpdscRetranslation'),
                        target: "Retranslation",
                        arrowOffset: "center",
                        placement: "bottom"
                    }
                ];
                var stepLastBtns = [
                    {
                        title: i18next.t('view.hlpttlPrevNext'),
                        content: i18next.t('view.hlpdscPrevNext'),
                        target: "PrevSP",
                        placement: "bottom"
                    },
                    {
                        title: i18next.t('view.hlpttlBack'),
                        content: i18next.t('view.hlpdscBack'),
                        target: "back",
github iran-react-community / elegant-react-native / app / view / pages / github / index.js View on Github external
{buttons.map(button => (
            <button disabled="{github.loading}" color="#13a77f" mode="outlined"> setQuery(button.id)}
              style={appStyle.button}&gt;
              {query === button.id &amp;&amp; github.loading
                ? t('app.loading')
                : button.title}
            </button>
          ))}
github cocos-creator / example-cases / assets / cases / 05_scripting / 10_loadingBar / LoadingBarCtrl.js View on Github external
onLoad: function () {
        this._urls = [
            cc.url.raw("resources/audio/ding.wav"),
            cc.url.raw("resources/audio/cheering.wav"),
            cc.url.raw("resources/audio/music_logo.mp3"),
            cc.url.raw("resources/test_assets/audio.mp3"),
            cc.url.raw("resources/loadingBar/font.png"),
            cc.url.raw("resources/loadingBar/mikado_outline_shadow.png"),
            cc.url.raw("resources/loadingBar/enligsh-chinese.png")
        ];
        this.resource = null;
        this.progressBar.progress = 0;
        this._clearAll();
        this.progressTips.textKey = i18n.t("cases/05_scripting/10_loadingBar/LoadingBarCtrl.js.3");
        this.node.on(cc.Node.EventType.TOUCH_START, function () {
            if (this.resource) { return; }
            cc.loader.load(this._urls, this._progressCallback.bind(this), this._completeCallback.bind(this));
        }, this);
    },