Skip to content
Browse files

Update plurals, add auto-gen warning.

  • Loading branch information...
1 parent 33557ea commit e60617d80eee88920344c515e2b3fe403c7fddc4 @rubenv committed
Showing with 5 additions and 1 deletion.
  1. +1 −0 dist/angular-gettext.js
  2. +1 −1 dist/angular-gettext.min.js
  3. +1 −0 genplurals.py
  4. +2 −0 src/plural.js
View
1 dist/angular-gettext.js
@@ -154,6 +154,7 @@ angular.module('gettext').factory('gettextPlurals', function () {
case 'mg':
case 'mi':
case 'oc':
+ case 'pt_BR':
case 'tg':
case 'ti':
case 'tr':
View
2 dist/angular-gettext.min.js
@@ -1 +1 @@
-angular.module("gettext",[]),angular.module("gettext").factory("gettext",function(){return function(a){return a}}),angular.module("gettext").factory("gettextCatalog",["gettextPlurals",function(a){var b;return b=function(){function b(){this.debug=!1,this.strings={},this.currentLanguage="en"}var c;return c=function(a,b){return a?"[MISSING]: "+b:b},b.prototype.setStrings=function(a,b){var c,d,e;this.strings[a]||(this.strings[a]={}),e=[];for(c in b)d=b[c],"string"==typeof d?e.push(this.strings[a][c]=[d]):e.push(this.strings[a][c]=d);return e},b.prototype.getString=function(a){var b,d;return(null!=(b=this.strings[this.currentLanguage])?null!=(d=b[a])?d[0]:void 0:void 0)||c(this.debug,a)},b.prototype.getPlural=function(b,d,e){var f,g,h;return f=a(this.currentLanguage,b),g=(null!=(h=this.strings[this.currentLanguage])?h[d]:void 0)||[],g[f]||c(this.debug,1===b?d:e)},b}(),new b}]),angular.module("gettext").directive("translate",["gettextCatalog","$interpolate","$parse",function(a,b,c){return{transclude:"element",priority:900,compile:function(d,e,f){return function(d,g){var h=function(a,b){throw new Error("You should add a "+a+" attribute whenever you add a "+b+" attribute.")};e.translatePlural&&!e.translateN&&h("translate-n","translate-plural"),e.translateN&&!e.translatePlural&&h("translate-plural","translate-n");var i=c(e.translateN);f(d,function(c){var f=c.html();return c.removeAttr("translate"),g.replaceWith(c),d.$watch(function(){var g,h=c.html();g=e.translatePlural?a.getPlural(i(d),f,e.translatePlural):a.getString(f);var j=b(g)(d);return h!==j?c.html(j):void 0})})}}}}]),angular.module("gettext").filter("translate",["gettextCatalog","$interpolate","$parse",function(a){return function(b){return a.getString(b)}}]),angular.module("gettext").factory("gettextPlurals",function(){return function(a,b){switch(a){case"ay":case"bo":case"cgg":case"dz":case"fa":case"id":case"ja":case"jbo":case"ka":case"kk":case"km":case"ko":case"ky":case"lo":case"ms":case"my":case"sah":case"su":case"th":case"tt":case"ug":case"vi":case"wo":case"zh":return 0;case"is":return 1!=b%10||11==b%100?1:0;case"jv":return 0!=b?1:0;case"mk":return 1==b||1==b%10?0:1;case"ach":case"ak":case"am":case"arn":case"br":case"fil":case"fr":case"gun":case"ln":case"mfe":case"mg":case"mi":case"oc":case"tg":case"ti":case"tr":case"uz":case"wa":case"zh":return b>1?1:0;case"lv":return 1==b%10&&11!=b%100?0:0!=b?1:2;case"lt":return 1==b%10&&11!=b%100?0:b%10>=2&&(10>b%100||b%100>=20)?1:2;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return 1==b%10&&11!=b%100?0:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?1:2;case"mnk":return 0==b?0:1==b?1:2;case"ro":return 1==b?0:0==b||b%100>0&&20>b%100?1:2;case"pl":return 1==b?0:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?1:2;case"cs":case"sk":return 1==b?0:b>=2&&4>=b?1:2;case"sl":return 1==b%100?1:2==b%100?2:3==b%100||4==b%100?3:0;case"mt":return 1==b?0:0==b||b%100>1&&11>b%100?1:b%100>10&&20>b%100?2:3;case"gd":return 1==b||11==b?0:2==b||12==b?1:b>2&&20>b?2:3;case"cy":return 1==b?0:2==b?1:8!=b&&11!=b?2:3;case"kw":return 1==b?0:2==b?1:3==b?2:3;case"ga":return 1==b?0:2==b?1:7>b?2:11>b?3:4;case"ar":return 0==b?0:1==b?1:2==b?2:b%100>=3&&10>=b%100?3:b%100>=11?4:5;default:return 1!=b?1:0}}});
+angular.module("gettext",[]),angular.module("gettext").factory("gettext",function(){return function(a){return a}}),angular.module("gettext").factory("gettextCatalog",["gettextPlurals",function(a){var b;return b=function(){function b(){this.debug=!1,this.strings={},this.currentLanguage="en"}var c;return c=function(a,b){return a?"[MISSING]: "+b:b},b.prototype.setStrings=function(a,b){var c,d,e;this.strings[a]||(this.strings[a]={}),e=[];for(c in b)d=b[c],"string"==typeof d?e.push(this.strings[a][c]=[d]):e.push(this.strings[a][c]=d);return e},b.prototype.getString=function(a){var b,d;return(null!=(b=this.strings[this.currentLanguage])?null!=(d=b[a])?d[0]:void 0:void 0)||c(this.debug,a)},b.prototype.getPlural=function(b,d,e){var f,g,h;return f=a(this.currentLanguage,b),g=(null!=(h=this.strings[this.currentLanguage])?h[d]:void 0)||[],g[f]||c(this.debug,1===b?d:e)},b}(),new b}]),angular.module("gettext").directive("translate",["gettextCatalog","$interpolate","$parse",function(a,b,c){return{transclude:"element",priority:900,compile:function(d,e,f){return function(d,g){var h=function(a,b){throw new Error("You should add a "+a+" attribute whenever you add a "+b+" attribute.")};e.translatePlural&&!e.translateN&&h("translate-n","translate-plural"),e.translateN&&!e.translatePlural&&h("translate-plural","translate-n");var i=c(e.translateN);f(d,function(c){var f=c.html();return c.removeAttr("translate"),g.replaceWith(c),d.$watch(function(){var g,h=c.html();g=e.translatePlural?a.getPlural(i(d),f,e.translatePlural):a.getString(f);var j=b(g)(d);return h!==j?c.html(j):void 0})})}}}}]),angular.module("gettext").filter("translate",["gettextCatalog","$interpolate","$parse",function(a){return function(b){return a.getString(b)}}]),angular.module("gettext").factory("gettextPlurals",function(){return function(a,b){switch(a){case"ay":case"bo":case"cgg":case"dz":case"fa":case"id":case"ja":case"jbo":case"ka":case"kk":case"km":case"ko":case"ky":case"lo":case"ms":case"my":case"sah":case"su":case"th":case"tt":case"ug":case"vi":case"wo":case"zh":return 0;case"is":return 1!=b%10||11==b%100?1:0;case"jv":return 0!=b?1:0;case"mk":return 1==b||1==b%10?0:1;case"ach":case"ak":case"am":case"arn":case"br":case"fil":case"fr":case"gun":case"ln":case"mfe":case"mg":case"mi":case"oc":case"pt_BR":case"tg":case"ti":case"tr":case"uz":case"wa":case"zh":return b>1?1:0;case"lv":return 1==b%10&&11!=b%100?0:0!=b?1:2;case"lt":return 1==b%10&&11!=b%100?0:b%10>=2&&(10>b%100||b%100>=20)?1:2;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return 1==b%10&&11!=b%100?0:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?1:2;case"mnk":return 0==b?0:1==b?1:2;case"ro":return 1==b?0:0==b||b%100>0&&20>b%100?1:2;case"pl":return 1==b?0:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?1:2;case"cs":case"sk":return 1==b?0:b>=2&&4>=b?1:2;case"sl":return 1==b%100?1:2==b%100?2:3==b%100||4==b%100?3:0;case"mt":return 1==b?0:0==b||b%100>1&&11>b%100?1:b%100>10&&20>b%100?2:3;case"gd":return 1==b||11==b?0:2==b||12==b?1:b>2&&20>b?2:3;case"cy":return 1==b?0:2==b?1:8!=b&&11!=b?2:3;case"kw":return 1==b?0:2==b?1:3==b?2:3;case"ga":return 1==b?0:2==b?1:7>b?2:11>b?3:4;case"ar":return 0==b?0:1==b?1:2==b?2:b%100>=3&&10>=b%100?3:b%100>=11?4:5;default:return 1!=b?1:0}}});
View
1 genplurals.py
@@ -109,6 +109,7 @@ def handle_entityref(self, name):
rules = [rule for rule in parser.rules.items()]
rules.sort(key = lambda rule: (str(rule[1][0][2]) + rule[0]))
+print('// Do not edit this file, it is autogenerated using genplurals.py!');
print('angular.module("gettext").factory("gettextPlurals", function () {');
print(' return function (langCode, n) {')
print(' switch (langCode) {')
View
2 src/plural.js
@@ -1,3 +1,4 @@
+// Do not edit this file, it is autogenerated using genplurals.py!
angular.module("gettext").factory("gettextPlurals", function () {
return function (langCode, n) {
switch (langCode) {
@@ -49,6 +50,7 @@ angular.module("gettext").factory("gettextPlurals", function () {
case "mg": // Malagasy
case "mi": // Maori
case "oc": // Occitan
+ case "pt_BR": // Brazilian Portuguese
case "tg": // Tajik
case "ti": // Tigrinya
case "tr": // Turkish

0 comments on commit e60617d

Please sign in to comment.
Something went wrong with that request. Please try again.