File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change 221
221
}
222
222
}
223
223
224
- var pluralForm = this . _getPluralForm ( number ) ;
224
+ locale = locale || this . _getLocale ( key ) ;
225
+ var pluralForm = this . _getPluralForm ( number , locale ) ;
225
226
226
227
return messageParts [ pluralForm ] ;
227
228
} ;
311
312
return message ;
312
313
} ;
313
314
315
+ /**
316
+ * Return the locale to be used between default and fallback.
317
+ * @param {String } key
318
+ * @return {String }
319
+ */
320
+ Lang . prototype . _getLocale = function ( key ) {
321
+ key = this . _parseKey ( key , this . locale )
322
+ if ( this . messages [ key . source ] ) {
323
+ return this . locale ;
324
+ }
325
+ if ( this . messages [ key . sourceFallback ] ) {
326
+ return this . fallback ;
327
+ }
328
+ return null ;
329
+ } ;
330
+
314
331
/**
315
332
* Find a message in a translation tree using both dotted keys and regular ones
316
333
*
452
469
* Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
453
470
*
454
471
* @param {Number } count
472
+ * @param {String } locale
455
473
* @return {Number }
456
474
*/
457
- Lang . prototype . _getPluralForm = function ( count ) {
458
- switch ( this . locale ) {
475
+ Lang . prototype . _getPluralForm = function ( count , locale ) {
476
+ switch ( locale ) {
459
477
case 'az' :
460
478
case 'bo' :
461
479
case 'dz' :
You can’t perform that action at this time.
0 commit comments