Ext.UpdateManager.defaults.indicatorText = '<div class="loading-indicator">加载中 ...</div>';

if(Ext.View){
   Ext.View.prototype.emptyText = "";
}

if(Ext.grid.GridPanel){
   Ext.grid.GridPanel.prototype.ddText = "选中了 {0} 行";
}

if(Ext.TabPanelItem){
   Ext.TabPanelItem.prototype.closeText = "关闭标签";
}

if(Ext.form.BasicForm){
   Ext.form.BasicForm.prototype.waitTitle = "请稍等...";
}

if(Ext.form.Field){
   Ext.form.Field.prototype.invalidText = "此处填写的值不正确";
}

if(Ext.LoadMask){
  Ext.LoadMask.prototype.msg = "加载中 ...";
}

Date.monthNames = [
   "一月",
   "二月",
   "三月",
   "四月",
   "五月",
   "六月",
   "七月",
   "八月",
   "九月",
   "十月",
   "十一月",
   "十二月"
];

Date.getShortMonthName = function(month) {
  return Date.monthNames[month].substring(0, Date.monthNames[month].length-1);
};

Date.monthNumbers = {
	'一' : 0,
	'二' : 1,
	'三' : 2,
	'四' : 3,
	'五' : 4,
	'六' : 5,
	'七' : 6,
	'八' : 7,
	'九' : 8,
	'十' : 9,
	'十一' : 10,
	'十二' : 11
};

Date.getMonthNumber = function(name) {
  return Date.monthNumbers[name.replace('月', '')];
};

Date.dayNames = [
   "星期日",
   "星期一",
   "星期二",
   "星期三",
   "星期四",
   "星期五",
   "星期六"
];

Date.getShortDayName = function(day) {
  return Date.dayNames[day].substr(2, 1);
};

if(Ext.MessageBox){
   Ext.MessageBox.buttonText = {
      ok     : "确定",
      cancel : "取消",
      yes    : "是",
      no     : "否"
   };
}

if(Ext.util.Format){
    Ext.util.Format.__number = Ext.util.Format.number;
    Ext.util.Format.number = function(v, format) {
        return Ext.util.Format.__number(v, format || "0.000,00/i");
    };

   Ext.util.Format.date = function(v, format) {
      if(!v) return "";
      if(!(v instanceof Date)) v = new Date(Date.parse(v));
      return v.dateFormat(format || "d.m.Y");
   };
}

if(Ext.DatePicker){
   Ext.apply(Ext.DatePicker.prototype, {
      todayText         : "今天",
      minText           : "日期小于最早限制",
      maxText           : "日期大于最晚限制",
      disabledDaysText  : "",
      disabledDatesText : "",
      monthNames        : Date.monthNames,
      dayNames          : Date.dayNames,
      nextText          : "下个月 (Control + 右)",
      prevText          : "上个月 (Control + 左)",
      monthYearText     : "选择月份 (Control + 上/下选择年份)",
      todayTip          : "今天 ({0}) (空格)",
      format            : "Y.m.d",
      okText            : "&#160;确定&#160;",
      cancelText        : "取消",
      startDay          : 1
   });
}

if(Ext.PagingToolbar){
   Ext.apply(Ext.PagingToolbar.prototype, {
      beforePageText : "当前第 ",
      afterPageText  : " 页，共 {0} 页",
      firstText      : "首页",
      prevText       : "上页",
      nextText       : "下页",
      lastText       : "末页",
      refreshText    : "刷新",
      displayMsg     : "显示记录 {0} - {1} ，共 {2} 条记录",
      emptyMsg       : "没有数据"
   });
}

if(Ext.form.TextField){
   Ext.apply(Ext.form.TextField.prototype, {
      minLengthText : "最短长度 {0}",
      maxLengthText : "最长长度 {1}",
      blankText     : "必填",
      regexText     : "",
      emptyText     : null
   });
}

if(Ext.form.NumberField){
   Ext.apply(Ext.form.NumberField.prototype, {
      minText : "最小值 {0}",
      maxText : "最大值 {0}",
      nanText : "{0} 不是个有效的数值",
      decimalSeparator : ","
   });
}

if(Ext.form.DateField){
   Ext.apply(Ext.form.DateField.prototype, {
      disabledDaysText  : "不可选",
      disabledDatesText : "不可选",
      minText           : "日期不得早于 {0}",
      maxText           : "日期不得晚于 {0}",
      invalidText       : "{0} 不是个有效的日期, 请按格式 {1} 填写",
      format            : "Y.m.d",
      altFormats        : "m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d|n-j|n/j",
      startDay          : 1
   });
}

if(Ext.form.ComboBox){
   Ext.apply(Ext.form.ComboBox.prototype, {
      loadingText       : "加载数据 ...",
      valueNotFoundText : undefined
   });
}

if(Ext.form.VTypes){
   Ext.apply(Ext.form.VTypes, {
      emailText    : '请填写电子邮件地址. 格式: "user@example.com"',
      urlText      : '请填写网址. 格式: "http:/'+'/www.example.com"',
      alphaText    : '只允许字母和下划线(_)',
      alphanumText : '只允许字母、数字和下划线(_)'
   });
}

if(Ext.form.HtmlEditor){
  Ext.apply(Ext.form.HtmlEditor.prototype, {
    createLinkText : '填写链接的地址',
    fontFamilies : [
        'Arial',
     	'Consolas',
        'Courier New',
        'Tahoma',
        'Times New Roman',
        'Verdana',
     	'微软雅黑'
    ],
    defaultFont: 'Consolas',
    buttonTips : {
      bold : {
        title: '加粗 (Ctrl+B)',
        text: '加粗所选文字',
        cls: 'x-html-editor-tip'
      },
      italic : {
        title: '斜体 (Ctrl+I)',
        text: '所选文字倾斜',
        cls: 'x-html-editor-tip'
      },
      underline : {
        title: '下划线 (Ctrl+U)',
        text: '将所选文字加上下划线',
        cls: 'x-html-editor-tip'
      },
      increasefontsize : {
        title: '增大字号',
        text: '增大所选文字的字号',
        cls: 'x-html-editor-tip'
      },
      decreasefontsize : {
        title: '减小字号',
        text: '减小所选文字的字号',
        cls: 'x-html-editor-tip'
      },
      backcolor : {
        title: '文字背景色',
        text: '更改所选文字的背景色',
        cls: 'x-html-editor-tip'
      },
      forecolor : {
        title: '颜色',
        text: '更改所选文字的颜色',
        cls: 'x-html-editor-tip'
      },
      justifyleft : {
        title: '左对齐',
        text: '设置所选文字向左对齐',
        cls: 'x-html-editor-tip'
      },
      justifycenter : {
        title: '居中',
        text: '设置所选文字居中',
        cls: 'x-html-editor-tip'
      },
      justifyright : {
        title: '右对齐',
        text: '设置所选文字右对齐',
        cls: 'x-html-editor-tip'
      },
      insertunorderedlist : {
        title: '无序列表',
        text: '开始一个无序列表',
        cls: 'x-html-editor-tip'
      },
      insertorderedlist : {
        title: '有序列表',
        text: '开始一个有序列表',
        cls: 'x-html-editor-tip'
      },
      createlink : {
        title: '超链接',
        text: '将所选文字转换为超链接',
        cls: 'x-html-editor-tip'
      },
      sourceedit : {
        title: '编辑源码',
        text: '切换到源码编辑模式',
        cls: 'x-html-editor-tip'
      }
    }
  });
}

if(Ext.grid.GridView){
   Ext.apply(Ext.grid.GridView.prototype, {
      sortAscText  : "正序",
      sortDescText : "倒序",
      lockText     : "锁定列",
      unlockText   : "取消锁定列",
      columnsText  : "列"
   });
}

if(Ext.grid.GroupingView){
  Ext.apply(Ext.grid.GroupingView.prototype, {
    emptyGroupText : '(无分组)',
    groupByText    : '按此列分组',
    showGroupsText : '显示分组'
  });
}

if(Ext.grid.PropertyColumnModel){
  Ext.apply(Ext.grid.PropertyColumnModel.prototype, {
      nameText   : "名称",
      valueText  : "数值",
      dateFormat : "Y.m.d"
  });
}

if(Ext.grid.BooleanColumn){
   Ext.apply(Ext.grid.BooleanColumn.prototype, {
      trueText  : "是",
      falseText : "否"
   });
}

if(Ext.grid.NumberColumn){
    Ext.apply(Ext.grid.NumberColumn.prototype, {
        format : '0.000,00/i'
    });
}

if(Ext.grid.DateColumn){
    Ext.apply(Ext.grid.DateColumn.prototype, {
        format : 'Y.m.d'
    });
}

if(Ext.layout.BorderLayout && Ext.layout.BorderLayout.SplitRegion){
  Ext.apply(Ext.layout.BorderLayout.SplitRegion.prototype, {
    splitTip            : "拖动调整大小",
    collapsibleSplitTip : "拖动调整大小，双击隐藏"
  });
}

if(Ext.form.TimeField){
   Ext.apply(Ext.form.TimeField.prototype, {
    minText : "时间必须不早于 {0}",
    maxText : "时间必须不晚于 {1}",
    invalidText : "{0} 不是有效的时间",
    format : "g:i A"
   });
}

if(Ext.form.CheckboxGroup){
  Ext.apply(Ext.form.CheckboxGroup.prototype, {
    blankText : "至少选择一项"
  });
}

if(Ext.form.RadioGroup){
  Ext.apply(Ext.form.RadioGroup.prototype, {
    blankText : "至少选择一项"
  });
}
