* internationalize ULS when jquery.i18n is present. Otherwise use the fallback English interface * Example with and without i18n * Message files for few languages
4 lines
24 KiB
JavaScript
4 lines
24 KiB
JavaScript
/*! jquery.i18n - v0.1.0 - 2012-09-21
|
||
* https://github.com/wikimedia/jquery.i18n
|
||
* Copyright (c) 2012 Santhosh Thottingal; Licensed GPL, MIT */
|
||
function pluralRuleParser(a,b){function q(){}function r(a){return function(){for(var b=0;b<a.length;b++){var c=a[b]();if(c!==null)return c}return null}}function s(a){var b=c,d=[];for(var e=0;e<a.length;e++){var f=a[e]();if(f===null)return c=b,null;d.push(f)}return d}function t(a,b){return function(){var d=c,e=[],f=b();while(f!==null)e.push(f),f=b();return e.length<a?(c=d,null):e}}function u(b){var d=b.length;return function(){var e=null;return a.substr(c,d)===b&&(e=b,c+=d),e}}function v(b){return function(){var d=a.substr(c).match(b);return d===null?null:(c+=d[0].length,d[0])}}function w(){var a=f();return a===null?(q(" -- failed n"),a):(a=parseInt(b,10),q(" -- passed n ",a),a)}function y(){var a=s([w,d,h,d,e]);return a===null?(q(" -- failed mod"),null):(q(" -- passed mod"),parseInt(a[0],10)%parseInt(a[4],10))}function z(){var a=s([d,j]);return a===null?(q(" -- failed not"),null):a[1]}function A(){var a=s([x,d,g,t(0,z),d,e]);return a!==null?(q(" -- passed is"),a[3][0]==="not"?a[0]!==parseInt(a[5],10):a[0]===parseInt(a[5],10)):(q(" -- failed is"),null)}function B(){var a=s([r([D,e]),t(0,C)]),b=[];return a!==null?(b=b.concat(a[0],a[1][0]),b):(q(" -- failed rangeList"),null)}function C(){var a=s([n,B]);return a!==null?a[1]:(q(" -- failed rangeTail"),null)}function D(){var a=s([e,m,e]);if(a!==null){q(" -- passed range");var b=[],c=parseInt(a[0],10),d=parseInt(a[2],10);for(i=c;i<=d;i++)b.push(i);return b}return q(" -- failed range"),null}function E(){var a=s([x,t(0,z),d,k,d,B]);if(a!==null){q(" -- passed _in");var b=a[5];for(var c=0;c<b.length;c++)if(parseInt(b[c],10)===a[0])return a[1][0]!=="not";return a[1][0]==="not"}return q(" -- failed _in "),null}function F(){var a=s([x,d,l,d,B]);if(a!==null){q(" -- passed within ");var b=a[4];return parseInt(b[0],10)<=a[0]&&a[0]<=parseInt(b[1],10)}return q(" -- failed within "),null}function H(){var a=s([G,d,p,d,J]);return a?(q(" -- passed and"),a[0]&&a[4]):(q(" -- failed and"),null)}function I(){var a=s([G,d,o,d,J]);return a?(q(" -- passed or"),a[0]||a[4]):(q(" -- failed or"),null)}function K(a){return parseFloat(a)%1===0}function L(){if(!K(b))return!1;var a=J();return a}var c=0,d=v(/^\s+/),e=v(/^\d+/),f=u("n"),g=u("is"),h=u("mod"),j=u("not"),k=u("in"),l=u("within"),m=u(".."),n=u(","),o=u("or"),p=u("and");q("pluralRuleParser",a,b);var x=r([y,w]),G=r([A,E,F]),J=r([H,I,G]),M=L();return M!==null&&c===a.length,M}(function(a,b,c){"use strict";var d=function(b){this.options=a.extend({},a.i18n.defaults,b),this.parser=this.options.parser,this.messageStore=this.options.messageStore,this.languages={},this.locale=this.options.locale,this.init()};d.prototype={init:function(){var b=this;this.messageStore.init(this.locale),String.prototype.toLocaleString=function(){var c=this.valueOf(),d=b.locale,e=0;while(d){var f=d.toLowerCase().split("-"),g=f.length;do{var h=f.slice(0,g).join("-");!b.messageStore.messages[h]&&b.options.messageLocationResolver&&b.messageStore.load(b.options.messageLocationResolver(h),h);var i=b.messageStore.get(h,c);if(i)return i;g--}while(g);if(d==="en")break;d=a.i18n.fallbacks[b.locale]&&a.i18n.fallbacks[b.locale][e]||b.options.fallbackLocale,b.log("Trying fallback locale for "+b.locale+": "+d),e++}return c},String.locale=this.locale},destroy:function(){a("body").data("i18n",null)},load:function(a,b){this.messageStore.load(a,b)},log:function(){var d=b.console!==c;d&&a.i18n.debug&&b.console.log.apply(b.console,arguments)},parse:function(b,c){var d=b.toLocaleString();return this.parser.language=a.i18n.languages[a.i18n().locale]||a.i18n.languages["default"],this.parser.parse(d,c)}},String.locale=String.locale||a("html").attr("lang");if(!String.locale)if(typeof b.navigator!==c){var e=b.navigator;String.locale=e.language||e.userLanguage||""}else String.locale="";a.i18n=function(b,e){var f=[],g=a("body").data("i18n"),h=typeof b=="object"&&b;return h&&h.locale&&g&&g.locale!==h.locale&&(String.locale=g.locale=h.locale),g||(a("body").data("i18n",g=new d(h)),a("[data-i18n]").each(function(b){var c=a(this);if(c.data("i18n")){var d=c.data("i18n"),e=a.i18n(d);e!==d&&c.text(e)}})),b?(e!==c&&(f=a.makeArray(arguments),f.shift()),typeof b=="string"?g.parse(b,f):g):g},a.fn.i18n=function(b){return this.each(function(){var b=a(this);if(b.data("i18n")){var c=b.data("i18n"),d=a.i18n(c);d!==c&&b.text(d)}else b.find("[data-i18n]").i18n()})};var f={parse:function(a,b){return a.replace(/\$(\d+)/g,function(a,d){var e=parseInt(d,10)-1;return b[e]!==c?b[e]:"$"+d})}};a.i18n.languages={},a.i18n.messageStore=a.i18n.messageStore||{},a.i18n.parser=f,a.i18n.parser.emitter={},a.i18n.debug=!1,a.i18n.defaults={locale:String.locale,fallbackLocale:"en",parser:a.i18n.parser,messageStore:a.i18n.messageStore,messageLocationResolver:null},a.i18n.Constructor=d,b._=b._||a.i18n})(jQuery,window),function(a,b,c){"use strict";var d=function(){this.messages={},this.sources={},this.locale=String.locale};d.prototype={init:function(b){this.locale=b;var c=this,d=a("link"),e=d.length;this.log("initializing for "+b);while(e--){var f=a(d[e]),g=(f.attr("rel")||"").toLowerCase().split(/\s+/);if(a.inArray("localizations",g)!==-1)c.load(f.attr("href"));else if(a.inArray("localization",g)!==-1){var h={};h[(f.attr("hreflang")||"").toLowerCase()]=f.attr("href"),c.load(h)}}},load:function(a,b){var c=this,d=Object.prototype.hasOwnProperty;if(!a){this.log("Resetting for locale"+b),c.messages={};return}var e=typeof a;if(b&&this.locale!==b){b in this.sources||(this.sources[b]=[]),this.log("Queueing: "+b+" Current locale "+this.locale),this.sources[b].push(a);return}if(arguments.length>0&&e!=="number")if(e==="string")this.log("Loading messages from: "+a),this.jsonMessageLoader(a).done(function(a,d){c.load(a,b),delete c.sources[b]});else{var f=a;for(var g in f){if(!d.call(f,g))continue;var h=typeof g;if(h==="string"&&b)c.log("["+b+"]["+g+"] : "+f[g]),c.messages[b]=c.messages[b]||[],c.messages[b][g]=f[g];else{var i=g;this.log("Loading locale: "+i),c.load(f[i],i)}}}},log:function(){var d=b.console!==c;d&&a.i18n.debug&&b.console.log.apply(b.console,arguments)},loadFromQueue:function(a){var b=this,c=b.sources[a];for(var d=0;d<c.length;d++)b.load(c[d],a);delete b.sources[a]},jsonMessageLoader:function(b){var c=this;return a.ajax({url:b,dataType:"json",async:!1}).fail(function(a,d,e){c.log("Error in loading messages from "+b+" Exception: "+e)})},get:function(a,b){return this.sources[a]&&(this.locale=a,this.loadFromQueue(a)),this.messages[a]&&this.messages[a][b]}},a.extend(a.i18n.messageStore,new d)}(jQuery,window),function(a,b){a.i18n=a.i18n||{},a.i18n.fallbacks={ab:["ru"],ace:["id"],aln:["sq"],als:["gsw","de"],an:["es"],anp:["hi"],arn:["es"],arz:["ar"],av:["ru"],ay:["es"],ba:["ru"],bar:["de"],"bat-smg":["sgs","lt"],bcc:["fa"],"be-x-old":["be-tarask"],bh:["bho"],bjn:["id"],bm:["fr"],bpy:["bn"],bqi:["fa"],bug:["id"],"cbk-zam":["es"],ce:["ru"],crh:["crh-latn"],"crh-cyrl":["ru"],csb:["pl"],cv:["ru"],"de-at":["de"],"de-ch":["de"],"de-formal":["de"],dsb:["de"],dtp:["ms"],egl:["it"],eml:["it"],ff:["fr"],fit:["fi"],"fiu-vro":["vro","et"],frc:["fr"],frp:["fr"],frr:["de"],fur:["it"],gag:["tr"],gan:["gan-hant","zh-hant","zh-hans"],"gan-hans":["zh-hans"],"gan-hant":["zh-hant","zh-hans"],gl:["pt"],glk:["fa"],gn:["es"],gsw:["de"],hif:["hif-latn"],hsb:["de"],ht:["fr"],ii:["zh-cn","zh-hans"],inh:["ru"],iu:["ike-cans"],jut:["da"],jv:["id"],kaa:["kk-latn","kk-cyrl"],kbd:["kbd-cyrl"],khw:["ur"],kiu:["tr"],kk:["kk-cyrl"],"kk-arab":["kk-cyrl"],"kk-latn":["kk-cyrl"],"kk-cn":["kk-arab","kk-cyrl"],"kk-kz":["kk-cyrl"],"kk-tr":["kk-latn","kk-cyrl"],kl:["da"],"ko-kp":["ko"],koi:["ru"],krc:["ru"],ks:["ks-arab"],ksh:["de"],ku:["ku-latn"],"ku-arab":["ckb"],kv:["ru"],lad:["es"],lb:["de"],lbe:["ru"],lez:["ru"],li:["nl"],lij:["it"],liv:["et"],lmo:["it"],ln:["fr"],ltg:["lv"],lzz:["tr"],mai:["hi"],"map-bms":["jv","id"],mg:["fr"],mhr:["ru"],min:["id"],mo:["ro"],mrj:["ru"],mwl:["pt"],myv:["ru"],mzn:["fa"],nah:["es"],nap:["it"],nds:["de"],"nds-nl":["nl"],"nl-informal":["nl"],no:["nb"],os:["ru"],pcd:["fr"],pdc:["de"],pdt:["de"],pfl:["de"],pms:["it"],pt:["pt-br"],"pt-br":["pt"],qu:["es"],qug:["qu","es"],rgn:["it"],rmy:["ro"],"roa-rup":["rup"],rue:["uk","ru"],ruq:["ruq-latn","ro"],"ruq-cyrl":["mk"],"ruq-latn":["ro"],sa:["hi"],sah:["ru"],scn:["it"],sg:["fr"],sgs:["lt"],sli:["de"],sr:["sr-ec"],srn:["nl"],stq:["de"],su:["id"],szl:["pl"],tcy:["kn"],tg:["tg-cyrl"],tt:["tt-cyrl","ru"],"tt-cyrl":["ru"],ty:["fr"],udm:["ru"],ug:["ug-arab"],uk:["ru"],vec:["it"],vep:["et"],vls:["nl"],vmf:["de"],vot:["fi"],vro:["et"],wa:["fr"],wo:["fr"],wuu:["zh-hans"],xal:["ru"],xmf:["ka"],yi:["he"],za:["zh-hans"],zea:["nl"],zh:["zh-hans"],"zh-classical":["lzh"],"zh-cn":["zh-hans"],"zh-hant":["zh-hans"],"zh-hk":["zh-hant","zh-hans"],"zh-min-nan":["nan"],"zh-mo":["zh-hk","zh-hant","zh-hans"],"zh-my":["zh-sg","zh-hans"],"zh-sg":["zh-hans"],"zh-tw":["zh-hant","zh-hans"],"zh-yue":["yue"]}}(jQuery),function(a){"use strict";var b=function(b){this.options=a.extend({},a.i18n.parser.defaults,b),this.language=a.i18n.languages[a.i18n().locale],this.emitter=a.i18n.parser.emitter};b.prototype={constructor:b,simpleParse:function(a,b){return a.replace(/\$(\d+)/g,function(a,c){var d=parseInt(c,10)-1;return b[d]!==undefined?b[d]:"$"+c})},parse:function(b,c){return b.indexOf("{{")<0?this.simpleParse(b,c):(this.emitter.language=a.i18n.languages[a.i18n().locale]||a.i18n.languages["default"],this.emitter.emit(this.ast(b),c))},ast:function(a){function c(a){return function(){for(var b=0;b<a.length;b++){var c=a[b]();if(c!==null)return c}return null}}function d(a){var c=b,d=[];for(var e=0;e<a.length;e++){var f=a[e]();if(f===null)return b=c,null;d.push(f)}return d}function e(a,c){return function(){var d=b,e=[],f=c();while(f!==null)e.push(f),f=c();return e.length<a?(b=d,null):e}}function f(c){var d=c.length;return function(){var e=null;return a.substr(b,d)===c&&(e=c,b+=d),e}}function g(c){return function(){var d=a.substr(b).match(c);return d===null?null:(b+=d[0].length,d[0])}}function q(a,b){return function(){var c=a();return c===null?null:b(c)}}function r(){var a=e(1,v)();return a===null?null:a.join("")}function s(){var a=e(1,w)();return a===null?null:a.join("")}function t(){var a=e(1,x)();return a===null?null:a.join("")}function u(){var a=d([j,k]);return a===null?null:a[1]}function y(){var a=d([l,m]);return a===null?null:["REPLACE",parseInt(a[1],10)-1]}function A(){var a=d([h,e(0,I)]);if(a===null)return null;var b=a[1];return b.length>1?["CONCAT"].concat(b):b[0]}function B(){var a=d([z,i,y]);return a===null?null:[a[0],a[2]]}function C(){var a=d([z,i,I]);return a===null?null:[a[0],a[2]]}function G(){var a=d([E,D,F]);return a===null?null:a[1]}function J(){var a=e(0,H)();return a===null?null:["CONCAT"].concat(a)}var b=0,h=f("|"),i=f(":"),j=f("\\"),k=g(/^./),l=f("$"),m=g(/^\d+/),n=g(/^[^{}\[\]$\\]/),o=g(/^[^{}\[\]$\\|]/),p=g(/^[^{}\[\]$\s]/),v=c([u,p]),w=c([u,o]),x=c([u,n]),z=q(g(/^[ !"$&'()*,.\/0-9;=?@A-Z\^_`a-z~\x80-\xFF+\-]+/),function(a){return a.toString()}),D=c([function(){var a=d([c([B,C]),e(0,A)]);return a===null?null:a[0].concat(a[1])},function(){var a=d([z,e(0,A)]);return a===null?null:[a[0]].concat(a[1])}]),E=f("{{"),F=f("}}"),H=c([G,y,t]),I=c([G,y,s]),K=J();return K}},a.extend(a.i18n.parser,new b)}(jQuery),function(a){"use strict";var b=function(){this.language=a.i18n.languages[a.i18n().locale]||a.i18n.languages["default"]};b.prototype={constructor:b,emit:function(b,c){var d=null,e=this;switch(typeof b){case"string":case"number":d=b;break;case"object":var f=a.map(b.slice(1),function(a){return e.emit(a,c)}),g=b[0].toLowerCase();if(typeof e[g]=="function")d=e[g](f,c);else throw new Error('unknown operation "'+g+'"');break;case"undefined":d="";break;default:throw new Error("unexpected type in AST: "+typeof b)}return d},concat:function(b){var c="";return a.each(b,function(a,b){c+=b}),c},replace:function(a,b){var c=parseInt(a[0],10);return c<b.length?b[c]:"$"+(c+1)},plural:function(a){var b=parseFloat(this.language.convertNumber(a[0],10)),c=a.slice(1);return c.length?this.language.convertPlural(b,c):""},gender:function(a){var b=a[0],c=a.slice(1);return this.language.gender(b,c)},grammar:function(a){var b=a[0],c=a[1];return c&&b&&this.language.convertGrammar(c,b)}},a.extend(a.i18n.parser.emitter,new b)}(jQuery),function(a){"use strict";var b={pluralRules:{gv:{one:"n mod 10 in 1..2 or n mod 20 is 0"},gu:{one:"n is 1"},rof:{one:"n is 1"},ga:{few:"n in 3..6",many:"n in 7..10",two:"n is 2",one:"n is 1"},gl:{one:"n is 1"},lg:{one:"n is 1"},lb:{one:"n is 1"},xog:{one:"n is 1"},ln:{one:"n in 0..1"},lo:"",brx:{one:"n is 1"},tr:"",ts:{one:"n is 1"},tn:{one:"n is 1"},to:"",lt:{few:"n mod 10 in 2..9 and n mod 100 not in 11..19",one:"n mod 10 is 1 and n mod 100 not in 11..19"},tk:{one:"n is 1"},th:"",ksb:{one:"n is 1"},te:{one:"n is 1"},ksh:{zero:"n is 0",one:"n is 1"},fil:{one:"n in 0..1"},haw:{one:"n is 1"},kcg:{one:"n is 1"},ssy:{one:"n is 1"},yo:"",de:{one:"n is 1"},ko:"",da:{one:"n is 1"},dz:"",dv:{one:"n is 1"},guw:{one:"n in 0..1"},shi:{few:"n in 2..10",one:"n within 0..1"},el:{one:"n is 1"},eo:{one:"n is 1"},en:{one:"n is 1"},ses:"",teo:{one:"n is 1"},ee:{one:"n is 1"},kde:"",fr:{one:"n within 0..2 and n is not 2"},eu:{one:"n is 1"},et:{one:"n is 1"},es:{one:"n is 1"},seh:{one:"n is 1"},ru:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},kl:{one:"n is 1"},sms:{two:"n is 2",one:"n is 1"},smn:{two:"n is 2",one:"n is 1"},smj:{two:"n is 2",one:"n is 1"},smi:{two:"n is 2",one:"n is 1"},fy:{one:"n is 1"},rm:{one:"n is 1"},ro:{few:"n is 0 OR n is not 1 AND n mod 100 in 1..19",one:"n is 1"},bn:{one:"n is 1"},sma:{two:"n is 2",one:"n is 1"},be:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},bg:{one:"n is 1"},ms:"",wa:{one:"n in 0..1"},ps:{one:"n is 1"},wo:"",bm:"",jv:"",bo:"",bh:{one:"n in 0..1"},kea:"",asa:{one:"n is 1"},cgg:{one:"n is 1"},br:{few:"n mod 10 in 3..4,9 and n mod 100 not in 10..19,70..79,90..99",many:"n mod 1000000 is 0 and n is not 0",two:"n mod 10 is 2 and n mod 100 not in 12,72,92",one:"n mod 10 is 1 and n mod 100 not in 11,71,91"},bs:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},ja:"",om:{one:"n is 1"},fa:"",vun:{one:"n is 1"},or:{one:"n is 1"},xh:{one:"n is 1"},nso:{one:"n in 0..1"},ca:{one:"n is 1"},cy:{few:"n is 3",zero:"n is 0",many:"n is 6",two:"n is 2",one:"n is 1"},cs:{few:"n in 2..4",one:"n is 1"},zh:"",lv:{zero:"n is 0",one:"n mod 10 is 1 and n mod 100 is not 11"},pt:{one:"n is 1"},wae:{one:"n is 1"},tl:{one:"n in 0..1"},chr:{one:"n is 1"},pa:{one:"n is 1"},ak:{one:"n in 0..1"},pl:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n is not 1 and n mod 10 in 0..1 or n mod 10 in 5..9 or n mod 100 in 12..14",one:"n is 1"},hr:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},am:{one:"n in 0..1"},ti:{one:"n in 0..1"},hu:"",hi:{one:"n in 0..1"},jmc:{one:"n is 1"},ha:{one:"n is 1"},he:{one:"n is 1"},mg:{one:"n in 0..1"},fur:{one:"n is 1"},bem:{one:"n is 1"},ml:{one:"n is 1"},mo:{few:"n is 0 OR n is not 1 AND n mod 100 in 1..19",one:"n is 1"},mn:{one:"n is 1"},mk:{one:"n mod 10 is 1 and n is not 11"},ur:{one:"n is 1"},bez:{one:"n is 1"},mt:{few:"n is 0 or n mod 100 in 2..10",many:"n mod 100 in 11..19",one:"n is 1"},uk:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},mr:{one:"n is 1"},ta:{one:"n is 1"},my:"",sah:"",ve:{one:"n is 1"},af:{one:"n is 1"},vi:"",is:{one:"n is 1"},iu:{two:"n is 2",one:"n is 1"},it:{one:"n is 1"},kn:"",ii:"",ar:{few:"n mod 100 in 3..10",zero:"n is 0",many:"n mod 100 in 11..99",two:"n is 2",one:"n is 1"},zu:{one:"n is 1"},saq:{one:"n is 1"},az:"",tzm:{one:"n in 0..1 or n in 11..99"},id:"",ig:"",pap:{one:"n is 1"},nl:{one:"n is 1"},nn:{one:"n is 1"},no:{one:"n is 1"},nah:{one:"n is 1"},nd:{one:"n is 1"},ne:{one:"n is 1"},ny:{one:"n is 1"},naq:{two:"n is 2",one:"n is 1"},nyn:{one:"n is 1"},kw:{two:"n is 2",one:"n is 1"},nr:{one:"n is 1"},tig:{one:"n is 1"},kab:{one:"n within 0..2 and n is not 2"},mas:{one:"n is 1"},rwk:{one:"n is 1"},kaj:{one:"n is 1"},lag:{zero:"n is 0",one:"n within 0..2 and n is not 0 and n is not 2"},syr:{one:"n is 1"},kk:{one:"n is 1"},ff:{one:"n within 0..2 and n is not 2"},fi:{one:"n is 1"},fo:{one:"n is 1"},ka:"",gsw:{one:"n is 1"},ckb:{one:"n is 1"},ss:{one:"n is 1"},sr:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},sq:{one:"n is 1"},sw:{one:"n is 1"},sv:{one:"n is 1"},km:"",st:{one:"n is 1"},sk:{few:"n in 2..4",one:"n is 1"},sh:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},so:{one:"n is 1"},sn:{one:"n is 1"},ku:{one:"n is 1"},sl:{few:"n mod 100 in 3..4",two:"n mod 100 is 2",one:"n mod 100 is 1"},sg:"",nb:{one:"n is 1"},se:{two:"n is 2",one:"n is 1"}},convertPlural:function(b,c){var d=0;if(!c||c.length===0)return"";var e=this.pluralRules[a.i18n().locale];return e?(d=this.getPluralForm(b,e),d=Math.min(d,c.length-1),c[d]):b===1?c[0]:c[1]},getPluralForm:function(a,b){var c=["zero","one","two","few","many","other"],d=0;for(var e=0;e<c.length;e++)if(b[c[e]]){if(pluralRuleParser(b[c[e]],a))return d;d++}return d},convertNumber:function(b,c){var d=this.digitTransformTable(a.i18n().locale),e=""+b,f="";if(!d)return b;if(c){if(parseFloat(b,10)===b)return b;var g=[];for(var h in d)g[d[h]]=h;d=g}for(var i=0;i<e.length;i++)d[e[i]]?f+=d[e[i]]:f+=e[i];return c?parseFloat(f,10):f},convertGrammar:function(a,b){return a+b},gender:function(a,b){if(!b||b.length===0)return"";while(b.length<2)b.push(b[b.length-1]);return a==="male"?b[0]:a==="female"?b[1]:b.length===3?b[2]:b[0]},digitTransformTable:function(a){var b={ar:"۰۱۲۳۴۵۶۷۸۹",ml:"൦൧൨൩൪൫൬൭൮൯",kn:"೦೧೨೩೪೫೬೭೮೯",lo:"໐໑໒໓໔໕໖໗໘໙",or:"୦୧୨୩୪୫୬୭୮୯",kh:"០១២៣៤៥៦៧៨៩",pa:"੦੧੨੩੪੫੬੭੮੯",gu:"૦૧૨૩૪૫૬૭૮૯",hi:"०१२३४५६७८९",my:"၀၁၂၃၄၅၆၇၈၉",ta:"௦௧௨௩௪௫௬௭௮௯",te:"౦౧౨౩౪౫౬౭౮౯",th:"๐๑๒๓๔๕๖๗๘๙",bo:"༠༡༢༣༤༥༦༧༨༩"};return b[a]?b[a].split(""):null}};a.extend(a.i18n.languages,{"default":b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){switch(b){case"instrumental":a="s "+a;break;case"lokativ":a="o "+a}return a}});a.extend(a.i18n.languages,{bs:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){switch(b){case"instrumental":a="z "+a;break;case"lokatiw":a="wo "+a}return a}});a.extend(a.i18n.languages,{dsb:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){var c=a.match(/[aou][^äöy]*$/i),d=a;a.match(/wiki$/i)&&(c=!1),a.match(/[bcdfghjklmnpqrstvwxz]$/i)&&(a+="i");switch(b){case"genitive":a+="n";break;case"elative":a+=c?"sta":"stä";break;case"partitive":a+=c?"a":"ä";break;case"illative":a+=a.substr(a.length-1)+"n";break;case"inessive":a+=c?"ssa":"ssä";break;default:a=d}return a}});a.extend(a.i18n.languages,{fi:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){if(b==="ainmlae")switch(a){case"an Domhnach":a="Dé Domhnaigh";break;case"an Luan":a="Dé Luain";break;case"an Mháirt":a="Dé Mháirt";break;case"an Chéadaoin":a="Dé Chéadaoin";break;case"an Déardaoin":a="Déardaoin";break;case"an Aoine":a="Dé hAoine";break;case"an Satharn":a="Dé Sathairn"}return a}});a.extend(a.i18n.languages,{ga:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){switch(b){case"prefixed":case"תחילית":a.substr(0,1)==="ו"&&a.substr(0,2)!=="וו"&&(a="ו"+a),a.substr(0,1)==="ה"&&(a=a.substr(1,a.length));if(a.substr(0,1)<"א"||a.substr(0,1)>"ת")a="־"+a}return a}});a.extend(a.i18n.languages,{he:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){switch(b){case"instrumental":a="z "+a;break;case"lokatiw":a="wo "+a}return a}});a.extend(a.i18n.languages,{hsb:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){switch(b){case"rol":a+="ról";break;case"ba":a+="ba";break;case"k":a+="k"}return a}});a.extend(a.i18n.languages,{hu:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){return b==="genitive"&&(a.substr(-1)==="ա"?a=a.substr(0,a.length-1)+"այի":a.substr(-1)==="ո"?a=a.substr(0,a.length-1)+"ոյի":a.substr(-4)==="գիրք"?a=a.substr(0,a.length-4)+"գրքի":a=a+"ի"),a}});a.extend(a.i18n.languages,{hy:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){switch(b){case"genitive":a=a.replace(/u[ms]$/i,"i"),a=a.replace(/ommunia$/i,"ommunium"),a=a.replace(/a$/i,"ae"),a=a.replace(/libri$/i,"librorum"),a=a.replace(/nuntii$/i,"nuntiorum"),a=a.replace(/tio$/i,"tionis"),a=a.replace(/ns$/i,"ntis"),a=a.replace(/as$/i,"atis"),a=a.replace(/es$/i,"ei");break;case"accusative":a=a.replace(/u[ms]$/i,"um"),a=a.replace(/ommunia$/i,"am"),a=a.replace(/a$/i,"ommunia"),a=a.replace(/libri$/i,"libros"),a=a.replace(/nuntii$/i,"nuntios"),a=a.replace(/tio$/i,"tionem"),a=a.replace(/ns$/i,"ntem"),a=a.replace(/as$/i,"atem"),a=a.replace(/es$/i,"em");break;case"ablative":a=a.replace(/u[ms]$/i,"o"),a=a.replace(/ommunia$/i,"ommunibus"),a=a.replace(/a$/i,"a"),a=a.replace(/libri$/i,"libris"),a=a.replace(/nuntii$/i,"nuntiis"),a=a.replace(/tio$/i,"tione"),a=a.replace(/ns$/i,"nte"),a=a.replace(/as$/i,"ate"),a=a.replace(/es$/i,"e")}return a}});a.extend(a.i18n.languages,{la:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){var c="мæ",d="",e="",f="";a.match(/тæ$/i)?(a=a.substring(0,a.length-1),c="æм"):a.match(/[аæеёиоыэюя]$/i)?d="й":a.match(/у$/i)?a.substring(a.length-2,a.length-1).match(/[аæеёиоыэюя]$/i)||(d="й"):a.match(/[бвгджзйклмнопрстфхцчшщьъ]$/i)||(e="-");switch(b){case"genitive":f=e+d+"ы";break;case"dative":f=e+d+"æн";break;case"allative":f=e+c;break;case"ablative":d==="й"?f=e+d+"æ":f=e+d+"æй";break;case"superessive":f=e+d+"ыл";break;case"equative":f=e+d+"ау";break;case"comitative":f=e+"имæ"}return a+f}});a.extend(a.i18n.languages,{os:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){return b==="genitive"&&a.substr(a.length-4)!=="вики"&&a.substr(a.length-4)!=="Вики"&&(a.substr(a.length-1)==="ь"?a=a.substr(0,a.length-1)+"я":a.substr(a.length-2)==="ия"?a=a.substr(0,a.length-2)+"ии":a.substr(a.length-2)==="ка"?a=a.substr(0,a.length-2)+"ки":a.substr(a.length-2)==="ти"?a=a.substr(0,a.length-2)+"тей":a.substr(a.length-2)==="ды"?a=a.substr(0,a.length-2)+"дов":a.substr(a.length-3)==="ник"&&(a=a.substr(0,a.length-3)+"ника")),a}});a.extend(a.i18n.languages,{ru:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){switch(b){case"mestnik":a="o "+a;break;case"orodnik":a="z "+a}return a}});a.extend(a.i18n.languages,{sl:b})}(jQuery),function(a){"use strict";var b=a.extend({},a.i18n.languages["default"],{convertGrammar:function(a,b){switch(b){case"genitive":a.substr(a.length-4)!=="вікі"&&a.substr(a.length-4)!=="Вікі"&&(a.substr(a.length-1)==="ь"?a=a.substr(0,a.length-1)+"я":a.substr(a.length-2)==="ія"?a=a.substr(0,a.length-2)+"ії":a.substr(a.length-2)==="ка"?a=a.substr(0,a.length-2)+"ки":a.substr(a.length-2)==="ти"?a=a.substr(0,a.length-2)+"тей":a.substr(a.length-2)==="ды"?a=a.substr(0,a.length-2)+"дов":a.substr(a.length-3)==="ник"&&(a=a.substr(0,a.length-3)+"ника"));break;case"accusative":a.substr(a.length-4)!=="вікі"&&a.substr(a.length-4)!=="Вікі"&&a.substr(a.length-2)==="ія"&&(a=a.substr(0,a.length-2)+"ію")}return a}});a.extend(a.i18n.languages,{uk:b})}(jQuery),typeof module!="undefined"&&module.exports&&(module.exports=pluralRuleParser); |