控制台警告:缺少密钥翻译

时间:2019-04-22 12:23:15

标签: javascript localization enyo l10n.js

我正在本地化一个程序,它可以按预期工作。但是,它显示一个控制台警告,提示该键缺少该特定语言的翻译。

我尝试删除this.localize();下的rendered: function(),它确实删除了控制台警告,但是它也会影响程序的其他部分,显示警告而不是其他键。

Javascript:

// Class for desktop toolbar
enyo.kind({
    name: "Sugar.DesktopToolbar",
    kind: enyo.Control,
    components: [
        {name: "searchtext", kind: "Sugar.SearchField", classes: "homeview-filter-text", onTextChanged: "filterActivities"},
        {name: "helpbutton", kind: "Button", classes: "toolbutton help-button", title:"Help", ontap: "startTutorial"},
        {name: "syncbutton", classes: "sync-button sync-home sync-gear sync-gear-home", showing: false},
        {name: "radialbutton", kind: "Button", classes: "toolbutton view-radial-button active", title:"Home", ontap: "showRadialView"},
        {name: "neighborbutton", kind: "Button", classes: "toolbutton view-neighbor-button", title:"Home", ontap: "showNeighborView"},
        {name: "listbutton", kind: "Button", classes: "toolbutton view-list-button", title:"List", ontap: "showListView"}
    ],

    // Constructor
    create: function() {
        this.inherited(arguments);
        this.needRedraw = false;
    },

    rendered: function() {
        this.inherited(arguments);
        this.localize();
    },

    localize: function() {
        // Localize items
        this.$.searchtext.setPlaceholder(l10n.get("SearchHome"));
        this.$.radialbutton.setNodeProperty("title", l10n.get("FavoritesView"));
        this.$.listbutton.setNodeProperty("title", l10n.get("ListView"));
        this.$.neighborbutton.setNodeProperty("title", l10n.get("NeighborhoodView"));
        this.$.helpbutton.setNodeProperty("title", l10n.get("Tutorial"));
        if (app.localize) {
            app.localize();
        }
    },

警告:

“ [[l10n] #SearchHome缺少[en]”“

0 个答案:

没有答案