Lines Matching defs:PLURAL
661 if("zh_TW"==goog.LOCALE||"zh-TW"==goog.LOCALE)goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;"zu"==goog.LOCALE&&(goog.i18n.pluralRules.select=goog.i18n.pluralRules.hiSelect_);goog.i18n.MessageFormat=function(a){this.literals_=[];this.parsedPattern_=[];this.numberFormatter_=new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.DECIMAL);this.parsePattern_(a)};goog.i18n.MessageFormat.LITERAL_PLACEHOLDER_="\ufddf_";goog.i18n.MessageFormat.Element_={STRING:0,BLOCK:1};goog.i18n.MessageFormat.BlockType_={PLURAL:0,ORDINAL:1,SELECT:2,SIMPLE:3,STRING:4,UNKNOWN:5};goog.i18n.MessageFormat.OTHER_="other";goog.i18n.MessageFormat.REGEX_LITERAL_=/'([{}#].*?)'/g;
663 goog.i18n.MessageFormat.prototype.formatBlock_=function(a,b,c,d){for(var e=0;e<a.length;e++)switch(a[e].type){case goog.i18n.MessageFormat.BlockType_.STRING:d.push(a[e].value);break;case goog.i18n.MessageFormat.BlockType_.SIMPLE:var f=a[e].value;this.formatSimplePlaceholder_(f,b,d);break;case goog.i18n.MessageFormat.BlockType_.SELECT:f=a[e].value;this.formatSelectBlock_(f,b,c,d);break;case goog.i18n.MessageFormat.BlockType_.PLURAL:f=a[e].value;this.formatPluralOrdinalBlock_(f,b,goog.i18n.pluralRules.select,
666 goog.i18n.MessageFormat.prototype.formatPluralOrdinalBlock_=function(a,b,c,d,e){var f=a.argumentIndex,g=a.argumentOffset,h=+b[f];isNaN(h)?e.push("Undefined or invalid parameter - "+f):(g=h-g,f=a[b[f]],goog.isDef(f)||(goog.asserts.assert(0<=g,"Argument index smaller than offset."),c=this.numberFormatter_.getMinimumFractionDigits?c(g,this.numberFormatter_.getMinimumFractionDigits()):c(g),goog.asserts.assertString(c,"Invalid plural key."),f=a[c],goog.isDef(f)||(f=a[goog.i18n.MessageFormat.OTHER_]),goog.asserts.assertArray(f,
667 "Invalid option or missing other option for plural block.")),a=[],this.formatBlock_(f,b,d,a),b=a.join(""),goog.asserts.assertString(b,"Empty block in plural."),d?e.push(b):(d=this.numberFormatter_.format(g),e.push(b.replace(/#/g,d))))};goog.i18n.MessageFormat.prototype.parsePattern_=function(a){a&&(a=this.insertPlaceholders_(a),this.parsedPattern_=this.parseBlock_(a))};
670 b=a.substring(b);""!=b&&d.push({type:goog.i18n.MessageFormat.Element_.STRING,value:b});return d};goog.i18n.MessageFormat.PLURAL_BLOCK_RE_=/^\s*(\w+)\s*,\s*plural\s*,(?:\s*offset:(\d+))?/;goog.i18n.MessageFormat.ORDINAL_BLOCK_RE_=/^\s*(\w+)\s*,\s*selectordinal\s*,/;goog.i18n.MessageFormat.SELECT_BLOCK_RE_=/^\s*(\w+)\s*,\s*select\s*,/;
671 goog.i18n.MessageFormat.prototype.parseBlockType_=function(a){return goog.i18n.MessageFormat.PLURAL_BLOCK_RE_.test(a)?goog.i18n.MessageFormat.BlockType_.PLURAL:goog.i18n.MessageFormat.ORDINAL_BLOCK_RE_.test(a)?goog.i18n.MessageFormat.BlockType_.ORDINAL:goog.i18n.MessageFormat.SELECT_BLOCK_RE_.test(a)?goog.i18n.MessageFormat.BlockType_.SELECT:/^\s*\w+\s*/.test(a)?goog.i18n.MessageFormat.BlockType_.SIMPLE:goog.i18n.MessageFormat.BlockType_.UNKNOWN};
673 case goog.i18n.MessageFormat.BlockType_.PLURAL:d.type=goog.i18n.MessageFormat.BlockType_.PLURAL;d.value=this.parsePluralBlock_(a[c].value);break;case goog.i18n.MessageFormat.BlockType_.ORDINAL:d.type=goog.i18n.MessageFormat.BlockType_.ORDINAL;d.value=this.parseOrdinalBlock_(a[c].value);break;case goog.i18n.MessageFormat.BlockType_.SIMPLE:d.type=goog.i18n.MessageFormat.BlockType_.SIMPLE;d.value=a[c].value;break;default:goog.asserts.fail("Unknown block type for pattern: "+a[c].value)}}else goog.asserts.fail("Unknown part of the pattern.");
677 goog.i18n.MessageFormat.prototype.parsePluralBlock_=function(a){var b="",c=0,d=goog.i18n.MessageFormat.PLURAL_BLOCK_RE_;a=a.replace(d,function(a,d,e){b=d;e&&(c=parseInt(e,10));return""});d={};d.argumentIndex=b;d.argumentOffset=c;a=this.extractParts_(a);for(var e=0;e<a.length;){var f=a[e].value;goog.asserts.assertString(f,"Missing plural key element.");e++;goog.asserts.assert(e<a.length,"Missing or invalid plural value element.");if(goog.i18n.MessageFormat.Element_.BLOCK==a[e].type)var g=this.parseBlock_(a[e].value);
678 else goog.asserts.fail("Expected block type.");d[f.replace(/\s*(?:=)?(\w+)\s*/,"$1")]=g;e++}goog.asserts.assertArray(d[goog.i18n.MessageFormat.OTHER_],"Missing other key in plural statement.");return d};