Permalink
Browse files

Added FieldContainer and MenuItem components for Ext JS.

  • Loading branch information...
1 parent f630200 commit a68b7e0c8ffa9c51c1e8635c0bbe531394be5191 @miguelocarvajal miguelocarvajal committed Apr 19, 2012
Showing with 68 additions and 0 deletions.
  1. +38 −0 Ux/locale/override/extjs/FieldContainer.js
  2. +30 −0 Ux/locale/override/extjs/MenuItem.js
View
38 Ux/locale/override/extjs/FieldContainer.js
@@ -0,0 +1,38 @@
+Ext.define('Ux.locale.override.extjs.FieldContainer', {
+ override : 'Ext.form.FieldContainer',
+
+ requires : [
+ 'Ux.locale.override.extjs.Component'
+ ],
+
+ setLocale : function(locale) {
+ var me = this,
+ locales = me.locales,
+ text = locales.fieldLabel,
+ manager = me.locale,
+ defaultText = '';
+
+ if (text) {
+ if (Ext.isObject(text)) {
+ defaultText = text.defaultText;
+ text = text.key;
+ }
+
+ text = manager.get(text, defaultText);
+
+ if (Ext.isString(text)) {
+ me.setFieldLabel(text);
+ }
+ }
+
+ me.callOverridden(arguments);
+ },
+
+ setFieldLabel : function(text) {
+ this.labelEl.update(text);
+
+ this.fieldLabel = text;
+
+ return this;
+ }
+});
View
30 Ux/locale/override/extjs/MenuItem.js
@@ -0,0 +1,30 @@
+Ext.define('Ux.locale.override.extjs.MenuItem', {
+ override : 'Ext.menu.Item',
+
+ requires : [
+ 'Ux.locale.override.extjs.Component'
+ ],
+
+ setLocale : function(locale) {
+ var me = this,
+ locales = me.locales,
+ text = locales.text,
+ manager = me.locale,
+ defaultText = '';
+
+ if (text) {
+ if (Ext.isObject(text)) {
+ defaultText = text.defaultText;
+ text = text.key;
+ }
+
+ text = manager.get(text, defaultText);
+
+ if (Ext.isString(text)) {
+ me.setText(text);
+ }
+ }
+
+ me.callOverridden(arguments);
+ }
+});

0 comments on commit a68b7e0

Please sign in to comment.