【问题标题】:displaying labels in marathi language以马拉地语显示标签
【发布时间】:2010-03-08 13:49:26
【问题描述】:

我正在尝试用马拉地语显示表格标签 我正在创建 marathi.js 这是我的 mararhi.js

if(Ext.app.formPanel) 
{
     Ext.apply(Ext.app.formPanel.prototype, 
                      {
                       selectUser:'नाव'
                      }
     );
}

我的其他 js 文件包含这个

var Ext.app.formPanel = Ext.extend(Ext.form.FormPanel,{
     selectUser:'Select User',
     initComponent : function(config) {
                 Ext.apply(this, {
                           title      : 'User Rights',
                           bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
                           labelWidth : 100,
                           width      : 755,
                           id         : 'formUserRights',
                           renderTo:'adminpanel',
                           items      : [   id: 'User',
                                        fieldLabel:this.selectUser,
                                        width:200
                            ] //items
                 });//Ext.apply
                 Ext.app.formPanel.superclass.initComponent.apply(this, arguments);
         }//init component
}); //yuyu
......
....

但它不能工作 它给出了错误; missing before var Ext.app.formPanel = Ext.extend..... 但是当我仔细检查时,每件事都正确嵌套。

【问题讨论】:

  • 我不确定它是否相关,但您对items: [] 使用了错误的语法,[] 表示数组,而这些括号内的内容看起来更像一个对象。你的意思可能是items: [{ id: 'User'}]

标签: extjs label non-english


【解决方案1】:

首先,vava 在上面的评论中指出的语法错误。

第二,你不应该var 'Ext.app.formPanel' namespace

第三,initComponent不传递任何参数。

第四,你需要调用超类,而不是应用它——也不需要传递参数,因为没有。

Ext.ns('Ext.app');
Ext.app.formPanel = Ext.extend(Ext.form.FormPanel, {
selectUser : 'Select User',
initComponent : function() {
    Ext.apply(this, {
        title : 'User Rights',
        bodyStyle : 'padding: 10px; background-color: #DFE8F6',
        labelWidth : 100,
        width : 755,
        id : 'formUserRights',
        renderTo : 'adminpanel',
        items : [ {
            id : 'User',
            fieldLabel : this.selectUser,
            width : 200
        } ]
    });
    Ext.app.formPanel.superclass.initComponent.call(this);
}
});

顺便说一句,我不喜欢在我的应用程序代码中使用 Ext 命名空间,这样有可能发生冲突。我建议创建自己的命名空间。

在家里享受这个,希望有一天你会真正奖励答案。

【讨论】:

    猜你喜欢
    • 2012-08-16
    • 2023-03-31
    • 1970-01-01
    • 2011-01-05
    • 1970-01-01
    • 2018-03-26
    • 2013-10-21
    • 2016-07-31
    • 2014-03-23
    相关资源
    最近更新 更多