Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for plural words, using the 'p:' prefix.

  • Loading branch information...
commit f6302003b4c57730306225ed4d2c0923a564f18c 1 parent 2f95e2c
@miguelocarvajal miguelocarvajal authored Omar Carvajal committed
Showing with 11 additions and 4 deletions.
  1. +11 −4 Ux/locale/Manager.js
View
15 Ux/locale/Manager.js
@@ -115,9 +115,11 @@ Ext.define('Ux.locale.Manager', {
get : function(key, defaultText) {
var me = this,
locale = me._locale,
- keys = key.split('.'),
+ plural = key.indexOf('p:') == 0,
+ keys = (plural ? key.substr(2) : key).split('.'),
k = 0,
- kNum = keys.length;
+ kNum = keys.length,
+ res;
if (!me.isLoaded()) {
return defaultText;
@@ -131,7 +133,12 @@ Ext.define('Ux.locale.Manager', {
}
}
- return locale || defaultText;
+ res = locale || defaultText;
+
+ if (plural)
+ return Ext.util.Inflector.pluralize(res);
+ else
+ return res;
},
getAvailable : function(simple) {
@@ -156,4 +163,4 @@ Ext.define('Ux.locale.Manager', {
getLanguage : function(){
return this._language;
}
-});
+});
Please sign in to comment.
Something went wrong with that request. Please try again.