Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

i18next

Package Overview
Dependencies
Maintainers
1
Versions
517
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next - npm Package Compare versions

Comparing version 2.0.0-alpha.11 to 2.0.0-alpha.12

4

bin/index.js

@@ -1,2 +0,2 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.i18next=e()}}(function(){return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var i=e,o=t,a=n;s=l=u=void 0,r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var u=s.get;return void 0===u?void 0:u.call(a)}var l=Object.getPrototypeOf(i);if(null===l)return void 0;e=l,t=o,n=a,r=!0}},l=e("./utils"),c=i(l),f=e("./EventEmitter"),p=r(f),h=function(e){function t(e,n,r,i){var a=arguments.length<=4||void 0===arguments[4]?{}:arguments[4];o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.backend=e,this.cache=n,this.store=r,this.services=i,this.options=a,this.backend.init(i,a.backend,a),this.cache&&this.cache.init(i,a.cache,a)}return a(t,e),s(t,[{key:"load",value:function(e,t,n){var r=this;if("string"==typeof e&&(e=this.services.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]),this.cache&&this.options.cache.enabled&&this.cache.load(e,function(e,t){if(t)for(var n in t)for(var i in t[n])if("i18nStamp"!==i){var o=t[n][i];o&&r.store.addResourceBundle(n,i,o)}}),this.options.backend.allowMultiLoading&&this.backend.readMulti)!function(){var i=function s(r,i,o,a){var u=this;o||(o=0),a||(a=250),this.backend.readMulti(r,i,function(l,f){return l&&f&&5>o?void setTimeout(function(){s.call(u,r,i,o++,2*a)},a):(f&&e.forEach(function(e){t.forEach(function(t){var n=t.replace(/\./g,"###"),r=c.getPath(f,e+"."+n);r&&u.store.addResourceBundle(e,t,r)})}),u.cache&&u.options.cache.enabled&&u.cache.save(u.store.data),void n())})},o=[],a=[];e.forEach(function(e){var n=!0;t.forEach(function(t){r.store.hasResourceBundle(e,t)||(n=!1,a.indexOf(t)<0&&a.push(t))}),n||o.push(e)}),i.call(r,o,a)}();else{var i;!function(){var o=function(){i--,i||(this.cache&&this.options.cache.enabled&&this.cache.save(this.store.data),n())},a=function s(e,t,n,r){var i=this;n||(n=0),r||(r=250),this.backend.read(e,t,function(a,u){return a&&u&&5>n?void setTimeout(function(){s.call(i,e,t,n++,2*r)},r):(u&&i.store.addResourceBundle(e,t,u),void o.call(i))})};i=e.length*t.length,e.forEach(function(e){t.forEach(function(t){r.store.hasResourceBundle(e,t)?o.call(r):a.call(r,e,t)})})}()}}},{key:"saveMissing",value:function(e,t,n,r){this.backend.create&&this.backend.create(e,t,n,r),this.store.addResource(e[0],t,n,r)}}]),t}(p["default"]);n["default"]=h,t.exports=n["default"]},{"./EventEmitter":2,"./utils":13}],2:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(){r(this,e),this.observers={}}return i(e,[{key:"on",value:function(e,t){var n=this;e.split(" ").forEach(function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})}},{key:"off",value:function(e,t){var n=this;this.observers[e]&&this.observers[e].forEach(function(){if(t){var r=n.observers[e].indexOf(t);r>-1&&n.observers[e].splice(r,1)}else delete n.observers[e]})}},{key:"emit",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];this.observers[e]&&this.observers[e].forEach(function(e){e.apply(void 0,n)})}}]),e}();t.exports=o},{}],3:[function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=e("./utils"),s=r(a),u=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];i(this,e),this.init(t,!0)}return o(e,[{key:"init",value:function(e,t){void 0===e&&(e={}),t&&(this.options=e),e.interpolation||(e.interpolation={escapeValue:!0}),this.escapeValue=e.interpolation.escapeValue,this.prefix=e.interpolation.prefix?s.regexEscape(e.interpolation.prefix):e.interpolation.prefixEscaped||"{{",this.suffix=e.interpolation.suffix?s.regexEscape(e.interpolation.suffix):e.interpolation.suffixEscaped||"}}",this.unescapePrefix=e.interpolation.unescapeSuffix?"":e.interpolation.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":e.interpolation.unescapeSuffix||"",this.nestingPrefix=e.interpolation.nestingPrefix?s.regexEscape(e.interpolation.nestingPrefix):e.interpolation.nestingPrefixEscaped||"$t(",this.nestingSuffix=e.interpolation.nestingSuffix?s.regexEscape(e.interpolation.nestingSuffix):e.interpolation.nestingSuffixEscaped||")";var n=this.prefix+"(.+?)"+this.suffix;this.regexp=new RegExp(n,"g");var r=this.prefix+this.unescapePrefix+"(.+?)"+this.unescapeSuffix+this.suffix;this.regexpUnescape=new RegExp(r,"g");var i=this.nestingPrefix+"(.+?)"+this.nestingSuffix;this.nestingRegexp=new RegExp(i,"g")}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"interpolate",value:function(e,t){function n(e){return e.replace(/\$/g,"$$$$")}for(var r=void 0,i=void 0;r=this.regexpUnescape.exec(e);){var o=s.getPath(t,r[1].trim());e=e.replace(r[0],o)}for(;r=this.regexp.exec(e);)i=s.getPath(t,r[1].trim()),void 0!==i&&"string"!=typeof i&&(i=i.toString()),i||(i=""),i=n(this.escapeValue?s.escape(i):i),e=e.replace(r[0],i),this.regexp.lastIndex=0;return e}},{key:"nest",value:function(e,t,n){function r(e){return e.replace(/\$/g,"$$$$")}function i(e){if(e.indexOf(",")<0)return e;var t=e.split(",");e=t.shift();var r=t.join(",");r=this.interpolate(r,n);try{n=JSON.parse(r)}catch(i){}return e}for(var o=void 0,a=void 0;o=this.nestingRegexp.exec(e);)a=t(i.call(this,o[1].trim()),n),void 0!==a&&"string"!=typeof a&&(a=a.toString()),a||(a=""),a=r(this.escapeValue?s.escape(a):a),e=e.replace(o[0],a),this.regexp.lastIndex=0;return e}}]),e}();n["default"]=u,t.exports=n["default"]},{"./utils":13}],4:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(u){i=!0,o=u}finally{try{!r&&s["return"]&&s["return"]()}finally{if(i)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=e("./logger"),u=r(s),l=function(){function e(t){i(this,e),this.options=t,this.whitelist=this.options.whitelist||!1,this.logger=u["default"].create("codeUtils")}return a(e,[{key:"getLanguagePartFromCode",value:function(e){if(e.indexOf("-")<0)return e;var t=["nb-NO","nn-NO","nb-no","nn-no"],n=e.split("-");return this.formatLanguageCode(t.indexOf(e)>-1?n[1].toLowerCase():n[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=e.split("-"),n=o(t,2),r=n[0],i=n[1];return this.options.lowerCaseLng?r.toLowerCase()+"-"+i.toLowerCase():r.toLowerCase()+"-"+i.toUpperCase()}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return!this.whitelist||!this.whitelist.length||this.whitelist.indexOf(e)>-1?!0:!1}},{key:"toResolveHierarchy",value:function(e,t){var n=this;t=t||this.options.fallbackLng||[],"string"==typeof t&&(t=[t]);var r=[],i=function(e){n.isWhitelisted(e)?r.push(e):n.logger.warn("rejecting non-whitelisted language code: "+e)};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):i(this.formatLanguageCode(e)),t.forEach(function(e){r.indexOf(e)<0&&i(n.formatLanguageCode(e))}),r}}]),e}();n["default"]=l,t.exports=n["default"]},{"./logger":11}],5:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=e("./logger"),s=r(a),u=[["ach","Acholi",[1,2],1],["af","Afrikaans",[1,2],2],["ak","Akan",[1,2],1],["am","Amharic",[1,2],1],["an","Aragonese",[1,2],2],["ar","Arabic",[0,1,2,3,11,100],5],["arn","Mapudungun",[1,2],1],["ast","Asturian",[1,2],2],["ay","Aymará",[1],3],["az","Azerbaijani",[1,2],2],["be","Belarusian",[1,2,5],4],["bg","Bulgarian",[1,2],2],["bn","Bengali",[1,2],2],["bo","Tibetan",[1],3],["br","Breton",[1,2],1],["bs","Bosnian",[1,2,5],4],["ca","Catalan",[1,2],2],["cgg","Chiga",[1],3],["cs","Czech",[1,2,5],6],["csb","Kashubian",[1,2,5],7],["cy","Welsh",[1,2,3,8],8],["da","Danish",[1,2],2],["de","German",[1,2],2],["dev","Development Fallback",[1,2],2],["dz","Dzongkha",[1],3],["el","Greek",[1,2],2],["en","English",[1,2],2],["eo","Esperanto",[1,2],2],["es","Spanish",[1,2],2],["es_ar","Argentinean Spanish",[1,2],2],["et","Estonian",[1,2],2],["eu","Basque",[1,2],2],["fa","Persian",[1],3],["fi","Finnish",[1,2],2],["fil","Filipino",[1,2],1],["fo","Faroese",[1,2],2],["fr","French",[1,2],9],["fur","Friulian",[1,2],2],["fy","Frisian",[1,2],2],["ga","Irish",[1,2,3,7,11],10],["gd","Scottish Gaelic",[1,2,3,20],11],["gl","Galician",[1,2],2],["gu","Gujarati",[1,2],2],["gun","Gun",[1,2],1],["ha","Hausa",[1,2],2],["he","Hebrew",[1,2],2],["hi","Hindi",[1,2],2],["hr","Croatian",[1,2,5],4],["hu","Hungarian",[1,2],2],["hy","Armenian",[1,2],2],["ia","Interlingua",[1,2],2],["id","Indonesian",[1],3],["is","Icelandic",[1,2],12],["it","Italian",[1,2],2],["ja","Japanese",[1],3],["jbo","Lojban",[1],3],["jv","Javanese",[0,1],13],["ka","Georgian",[1],3],["kk","Kazakh",[1],3],["km","Khmer",[1],3],["kn","Kannada",[1,2],2],["ko","Korean",[1],3],["ku","Kurdish",[1,2],2],["kw","Cornish",[1,2,3,4],14],["ky","Kyrgyz",[1],3],["lb","Letzeburgesch",[1,2],2],["ln","Lingala",[1,2],1],["lo","Lao",[1],3],["lt","Lithuanian",[1,2,10],15],["lv","Latvian",[1,2,0],16],["mai","Maithili",[1,2],2],["mfe","Mauritian Creole",[1,2],1],["mg","Malagasy",[1,2],1],["mi","Maori",[1,2],1],["mk","Macedonian",[1,2],17],["ml","Malayalam",[1,2],2],["mn","Mongolian",[1,2],2],["mnk","Mandinka",[0,1,2],18],["mr","Marathi",[1,2],2],["ms","Malay",[1],3],["mt","Maltese",[1,2,11,20],19],["nah","Nahuatl",[1,2],2],["nap","Neapolitan",[1,2],2],["nb","Norwegian Bokmal",[1,2],2],["ne","Nepali",[1,2],2],["nl","Dutch",[1,2],2],["nn","Norwegian Nynorsk",[1,2],2],["no","Norwegian",[1,2],2],["nso","Northern Sotho",[1,2],2],["oc","Occitan",[1,2],1],["or","Oriya",[2,1],2],["pa","Punjabi",[1,2],2],["pap","Papiamento",[1,2],2],["pl","Polish",[1,2,5],7],["pms","Piemontese",[1,2],2],["ps","Pashto",[1,2],2],["pt","Portuguese",[1,2],2],["pt_br","Brazilian Portuguese",[1,2],2],["rm","Romansh",[1,2],2],["ro","Romanian",[1,2,20],20],["ru","Russian",[1,2,5],4],["sah","Yakut",[1],3],["sco","Scots",[1,2],2],["se","Northern Sami",[1,2],2],["si","Sinhala",[1,2],2],["sk","Slovak",[1,2,5],6],["sl","Slovenian",[5,1,2,3],21],["so","Somali",[1,2],2],["son","Songhay",[1,2],2],["sq","Albanian",[1,2],2],["sr","Serbian",[1,2,5],4],["su","Sundanese",[1],3],["sv","Swedish",[1,2],2],["sw","Swahili",[1,2],2],["ta","Tamil",[1,2],2],["te","Telugu",[1,2],2],["tg","Tajik",[1,2],1],["th","Thai",[1],3],["ti","Tigrinya",[1,2],1],["tk","Turkmen",[1,2],2],["tr","Turkish",[1,2],1],["tt","Tatar",[1],3],["ug","Uyghur",[1],3],["uk","Ukrainian",[1,2,5],4],["ur","Urdu",[1,2],2],["uz","Uzbek",[1,2],1],["vi","Vietnamese",[1],3],["wa","Walloon",[1,2],1],["wo","Wolof",[1],3],["yo","Yoruba",[1,2],2],["zh","Chinese",[1],3]],l={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)},5:function(e){return Number(0===e?0:1==e?1:2==e?2:e%100>=3&&10>=e%100?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&4>=e?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:7>e?2:11>e?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&20>e?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(10>e%100||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0===e||e%100>1&&11>e%100?1:e%100>10&&20>e%100?2:3)},20:function(e){return Number(1==e?0:0===e||e%100>0&&20>e%100?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)}},c=function(){function e(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];i(this,e),this.rules=function(){var e,t={};for(e=u.length;e--;)t[u[e][0]]={name:u[e][1],numbers:u[e][2],plurals:l[u[e][3]]};return t}(),this.languageUtils=t,this.options=n,this.logger=s["default"].create("pluralResolver")}return o(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){return this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length<=1?!1:!0}},{key:"getSuffix",value:function(e,t){var n=this.getRule(e);if(n){if(1===n.numbers.length)return"";var r=n.noAbs?n.plurals(t):n.plurals(Math.abs(t)),i=n.numbers[r];if(2===n.numbers.length&&1===n.numbers[0]&&(2===i?i="plural":1===i&&(i="")),"1.x.x"===this.options.compatibilityJSON){if(1===i)return"";if("number"==typeof i)return"_plural_"+i.toString()}return this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}return this.logger.warn("no plural rule found for: "+e),""}}]),e}();n["default"]=c,t.exports=n["default"]},{"./logger":11}],6:[function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var i=e,o=t,a=n;s=l=u=void 0,r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var u=s.get;return void 0===u?void 0:u.call(a)}var l=Object.getPrototypeOf(i);if(null===l)return void 0;e=l,t=o,n=a,r=!0}},l=e("./EventEmitter"),c=i(l),f=e("./utils"),p=r(f),h=function(e){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{ns:["translation"],defaultNS:"translation"}:arguments[1];o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.data=e,this.options=n}return a(t,e),s(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"cleanNamespace",value:function(e){return"string"==typeof e&&e.indexOf(".")>-1?e.replace(/\./g,"###"):e}},{key:"getResource",value:function(e,t,n){n&&t.indexOf(".")>-1&&(t=this.cleanNamespace(t));var r=e+"."+t;return n&&(r+="."+n),e.indexOf(".")>-1&&(r=e),p.getPath(this.data,r)}},{key:"addResource",value:function(e,t,n,r){var i=this.cleanNamespace(t),o=e+"."+i+"."+n;e.indexOf(".")>-1&&(o=e,r=t),this.addNamespaces(t),p.setPath(this.data,o,r)}},{key:"addResources",value:function(e,t,n){for(var r in n)"string"==typeof n[r]&&this.addResource(e,t,r,n[r])}},{key:"addResourceBundle",value:function(e,t,n,r){var i=this.cleanNamespace(t),o=e+"."+i;e.indexOf(".")>-1&&(o=e,r=n,n=t),this.addNamespaces(t);var a=p.getPath(this.data,o)||{};r?p.deepExtend(a,n):p.extend(a,n),p.setPath(this.data,o,a)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t]}},{key:"hasResourceBundle",value:function(e,t){return t=this.cleanNamespace(t),void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),t=this.cleanNamespace(t),"1.10.x"===this.options.compatibilityAPI?p.extend({},this.getResource(e,t))||{}:this.getResource(e,t)}},{key:"toJSON",value:function(){return this.data}}]),t}(c["default"]);n["default"]=h,t.exports=n["default"]},{"./EventEmitter":2,"./utils":13}],7:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=e("./utils"),u=i(s),l=e("./postProcessor"),c=r(l),f=e("./compatibility/1.10.x"),p=i(f),h=function(){function e(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];o(this,e),t.resourceStore&&(this.resourceStore=t.resourceStore),t.languageUtils&&(this.languageUtils=t.languageUtils),t.pluralResolver&&(this.pluralResolver=t.pluralResolver),t.interpolator&&(this.interpolator=t.interpolator),t.backendConnector&&(this.backendConnector=t.backendConnector),this.options=n}return a(e,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{interpolation:{}}:arguments[1];return void 0!==this.resolve(e,t)}},{key:"translate",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(t=t&&"object"!=typeof t?this.options.overloadTranslationOptionHandler(arguments):t||{},"1.10.x"===this.options.compatibilityAPI&&(t=p.convertTOptions(t)),void 0===e||null===e||""===e)return"";"number"==typeof e&&(e=String(e)),"string"==typeof e&&(e=[e]);var n=e[e.length-1];if("CIMode"===this.language)return n;var r=t.ns||this.options.defaultNS;if(n.indexOf(":")>-1){var i=n.split(":");r=i[0],n=i[1]}"string"==typeof r&&(r=[r]);var o=r[r.length-1],a=this.resolve(e,t),s=Object.prototype.toString.apply(a),u=["[object Number]","[object Function]","[object RegExp]"];if(a&&"string"!=typeof a&&u.indexOf(s)<0){if(!t.returnObjects&&!this.options.returnObjects)return this.options.returnedObjectHandler?this.options.returnedObjectHandler(n,a,t):"key '"+n+" ("+this.language+")' returned an object instead of string.";var l="[object Array]"===s?[]:{};for(var c in a)l[c]=this.translate(n+"."+c,t);a=l}else{var f=!1,h=!1;if(!this.isValidLookup(a)&&t.defaultValue&&(f=!0,a=t.defaultValue),this.isValidLookup(a)||(h=!0,a=n),this.options.saveMissing){var g=[];if("fallback"===this.options.saveMissingTo&&this.options.fallbackLng[0])for(var d=0;d<this.options.fallbackLng.length;d++)g.push(this.options.fallbackLng[d]);else"all"===this.options.saveMissingTo?g=this.languageUtils.toResolveHierarchy(t.lng||this.language):g.push(t.lng||this.language);this.options.missingKeyHandler?this.options.missingKeyHandler(g,o,n,a):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(g,o,n,a)}a=this.extendTranslation(a,n,t),this.options.appendNamespaceToMissingKey&&a===n&&(a=o+":"+n),h&&this.options.parseMissingKeyHandler&&(a=this.options.parseMissingKeyHandler(a))}return a}},{key:"extendTranslation",value:function(e,t,n){var r=this;n.interpolation&&this.interpolator.init(n),e=this.interpolator.nest(e,function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return r.translate.apply(r,t)},n);var i=n.replace&&"string"!=typeof n.replace?n.replace:n;this.options.interpolation.defaultVariables&&(i=u.defaults(i,this.options.interpolation.defaultVariables)),e=this.interpolator.interpolate(e,i),n.interpolation&&this.interpolator.reset();var o=n.postProcess||this.options.postProcess,a="string"==typeof o?[o]:o;return void 0!==e&&a&&a.length&&(e=c["default"].handle(a,e,t,n)),e}},{key:"resolve",value:function(e){var t=this,n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=void 0;return"string"==typeof e&&(e=[e]),e.forEach(function(e){if(!t.isValidLookup(r)){var i=n.ns||t.options.defaultNS;if(e.indexOf(":")>-1){var o=e.split(":");i=o[0],e=o[1]}"string"==typeof i&&(i=[i]),t.options.fallbackNS&&(i=i.concat(t.options.fallbackNS));var a=void 0!==n.count&&"string"!=typeof n.count,s=void 0!==n.context&&"string"==typeof n.context&&""!==n.context,u=t.languageUtils.toResolveHierarchy(n.lng||t.language);n.lngs&&(u=n.lngs),i.forEach(function(i){t.isValidLookup(r)||u.forEach(function(o){if(!t.isValidLookup(r)){var u=e,l=[u];s&&l.push(u+="_"+n.context),a&&l.push(u+=t.pluralResolver.getSuffix(o,n.count));for(var c=void 0;c=l.pop();)t.isValidLookup(r)||(r=t.getResource(o,i,c,n))}})})}}),r}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){arguments.length<=3||void 0===arguments[3]?{}:arguments[3];return this.resourceStore.getResource(e,t,n)}}]),e}();n["default"]=h,t.exports=n["default"]},{"./compatibility/1.10.x":8,"./postProcessor":12,"./utils":13}],8:[function(e,t,n){"use strict";function r(e){return e.interpolation={unescapeSuffix:"HTML"},e.interpolation.prefix=e.interpolationPrefix||"__",e.interpolation.suffix=e.interpolationSuffix||"__",e.interpolation.escapeValue=e.escapeInterpolation||!1,e.interpolation.nestingPrefix=e.reusePrefix||"$t(",e.interpolation.nestingSuffix=e.reuseSuffix||")",e.defaultVariables&&(e.interpolation.defaultVariables=e.defaultVariables),e}function i(e){return e.resStore&&(e.resources=e.resStore),e.ns&&e.ns.defaultNs?(e.defaultNS=e.ns.defaultNs,e.ns=e.ns.namespaces):e.defaultNS=e.ns||"translation",e.fallbackToDefaultNS&&e.defaultNS&&(e.fallbackNS=e.defaultNS),e.saveMissing=e.sendMissing,e.saveMissingTo=e.sendMissingTo||"current",e.returnNull=e.fallbackOnNull?!1:!0,e.returnEmptyString=e.fallbackOnEmpty?!1:!0,e.returnObjects=e.returnObjectTrees,e.returnedObjectHandler=e.objectTreeKeyHandler,e.parseMissingKeyHandler=e.parseMissingKey,e.appendNamespaceToMissingKey=!0,"sprintf"===e.shortcutFunction&&(e.overloadTranslationOptionHandler=function(e){for(var t=[],n=1;n<e.length;n++)t.push(e[n]);return{postProcess:"sprintf",sprintf:t}}),e.whitelist=e.lngWhitelist,e.preload=e.preload,"current"===e.load&&(e.load="currentOnly"),"unspecific"===e.load&&(e.load="languageOnly"),e.backend=e.backend||{},e.backend.loadPath=e.resGetPath||"locales/__lng__/__ns__.json",e.backend.addPath=e.resPostPath||"locales/add/__lng__/__ns__",e.backend.allowMultiLoading=e.dynamicLoad,e.cache=e.cache||{},e.cache.prefix="res_",e.cache.expirationTime=6048e5,e.cache.enabled=e.useLocalStorage?!0:!1,e=r(e)}function o(e){return(e.interpolationPrefix||e.interpolationSuffix||e.escapeInterpolation)&&(e=r(e)),e.returnObjects=e.returnObjectTrees,e}function a(e){e.lng=function(){return e.services.languageUtils.toResolveHierarchy(e.language)[0]},e.preload=e.loadLanguages,e.setLng=function(t,n,r){return"function"==typeof n&&(r=n,n={}),n.fixLng===!0&&r?r(null,e.getFixedT(t)):void e.changeLanguage(t,r)}}Object.defineProperty(n,"__esModule",{value:!0}),n.convertOptions=i,n.convertTOptions=o,n.appendBackwardsAPI=a},{}],9:[function(e,t,n){"use strict";function r(){return{ns:"translation",fallbackLng:"dev",fallbackNS:!1,whitelist:!1,load:"all",preload:!1,saveMissing:!1,saveMissingTo:"fallback",missingKeyHandler:!1,postProcess:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,returnedObjectHandler:o,parseMissingKeyHandler:o,appendNamespaceToMissingKey:!1,overloadTranslationOptionHandler:function(e){return{defaultValue:e[1]}},interpolation:{escapeValue:!1,prefix:"{{",suffix:"}}",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",defaultVariables:void 0}}}function i(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e}Object.defineProperty(n,"__esModule",{value:!0}),n.get=r,n.transformOptions=i;var o=function(){}},{}],10:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var i=e,o=t,a=n;s=l=u=void 0,r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var u=s.get;return void 0===u?void 0:u.call(a)}var l=Object.getPrototypeOf(i);if(null===l)return void 0;e=l,t=o,n=a,r=!0}},l=e("./utils"),c=i(l),f=e("./EventEmitter"),p=r(f),h=e("./ResourceStore"),g=r(h),d=e("./Translator"),v=r(d),y=e("./LanguageUtils"),b=r(y),m=e("./PluralResolver"),k=r(m),x=e("./Interpolator"),O=r(x),w=e("./BackendConnector"),P=r(w),_=e("./defaults"),S=e("./postProcessor"),N=r(S),j=e("./compatibility/1.10.x"),E=i(j),M=function(e){function t(e,n){void 0===e&&(e={}),o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.options=e,this.services={},n&&!this.isInitialized&&this.init(e,n)}return a(t,e),s(t,[{key:"init",value:function(e,t){var n=this;if("function"==typeof e&&(t=e,e={}),"1.10.x"===e.compatibilityAPI?this.options=c.defaults({},(0,_.transformOptions)(E.convertOptions(e)),(0,_.get)()):this.options=c.defaults(this.options,(0,_.transformOptions)(e),(0,_.get)()),t||(t=function(){}),!this.options.isClone){var r=new b["default"](this.options);this.store=new g["default"](this.options.resources,this.options);var i=this.services;i.resourceStore=this.store,i.languageUtils=r,i.pluralResolver=new k["default"](r,{prepend:"_",compatibilityJSON:this.options.compatibilityJSON}),i.interpolator=new O["default"](this.options),this.backend&&(i.backendConnector=new P["default"](this.backend,this.cache,i.resourceStore,i,this.options)),this.LanguageDetector&&(i.languageDetector=this.LanguageDetector,i.languageDetector.init(i,this.options.detection)),this.translator=new v["default"](this.services,this.options)}var o=["addResource","addResources","addResourceBundle","removeResourceBundle","hasResourceBundle","getResourceBundle"];o.forEach(function(e){n[e]=function(){return this.store[e].apply(this.store,arguments)}}),"1.10.x"===this.options.compatibilityAPI&&E.appendBackwardsAPI(this),this.changeLanguage(this.options.lng,t)}},{key:"loadResources",value:function(e){var t=this;e||(e=function(){});var n=function(n){e(n,function(){for(var e=arguments.length,n=Array(e),r=0;e>r;r++)n[r]=arguments[r];return t.t.apply(t,n)})};!this.options.resources&&this.services.backendConnector?!function(){var e=[],r=function(n){var r=t.services.languageUtils.toResolveHierarchy(n);r.forEach(function(t){e.indexOf(t)<0&&e.push(t)})};r(t.language),t.options.preload&&t.options.preload.forEach(function(e){r(e)}),t.services.backendConnector.load(e,t.options.ns,n)}():n(null)}},{key:"use",value:function(e){return"backend"===e.type&&(this.backend=e),"cache"===e.type&&(this.cache=e),"languageDetector"===e.type&&(this.LanguageDetector=e),"postProcessor"===e.type&&N["default"].addPostProcessor(e),this}},{key:"addPostProcessor",value:function(e,t){this.use({type:"postProcessor",name:e,process:t})}},{key:"changeLanguage",value:function(e,t){!e&&this.services.languageDetector&&(e=this.services.languageDetector.detect()),e&&(this.language=e,this.translator.changeLanguage(e),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage(e),this.emit("languageChanged",e)),this.loadResources(t)}},{key:"getFixedT",value:function(e){var t=this,n=function r(e,n){return n=n||{},n.lng=n.lng||r.lng,t.t(e,n)};return n.lng=e,n}},{key:"t",value:function(){return this.translator.translate.apply(this.translator,arguments)}},{key:"exists",value:function(){return this.translator.exists.apply(this.translator,arguments);
}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"loadNamespaces",value:function(e,t){var n=this;"string"==typeof e&&(e=[e]),e.forEach(function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)}),this.loadResources(t)}},{key:"loadLanguages",value:function(e,t){"string"==typeof e&&(e=[e]),this.options.preload=this.options.preload?this.options.preload.concat(e):e,this.loadResources(t)}},{key:"createInstance",value:function(e,n){return void 0===e&&(e={}),new t(e,n)}},{key:"cloneInstance",value:function(e,n){var r=this;void 0===e&&(e={});var i=new t(c.extend(e,this.options,{isClone:!0}),n),o=["store","translator","services","language"];return o.forEach(function(e){i[e]=r[e]}),i}}]),t}(p["default"]);n["default"]=new M,t.exports=n["default"]},{"./BackendConnector":1,"./EventEmitter":2,"./Interpolator":3,"./LanguageUtils":4,"./PluralResolver":5,"./ResourceStore":6,"./Translator":7,"./compatibility/1.10.x":8,"./defaults":9,"./postProcessor":12,"./utils":13}],11:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?"I18NEXT:":arguments[0];r(this,e),this.prefix=t}return i(e,[{key:"log",value:function(e){this._output("log",e)}},{key:"warn",value:function(e){this._output("warn",e)}},{key:"error",value:function(e){this._output("error",e)}},{key:"_output",value:function(e,t){"string"==typeof t[0]&&(t[0]=this.prefix+" "+t[0]),window.console&&window.console[e]&&window.console[e].apply(window.console,Array.prototype.slice.call(t))}}]),e}(),a=function(){function e(t,n){r(this,e),this.init(t,n),this.subs=[]}return i(e,[{key:"init",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{debug:!0}:arguments[1];this.logger=e||this.logger,this.options=t,this.logger||(this.logger=new o(t.prefix)),this.debug=t.debug||!0}},{key:"setDebug",value:function(e){this.debug=e,this.subs.forEach(function(t){t.setDebug(e)})}},{key:"log",value:function(){this.debug&&this.logger.log(arguments)}},{key:"warn",value:function(){this.debug&&this.logger.warn(arguments)}},{key:"error",value:function(){this.logger.error(arguments)}},{key:"create",value:function(t){var n=new e(new o(this.logger.prefix+":"+t+":"),this.options);return this.subs.push(n),n}}]),e}();n["default"]=new a,t.exports=n["default"]},{}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n["default"]={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r){var i=this;return e.forEach(function(e){i.processors[e]&&(t=i.processors[e].process(t,n,r))}),t}},t.exports=n["default"]},{}],13:[function(e,t,n){"use strict";function r(e,t,n){for(var r=t.split(".");r.length>1;){var i=r.shift();i.indexOf("###")>-1&&(i=i.replace(/###/g,".")),e[i]||(e[i]={}),e=e[i]}var o=r.shift();o.indexOf("###")>-1&&(o=o.replace(/###/g,".")),e[o]=n}function i(e,t){for(var n=t.split(".");n.length>1;){var r=n.shift();if(r.indexOf("###")>-1&&(r=r.replace(/###/g,".")),!e[r])return void 0;e=e[r]}return e[n.shift().replace(/###/g,".")]}function o(e){return f.call(p.call(arguments,1),function(t){if(t)for(var n in t)void 0===e[n]&&(e[n]=t[n])}),e}function a(e){return f.call(p.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e}function s(e,t){for(var n in t)n in e?s(e[n],t[n]):e[n]=t[n];return e}function u(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function l(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return h[e]}):e}Object.defineProperty(n,"__esModule",{value:!0}),n.setPath=r,n.getPath=i,n.defaults=o,n.extend=a,n.deepExtend=s,n.regexEscape=u,n.escape=l;var c=[],f=c.forEach,p=c.slice,h={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"}},{}]},{},[10])(10)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.i18next=e()}}(function(){return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var i=e,o=t,a=n;r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var u=s.get;return void 0===u?void 0:u.call(a)}var l=Object.getPrototypeOf(i);if(null===l)return void 0;e=l,t=o,n=a,r=!0,s=l=void 0}},l=e("./utils"),c=i(l),f=e("./EventEmitter"),p=r(f),h=function(e){function t(e,n,r,i){var a=arguments.length<=4||void 0===arguments[4]?{}:arguments[4];o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.backend=e,this.cache=n,this.store=r,this.services=i,this.options=a,this.pending={},this.backend.init(i,a.backend,a),this.cache&&this.cache.init(i,a.cache,a)}return a(t,e),s(t,[{key:"load",value:function(e,t,n){var r=this;"string"==typeof e&&(e=this.services.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]),this.cache&&this.options.cache.enabled&&this.cache.load(e,function(e,t){if(t)for(var n in t)for(var i in t[n])if("i18nStamp"!==i){var o=t[n][i];o&&r.store.addResourceBundle(n,i,o)}}),this.options.backend.allowMultiLoading&&this.backend.readMulti?!function(){var i=function u(e,t,r,i){var l=this;return r||(r=0),i||(i=250),e.length?void this.backend.readMulti(e,t,function(f,p){return f&&p&&5>r?void setTimeout(function(){u.call(l,e,t,r++,2*i)},i):(p&&a.forEach(function(n){s.forEach(function(r){var i=c.getPath(p,[n,r]);i&&(l.store.addResourceBundle(n,r,i),c.pushPath(o,[n],r)),c.setPath(l.pending,[e,t],!1)})}),l.cache&&l.options.cache.enabled&&l.cache.save(l.store.data),l.emit("loaded",o),void n(f))}):n()},o={},a=[],s=[];e.forEach(function(e){var n=!0;t.forEach(function(t){r.store.hasResourceBundle(e,t)||c.getPath(r.pending,[e,t])===!0||(n=!1,s.indexOf(t)<0&&s.push(t))}),n||a.push(e)}),a.forEach(function(e){s.forEach(function(t){c.setPath(r.pending,[e,t],!0)})}),i.call(r,a,s)}():!function(){var i=function(){a--,a||(this.cache&&this.options.cache.enabled&&this.cache.save(this.store.data),this.emit("loaded",s),n())},o=function u(e,t,n,r){var o=this;n||(n=0),r||(r=250),this.backend.read(e,t,function(a,l){return a&&l&&5>n?void setTimeout(function(){u.call(o,e,t,n++,2*r)},r):(c.setPath(o.pending,[e,t],!1),l&&(o.store.addResourceBundle(e,t,l),c.pushPath(s,[e],t)),void i.call(o))})},a=e.length*t.length,s={};e.forEach(function(e){t.forEach(function(t){r.store.hasResourceBundle(e,t)||c.getPath(r.pending,[e,t])===!0?i.call(r):(c.setPath(r.pending,[e,t],!0),o.call(r,e,t))})})}()}},{key:"saveMissing",value:function(e,t,n,r){this.backend.create&&this.backend.create(e,t,n,r),this.store.addResource(e[0],t,n,r)}}]),t}(p["default"]);n["default"]=h,t.exports=n["default"]},{"./EventEmitter":2,"./utils":13}],2:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(){r(this,e),this.observers={}}return i(e,[{key:"on",value:function(e,t){var n=this;e.split(" ").forEach(function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})}},{key:"off",value:function(e,t){var n=this;this.observers[e]&&this.observers[e].forEach(function(){if(t){var r=n.observers[e].indexOf(t);r>-1&&n.observers[e].splice(r,1)}else delete n.observers[e]})}},{key:"emit",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];this.observers[e]&&this.observers[e].forEach(function(e){e.apply(void 0,n)}),this.observers["*"]&&this.observers["*"].forEach(function(t){var r;t.apply(t,(r=[e]).concat.apply(r,n))})}}]),e}();t.exports=o},{}],3:[function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=e("./utils"),s=r(a),u=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];i(this,e),this.init(t,!0)}return o(e,[{key:"init",value:function(e,t){void 0===e&&(e={}),t&&(this.options=e),e.interpolation||(e.interpolation={escapeValue:!0}),this.escapeValue=e.interpolation.escapeValue,this.prefix=e.interpolation.prefix?s.regexEscape(e.interpolation.prefix):e.interpolation.prefixEscaped||"{{",this.suffix=e.interpolation.suffix?s.regexEscape(e.interpolation.suffix):e.interpolation.suffixEscaped||"}}",this.unescapePrefix=e.interpolation.unescapeSuffix?"":e.interpolation.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":e.interpolation.unescapeSuffix||"",this.nestingPrefix=e.interpolation.nestingPrefix?s.regexEscape(e.interpolation.nestingPrefix):e.interpolation.nestingPrefixEscaped||"$t(",this.nestingSuffix=e.interpolation.nestingSuffix?s.regexEscape(e.interpolation.nestingSuffix):e.interpolation.nestingSuffixEscaped||")";var n=this.prefix+"(.+?)"+this.suffix;this.regexp=new RegExp(n,"g");var r=this.prefix+this.unescapePrefix+"(.+?)"+this.unescapeSuffix+this.suffix;this.regexpUnescape=new RegExp(r,"g");var i=this.nestingPrefix+"(.+?)"+this.nestingSuffix;this.nestingRegexp=new RegExp(i,"g")}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"interpolate",value:function(e,t){function n(e){return e.replace(/\$/g,"$$$$")}for(var r=void 0,i=void 0;r=this.regexpUnescape.exec(e);){var o=s.getPath(t,r[1].trim());e=e.replace(r[0],o)}for(;r=this.regexp.exec(e);)i=s.getPath(t,r[1].trim()),void 0!==i&&"string"!=typeof i&&(i=i.toString()),i||(i=""),i=n(this.escapeValue?s.escape(i):i),e=e.replace(r[0],i),this.regexp.lastIndex=0;return e}},{key:"nest",value:function(e,t,n){function r(e){return e.replace(/\$/g,"$$$$")}function i(e){if(e.indexOf(",")<0)return e;var t=e.split(",");e=t.shift();var r=t.join(",");r=this.interpolate(r,n);try{n=JSON.parse(r)}catch(i){}return e}for(var o=void 0,a=void 0;o=this.nestingRegexp.exec(e);)a=t(i.call(this,o[1].trim()),n),void 0!==a&&"string"!=typeof a&&(a=a.toString()),a||(a=""),a=r(this.escapeValue?s.escape(a):a),e=e.replace(o[0],a),this.regexp.lastIndex=0;return e}}]),e}();n["default"]=u,t.exports=n["default"]},{"./utils":13}],4:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(u){i=!0,o=u}finally{try{!r&&s["return"]&&s["return"]()}finally{if(i)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=e("./logger"),u=r(s),l=function(){function e(t){i(this,e),this.options=t,this.whitelist=this.options.whitelist||!1,this.logger=u["default"].create("codeUtils")}return a(e,[{key:"getLanguagePartFromCode",value:function(e){if(e.indexOf("-")<0)return e;var t=["nb-NO","nn-NO","nb-no","nn-no"],n=e.split("-");return this.formatLanguageCode(t.indexOf(e)>-1?n[1].toLowerCase():n[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=e.split("-"),n=o(t,2),r=n[0],i=n[1];return this.options.lowerCaseLng?r.toLowerCase()+"-"+i.toLowerCase():r.toLowerCase()+"-"+i.toUpperCase()}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return!this.whitelist||!this.whitelist.length||this.whitelist.indexOf(e)>-1?!0:!1}},{key:"toResolveHierarchy",value:function(e,t){var n=this;t=t||this.options.fallbackLng||[],"string"==typeof t&&(t=[t]);var r=[],i=function(e){n.isWhitelisted(e)?r.push(e):n.logger.warn("rejecting non-whitelisted language code: "+e)};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):i(this.formatLanguageCode(e)),t.forEach(function(e){r.indexOf(e)<0&&i(n.formatLanguageCode(e))}),r}}]),e}();n["default"]=l,t.exports=n["default"]},{"./logger":11}],5:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=e("./logger"),s=r(a),u=[["ach","Acholi",[1,2],1],["af","Afrikaans",[1,2],2],["ak","Akan",[1,2],1],["am","Amharic",[1,2],1],["an","Aragonese",[1,2],2],["ar","Arabic",[0,1,2,3,11,100],5],["arn","Mapudungun",[1,2],1],["ast","Asturian",[1,2],2],["ay","Aymará",[1],3],["az","Azerbaijani",[1,2],2],["be","Belarusian",[1,2,5],4],["bg","Bulgarian",[1,2],2],["bn","Bengali",[1,2],2],["bo","Tibetan",[1],3],["br","Breton",[1,2],1],["bs","Bosnian",[1,2,5],4],["ca","Catalan",[1,2],2],["cgg","Chiga",[1],3],["cs","Czech",[1,2,5],6],["csb","Kashubian",[1,2,5],7],["cy","Welsh",[1,2,3,8],8],["da","Danish",[1,2],2],["de","German",[1,2],2],["dev","Development Fallback",[1,2],2],["dz","Dzongkha",[1],3],["el","Greek",[1,2],2],["en","English",[1,2],2],["eo","Esperanto",[1,2],2],["es","Spanish",[1,2],2],["es_ar","Argentinean Spanish",[1,2],2],["et","Estonian",[1,2],2],["eu","Basque",[1,2],2],["fa","Persian",[1],3],["fi","Finnish",[1,2],2],["fil","Filipino",[1,2],1],["fo","Faroese",[1,2],2],["fr","French",[1,2],9],["fur","Friulian",[1,2],2],["fy","Frisian",[1,2],2],["ga","Irish",[1,2,3,7,11],10],["gd","Scottish Gaelic",[1,2,3,20],11],["gl","Galician",[1,2],2],["gu","Gujarati",[1,2],2],["gun","Gun",[1,2],1],["ha","Hausa",[1,2],2],["he","Hebrew",[1,2],2],["hi","Hindi",[1,2],2],["hr","Croatian",[1,2,5],4],["hu","Hungarian",[1,2],2],["hy","Armenian",[1,2],2],["ia","Interlingua",[1,2],2],["id","Indonesian",[1],3],["is","Icelandic",[1,2],12],["it","Italian",[1,2],2],["ja","Japanese",[1],3],["jbo","Lojban",[1],3],["jv","Javanese",[0,1],13],["ka","Georgian",[1],3],["kk","Kazakh",[1],3],["km","Khmer",[1],3],["kn","Kannada",[1,2],2],["ko","Korean",[1],3],["ku","Kurdish",[1,2],2],["kw","Cornish",[1,2,3,4],14],["ky","Kyrgyz",[1],3],["lb","Letzeburgesch",[1,2],2],["ln","Lingala",[1,2],1],["lo","Lao",[1],3],["lt","Lithuanian",[1,2,10],15],["lv","Latvian",[1,2,0],16],["mai","Maithili",[1,2],2],["mfe","Mauritian Creole",[1,2],1],["mg","Malagasy",[1,2],1],["mi","Maori",[1,2],1],["mk","Macedonian",[1,2],17],["ml","Malayalam",[1,2],2],["mn","Mongolian",[1,2],2],["mnk","Mandinka",[0,1,2],18],["mr","Marathi",[1,2],2],["ms","Malay",[1],3],["mt","Maltese",[1,2,11,20],19],["nah","Nahuatl",[1,2],2],["nap","Neapolitan",[1,2],2],["nb","Norwegian Bokmal",[1,2],2],["ne","Nepali",[1,2],2],["nl","Dutch",[1,2],2],["nn","Norwegian Nynorsk",[1,2],2],["no","Norwegian",[1,2],2],["nso","Northern Sotho",[1,2],2],["oc","Occitan",[1,2],1],["or","Oriya",[2,1],2],["pa","Punjabi",[1,2],2],["pap","Papiamento",[1,2],2],["pl","Polish",[1,2,5],7],["pms","Piemontese",[1,2],2],["ps","Pashto",[1,2],2],["pt","Portuguese",[1,2],2],["pt_br","Brazilian Portuguese",[1,2],2],["rm","Romansh",[1,2],2],["ro","Romanian",[1,2,20],20],["ru","Russian",[1,2,5],4],["sah","Yakut",[1],3],["sco","Scots",[1,2],2],["se","Northern Sami",[1,2],2],["si","Sinhala",[1,2],2],["sk","Slovak",[1,2,5],6],["sl","Slovenian",[5,1,2,3],21],["so","Somali",[1,2],2],["son","Songhay",[1,2],2],["sq","Albanian",[1,2],2],["sr","Serbian",[1,2,5],4],["su","Sundanese",[1],3],["sv","Swedish",[1,2],2],["sw","Swahili",[1,2],2],["ta","Tamil",[1,2],2],["te","Telugu",[1,2],2],["tg","Tajik",[1,2],1],["th","Thai",[1],3],["ti","Tigrinya",[1,2],1],["tk","Turkmen",[1,2],2],["tr","Turkish",[1,2],1],["tt","Tatar",[1],3],["ug","Uyghur",[1],3],["uk","Ukrainian",[1,2,5],4],["ur","Urdu",[1,2],2],["uz","Uzbek",[1,2],1],["vi","Vietnamese",[1],3],["wa","Walloon",[1,2],1],["wo","Wolof",[1],3],["yo","Yoruba",[1,2],2],["zh","Chinese",[1],3]],l={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)},5:function(e){return Number(0===e?0:1==e?1:2==e?2:e%100>=3&&10>=e%100?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&4>=e?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&4>=e%10&&(10>e%100||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:7>e?2:11>e?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&20>e?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(10>e%100||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0===e||e%100>1&&11>e%100?1:e%100>10&&20>e%100?2:3)},20:function(e){return Number(1==e?0:0===e||e%100>0&&20>e%100?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)}},c=function(){function e(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];i(this,e),this.rules=function(){var e,t={};for(e=u.length;e--;)t[u[e][0]]={name:u[e][1],numbers:u[e][2],plurals:l[u[e][3]]};return t}(),this.languageUtils=t,this.options=n,this.logger=s["default"].create("pluralResolver")}return o(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){return this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length<=1?!1:!0}},{key:"getSuffix",value:function(e,t){var n=this.getRule(e);if(n){if(1===n.numbers.length)return"";var r=n.noAbs?n.plurals(t):n.plurals(Math.abs(t)),i=n.numbers[r];if(2===n.numbers.length&&1===n.numbers[0]&&(2===i?i="plural":1===i&&(i="")),"1.x.x"===this.options.compatibilityJSON){if(1===i)return"";if("number"==typeof i)return"_plural_"+i.toString()}return this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}return this.logger.warn("no plural rule found for: "+e),""}}]),e}();n["default"]=c,t.exports=n["default"]},{"./logger":11}],6:[function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var i=e,o=t,a=n;r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var u=s.get;return void 0===u?void 0:u.call(a)}var l=Object.getPrototypeOf(i);if(null===l)return void 0;e=l,t=o,n=a,r=!0,s=l=void 0}},l=e("./EventEmitter"),c=i(l),f=e("./utils"),p=r(f),h=function(e){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{ns:["translation"],defaultNS:"translation"}:arguments[1];o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.data=e,this.options=n}return a(t,e),s(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"getResource",value:function(e,t,n){var r=[e,t];return n&&"string"!=typeof n&&(r=r.concat(n)),n&&"string"==typeof n&&(r=r.concat(n.split("."))),e.indexOf(".")>-1&&(r=e.split(".")),p.getPath(this.data,r)}},{key:"addResource",value:function(e,t,n,r){var i=[e,t];n&&(i=i.concat(n.split("."))),e.indexOf(".")>-1&&(i=e.split("."),r=t,t=i[1]),this.addNamespaces(t),p.setPath(this.data,i,r)}},{key:"addResources",value:function(e,t,n){for(var r in n)"string"==typeof n[r]&&this.addResource(e,t,r,n[r])}},{key:"addResourceBundle",value:function(e,t,n,r){var i=[e,t];e.indexOf(".")>-1&&(i=e.split("."),r=n,n=t,t=i[1]),this.addNamespaces(t);var o=p.getPath(this.data,i)||{};r?p.deepExtend(o,n):p.extend(o,n),p.setPath(this.data,i,o)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t]}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"1.10.x"===this.options.compatibilityAPI?p.extend({},this.getResource(e,t))||{}:this.getResource(e,t)}},{key:"toJSON",value:function(){return this.data}}]),t}(c["default"]);n["default"]=h,t.exports=n["default"]},{"./EventEmitter":2,"./utils":13}],7:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var i=e,o=t,a=n;r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var u=s.get;return void 0===u?void 0:u.call(a)}var l=Object.getPrototypeOf(i);if(null===l)return void 0;e=l,t=o,n=a,r=!0,s=l=void 0}},l=e("./utils"),c=i(l),f=e("./EventEmitter"),p=r(f),h=e("./postProcessor"),g=r(h),d=e("./compatibility/1.10.x"),v=i(d),y=function(e){function t(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),e.resourceStore&&(this.resourceStore=e.resourceStore),e.languageUtils&&(this.languageUtils=e.languageUtils),e.pluralResolver&&(this.pluralResolver=e.pluralResolver),e.interpolator&&(this.interpolator=e.interpolator),e.backendConnector&&(this.backendConnector=e.backendConnector),this.options=n}return a(t,e),s(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{interpolation:{}}:arguments[1];return void 0!==this.resolve(e,t)}},{key:"translate",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(t=t&&"object"!=typeof t?this.options.overloadTranslationOptionHandler(arguments):t||{},"1.10.x"===this.options.compatibilityAPI&&(t=v.convertTOptions(t)),void 0===e||null===e||""===e)return"";"number"==typeof e&&(e=String(e)),"string"==typeof e&&(e=[e]);var n=e[e.length-1];if("CIMode"===this.language)return n;var r=t.ns||this.options.defaultNS;if(n.indexOf(":")>-1){var i=n.split(":");r=i[0],n=i[1]}"string"==typeof r&&(r=[r]);var o=r[r.length-1],a=this.resolve(e,t),s=Object.prototype.toString.apply(a),u=["[object Number]","[object Function]","[object RegExp]"];if(a&&"string"!=typeof a&&u.indexOf(s)<0){if(!t.returnObjects&&!this.options.returnObjects)return this.options.returnedObjectHandler?this.options.returnedObjectHandler(n,a,t):"key '"+n+" ("+this.language+")' returned an object instead of string.";var l="[object Array]"===s?[]:{};for(var c in a)l[c]=this.translate(n+"."+c,t);a=l}else{var f=!1,p=!1;if(!this.isValidLookup(a)&&t.defaultValue&&(f=!0,a=t.defaultValue),this.isValidLookup(a)||(p=!0,a=n),this.options.saveMissing){var h=[];if("fallback"===this.options.saveMissingTo&&this.options.fallbackLng[0])for(var g=0;g<this.options.fallbackLng.length;g++)h.push(this.options.fallbackLng[g]);else"all"===this.options.saveMissingTo?h=this.languageUtils.toResolveHierarchy(t.lng||this.language):h.push(t.lng||this.language);this.options.missingKeyHandler?this.options.missingKeyHandler(h,o,n,a):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(h,o,n,a),this.emit("missingKey",h,o,n,a)}a=this.extendTranslation(a,n,t),this.options.appendNamespaceToMissingKey&&a===n&&(a=o+":"+n),p&&this.options.parseMissingKeyHandler&&(a=this.options.parseMissingKeyHandler(a))}return a}},{key:"extendTranslation",value:function(e,t,n){var r=this;n.interpolation&&this.interpolator.init(n),e=this.interpolator.nest(e,function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return r.translate.apply(r,t)},n);var i=n.replace&&"string"!=typeof n.replace?n.replace:n;this.options.interpolation.defaultVariables&&(i=c.defaults(i,this.options.interpolation.defaultVariables)),e=this.interpolator.interpolate(e,i),n.interpolation&&this.interpolator.reset();var o=n.postProcess||this.options.postProcess,a="string"==typeof o?[o]:o;return void 0!==e&&a&&a.length&&(e=g["default"].handle(a,e,t,n)),e}},{key:"resolve",value:function(e){var t=this,n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=void 0;return"string"==typeof e&&(e=[e]),e.forEach(function(e){if(!t.isValidLookup(r)){var i=n.ns||t.options.defaultNS;if(e.indexOf(":")>-1){var o=e.split(":");i=o[0],e=o[1]}"string"==typeof i&&(i=[i]),t.options.fallbackNS&&(i=i.concat(t.options.fallbackNS));var a=void 0!==n.count&&"string"!=typeof n.count,s=void 0!==n.context&&"string"==typeof n.context&&""!==n.context,u=t.languageUtils.toResolveHierarchy(n.lng||t.language);n.lngs&&(u=n.lngs),i.forEach(function(i){t.isValidLookup(r)||u.forEach(function(o){if(!t.isValidLookup(r)){var u=e,l=[u];s&&l.push(u+="_"+n.context),a&&l.push(u+=t.pluralResolver.getSuffix(o,n.count));for(var c=void 0;c=l.pop();)t.isValidLookup(r)||(r=t.getResource(o,i,c,n))}})})}}),r}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){arguments.length<=3||void 0===arguments[3]?{}:arguments[3];return this.resourceStore.getResource(e,t,n)}}]),t}(p["default"]);n["default"]=y,t.exports=n["default"]},{"./EventEmitter":2,"./compatibility/1.10.x":8,"./postProcessor":12,"./utils":13}],8:[function(e,t,n){"use strict";function r(e){return e.interpolation={unescapeSuffix:"HTML"},e.interpolation.prefix=e.interpolationPrefix||"__",e.interpolation.suffix=e.interpolationSuffix||"__",e.interpolation.escapeValue=e.escapeInterpolation||!1,e.interpolation.nestingPrefix=e.reusePrefix||"$t(",e.interpolation.nestingSuffix=e.reuseSuffix||")",e.defaultVariables&&(e.interpolation.defaultVariables=e.defaultVariables),e}function i(e){return e.resStore&&(e.resources=e.resStore),e.ns&&e.ns.defaultNs?(e.defaultNS=e.ns.defaultNs,e.ns=e.ns.namespaces):e.defaultNS=e.ns||"translation",e.fallbackToDefaultNS&&e.defaultNS&&(e.fallbackNS=e.defaultNS),e.saveMissing=e.sendMissing,e.saveMissingTo=e.sendMissingTo||"current",e.returnNull=e.fallbackOnNull?!1:!0,e.returnEmptyString=e.fallbackOnEmpty?!1:!0,e.returnObjects=e.returnObjectTrees,e.returnedObjectHandler=e.objectTreeKeyHandler,e.parseMissingKeyHandler=e.parseMissingKey,e.appendNamespaceToMissingKey=!0,"sprintf"===e.shortcutFunction&&(e.overloadTranslationOptionHandler=function(e){for(var t=[],n=1;n<e.length;n++)t.push(e[n]);return{postProcess:"sprintf",sprintf:t}}),e.whitelist=e.lngWhitelist,e.preload=e.preload,"current"===e.load&&(e.load="currentOnly"),"unspecific"===e.load&&(e.load="languageOnly"),e.backend=e.backend||{},e.backend.loadPath=e.resGetPath||"locales/__lng__/__ns__.json",e.backend.addPath=e.resPostPath||"locales/add/__lng__/__ns__",e.backend.allowMultiLoading=e.dynamicLoad,e.cache=e.cache||{},e.cache.prefix="res_",e.cache.expirationTime=6048e5,e.cache.enabled=e.useLocalStorage?!0:!1,e=r(e)}function o(e){return(e.interpolationPrefix||e.interpolationSuffix||e.escapeInterpolation)&&(e=r(e)),e.returnObjects=e.returnObjectTrees,e}function a(e){e.lng=function(){return e.services.languageUtils.toResolveHierarchy(e.language)[0]},e.preload=e.loadLanguages,e.setLng=function(t,n,r){return"function"==typeof n&&(r=n,n={}),n.fixLng===!0&&r?r(null,e.getFixedT(t)):void e.changeLanguage(t,r)}}Object.defineProperty(n,"__esModule",{value:!0}),n.convertOptions=i,n.convertTOptions=o,n.appendBackwardsAPI=a},{}],9:[function(e,t,n){"use strict";function r(){return{ns:"translation",fallbackLng:"dev",fallbackNS:!1,whitelist:!1,load:"all",preload:!1,saveMissing:!1,saveMissingTo:"fallback",missingKeyHandler:!1,postProcess:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,returnedObjectHandler:o,parseMissingKeyHandler:o,appendNamespaceToMissingKey:!1,overloadTranslationOptionHandler:function(e){return{defaultValue:e[1]}},interpolation:{escapeValue:!1,prefix:"{{",suffix:"}}",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",defaultVariables:void 0}}}function i(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e}Object.defineProperty(n,"__esModule",{value:!0}),n.get=r,n.transformOptions=i;var o=function(){}},{}],10:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var i=e,o=t,a=n;r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var u=s.get;return void 0===u?void 0:u.call(a)}var l=Object.getPrototypeOf(i);if(null===l)return void 0;e=l,t=o,n=a,r=!0,s=l=void 0}},l=e("./utils"),c=i(l),f=e("./EventEmitter"),p=r(f),h=e("./ResourceStore"),g=r(h),d=e("./Translator"),v=r(d),y=e("./LanguageUtils"),b=r(y),m=e("./PluralResolver"),k=r(m),x=e("./Interpolator"),O=r(x),P=e("./BackendConnector"),w=r(P),_=e("./defaults"),S=e("./postProcessor"),j=r(S),E=e("./compatibility/1.10.x"),N=i(E),M=function(e){function t(e,n){void 0===e&&(e={}),o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).call(this),this.options=e,this.services={},n&&!this.isInitialized&&this.init(e,n)}return a(t,e),s(t,[{key:"init",value:function(e,t){function n(e){return"function"==typeof e?new e:e}var r=this;if("function"==typeof e&&(t=e,e={}),"1.10.x"===e.compatibilityAPI?this.options=c.defaults({},(0,_.transformOptions)(N.convertOptions(e)),(0,_.get)()):this.options=c.defaults(this.options,(0,_.transformOptions)(e),(0,_.get)()),t||(t=function(){}),!this.options.isClone){var i=new b["default"](this.options);this.store=new g["default"](this.options.resources,this.options);var o=this.services;o.resourceStore=this.store,o.languageUtils=i,o.pluralResolver=new k["default"](i,{prepend:"_",compatibilityJSON:this.options.compatibilityJSON}),o.interpolator=new O["default"](this.options),this.backend&&(o.backendConnector=new w["default"](n(this.backend),n(this.cache),o.resourceStore,o,this.options),o.backendConnector.on("*",function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];r.emit.apply(r,[e].concat(n))})),this.languageDetector&&(o.languageDetector=n(this.languageDetector),o.languageDetector.init(o,this.options.detection)),this.translator=new v["default"](this.services,this.options),this.translator.on("*",function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];r.emit.apply(r,[e].concat(n))})}var a=["addResource","addResources","addResourceBundle","removeResourceBundle","hasResourceBundle","getResourceBundle"];a.forEach(function(e){r[e]=function(){return this.store[e].apply(this.store,arguments)}}),"1.10.x"===this.options.compatibilityAPI&&N.appendBackwardsAPI(this),this.changeLanguage(this.options.lng,function(e,n){r.emit("initialized",r.options),
t(e,n)})}},{key:"loadResources",value:function(e){var t=this;e||(e=function(){}),!this.options.resources&&this.services.backendConnector?!function(){var n=[],r=function(e){var r=t.services.languageUtils.toResolveHierarchy(e);r.forEach(function(e){n.indexOf(e)<0&&n.push(e)})};r(t.language),t.options.preload&&t.options.preload.forEach(function(e){r(e)}),t.services.backendConnector.load(n,t.options.ns,e)}():e(null)}},{key:"use",value:function(e){return"backend"===e.type&&(this.backend=e),"cache"===e.type&&(this.cache=e),"languageDetector"===e.type&&(this.languageDetector=e),"postProcessor"===e.type&&j["default"].addPostProcessor(e),this}},{key:"addPostProcessor",value:function(e,t){this.use({type:"postProcessor",name:e,process:t})}},{key:"changeLanguage",value:function(e,t){var n=this,r=function(r){n.emit("languageChanged",e),t&&t(r,function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return n.t.apply(n,t)})};!e&&this.services.languageDetector&&(e=this.services.languageDetector.detect()),e&&(this.language=e,this.translator.changeLanguage(e),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage(e)),this.loadResources(function(e){r(e)})}},{key:"getFixedT",value:function(e){var t=this,n=function r(e,n){return n=n||{},n.lng=n.lng||r.lng,t.t(e,n)};return n.lng=e,n}},{key:"t",value:function(){return this.translator.translate.apply(this.translator,arguments)}},{key:"exists",value:function(){return this.translator.exists.apply(this.translator,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"loadNamespaces",value:function(e,t){var n=this;"string"==typeof e&&(e=[e]),e.forEach(function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)}),this.loadResources(t)}},{key:"loadLanguages",value:function(e,t){"string"==typeof e&&(e=[e]),this.options.preload=this.options.preload?this.options.preload.concat(e):e,this.loadResources(t)}},{key:"createInstance",value:function(e,n){return void 0===e&&(e={}),new t(e,n)}},{key:"cloneInstance",value:function(e,n){var r=this;void 0===e&&(e={});var i=new t(c.extend(e,this.options,{isClone:!0}),n),o=["store","translator","services","language"];return o.forEach(function(e){i[e]=r[e]}),i}}]),t}(p["default"]);n["default"]=new M,t.exports=n["default"]},{"./BackendConnector":1,"./EventEmitter":2,"./Interpolator":3,"./LanguageUtils":4,"./PluralResolver":5,"./ResourceStore":6,"./Translator":7,"./compatibility/1.10.x":8,"./defaults":9,"./postProcessor":12,"./utils":13}],11:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?"I18NEXT:":arguments[0];r(this,e),this.prefix=t}return i(e,[{key:"log",value:function(e){this._output("log",e)}},{key:"warn",value:function(e){this._output("warn",e)}},{key:"error",value:function(e){this._output("error",e)}},{key:"_output",value:function(e,t){"string"==typeof t[0]&&(t[0]=this.prefix+" "+t[0]),window.console&&window.console[e]&&window.console[e].apply(window.console,Array.prototype.slice.call(t))}}]),e}(),a=function(){function e(t,n){r(this,e),this.init(t,n),this.subs=[]}return i(e,[{key:"init",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{debug:!0}:arguments[1];this.logger=e||this.logger,this.options=t,this.logger||(this.logger=new o(t.prefix)),this.debug=t.debug||!0}},{key:"setDebug",value:function(e){this.debug=e,this.subs.forEach(function(t){t.setDebug(e)})}},{key:"log",value:function(){this.debug&&this.logger.log(arguments)}},{key:"warn",value:function(){this.debug&&this.logger.warn(arguments)}},{key:"error",value:function(){this.logger.error(arguments)}},{key:"create",value:function(t){var n=new e(new o(this.logger.prefix+":"+t+":"),this.options);return this.subs.push(n),n}}]),e}();n["default"]=new a,t.exports=n["default"]},{}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n["default"]={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r){var i=this;return e.forEach(function(e){i.processors[e]&&(t=i.processors[e].process(t,n,r))}),t}},t.exports=n["default"]},{}],13:[function(e,t,n){"use strict";function r(e,t,n){var r=void 0;for("string"!=typeof t&&(r=[].concat(t)),"string"==typeof t&&(r=t.split("."));r.length>1;){var i=r.shift();i.indexOf("###")>-1&&(i=i.replace(/###/g,".")),e[i]||(e[i]={}),e=e[i]}var o=r.shift();o.indexOf("###")>-1&&(o=o.replace(/###/g,".")),e[o]=n}function i(e,t,n,r){var i=void 0;for("string"!=typeof t&&(i=[].concat(t)),"string"==typeof t&&(i=t.split("."));i.length>1;){var o=i.shift();o.indexOf("###")>-1&&(o=o.replace(/###/g,".")),e[o]||(e[o]={}),e=e[o]}var a=i.shift();a.indexOf("###")>-1&&(a=a.replace(/###/g,".")),e[a]=e[a]||[],r&&(e[a]=e[a].concat(n)),r||e[a].push(n)}function o(e,t){var n=void 0;for("string"!=typeof t&&(n=[].concat(t)),"string"==typeof t&&(n=t.split("."));n.length>1;){var r=n.shift();if(r.indexOf("###")>-1&&(r=r.replace(/###/g,".")),!e[r])return void 0;e=e[r]}return e[n.shift().replace(/###/g,".")]}function a(e){return p.call(h.call(arguments,1),function(t){if(t)for(var n in t)void 0===e[n]&&(e[n]=t[n])}),e}function s(e){return p.call(h.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e}function u(e,t){for(var n in t)n in e?u(e[n],t[n]):e[n]=t[n];return e}function l(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function c(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return g[e]}):e}Object.defineProperty(n,"__esModule",{value:!0}),n.setPath=r,n.pushPath=i,n.getPath=o,n.defaults=a,n.extend=s,n.deepExtend=u,n.regexEscape=l,n.escape=c;var f=[],p=f.forEach,h=f.slice,g={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"}},{}]},{},[10])(10)});

@@ -42,2 +42,4 @@ 'use strict';

this.pending = {};
this.backend.init(services, options.backend, options);

@@ -56,2 +58,3 @@ if (this.cache) this.cache.init(services, options.cache, options);

// first try loading data from cache
if (this.cache && this.options.cache.enabled) {

@@ -72,2 +75,3 @@ this.cache.load(languages, function (err, data) {

// load with multi-load
if (this.options.backend.allowMultiLoading && this.backend.readMulti) {

@@ -81,2 +85,4 @@ (function () {

if (!lng.length) return callback(); // noting to load
this.backend.readMulti(lng, ns, function (err, data) {

@@ -91,7 +97,12 @@ if (err && data /* = retryFlag */ && tried < 5) {

if (data) {
languages.forEach(function (l) {
namespaces.forEach(function (n) {
var saveN = n.replace(/\./g, '###');
var bundle = utils.getPath(data, l + '.' + saveN);
if (bundle) _this2.store.addResourceBundle(l, n, bundle);
toLoadLanguages.forEach(function (l) {
toLoadNamespaces.forEach(function (n) {
var bundle = utils.getPath(data, [l, n]);
if (bundle) {
_this2.store.addResourceBundle(l, n, bundle);
utils.pushPath(loaded, [l], n);
}
// set not pending
utils.setPath(_this2.pending, [lng, ns], false);
// TODO: if !bundle log error

@@ -103,13 +114,16 @@ });

if (_this2.cache && _this2.options.cache.enabled) _this2.cache.save(_this2.store.data);
callback();
_this2.emit('loaded', loaded);
callback(err);
});
};
var loaded = {};
// find what needs to be loaded
var toLoadLanguages = [],
toLoadNamespaces = [];
languages.forEach(function (lng) {
var hasAllNamespaces = true;
namespaces.forEach(function (ns) {
if (!_this.store.hasResourceBundle(lng, ns)) {
if (!_this.store.hasResourceBundle(lng, ns) && utils.getPath(_this.pending, [lng, ns]) !== true) {
hasAllNamespaces = false;

@@ -124,49 +138,67 @@ if (toLoadNamespaces.indexOf(ns) < 0) toLoadNamespaces.push(ns);

// store pending loads
toLoadLanguages.forEach(function (lng) {
toLoadNamespaces.forEach(function (ns) {
utils.setPath(_this.pending, [lng, ns], true);
});
});
read.call(_this, toLoadLanguages, toLoadNamespaces);
})();
} else {
var todo;
}
(function () {
var done = function done() {
todo--;
if (!todo) {
if (this.cache && this.options.cache.enabled) this.cache.save(this.store.data);
callback();
}
};
// load one by one
else {
(function () {
var done = function done() {
todo--;
if (!todo) {
if (this.cache && this.options.cache.enabled) this.cache.save(this.store.data);
this.emit('loaded', loaded);
callback();
}
};
var read = function read(lng, ns, tried, wait) {
var _this3 = this;
var read = function read(lng, ns, tried, wait) {
var _this3 = this;
if (!tried) tried = 0;
if (!wait) wait = 250;
if (!tried) tried = 0;
if (!wait) wait = 250;
this.backend.read(lng, ns, function (err, data) {
if (err && data /*retryFlag*/ && tried < 5) {
setTimeout(function () {
read.call(_this3, lng, ns, tried++, wait * 2);
}, wait);
return;
}
this.backend.read(lng, ns, function (err, data) {
if (err && data /*retryFlag*/ && tried < 5) {
setTimeout(function () {
read.call(_this3, lng, ns, tried++, wait * 2);
}, wait);
return;
}
if (data) _this3.store.addResourceBundle(lng, ns, data);
done.call(_this3);
});
};
// set not pending
utils.setPath(_this3.pending, [lng, ns], false);
todo = languages.length * namespaces.length;
;
if (data) {
_this3.store.addResourceBundle(lng, ns, data);
utils.pushPath(loaded, [lng], ns);
}
done.call(_this3);
});
};
languages.forEach(function (lng) {
namespaces.forEach(function (ns) {
if (!_this.store.hasResourceBundle(lng, ns)) {
read.call(_this, lng, ns);
} else {
done.call(_this);
}
var todo = languages.length * namespaces.length;
var loaded = {};
;
languages.forEach(function (lng) {
namespaces.forEach(function (ns) {
if (!_this.store.hasResourceBundle(lng, ns) && utils.getPath(_this.pending, [lng, ns]) !== true) {
utils.setPath(_this.pending, [lng, ns], true);
read.call(_this, lng, ns);
} else {
done.call(_this);
}
});
});
});
})();
}
})();
}
}

@@ -173,0 +205,0 @@ }, {

@@ -51,9 +51,15 @@ 'use strict';

if (!this.observers[event]) {
return;
if (this.observers[event]) {
this.observers[event].forEach(function (observer) {
observer.apply(undefined, args);
});
}
this.observers[event].forEach(function (observer) {
observer.apply(undefined, args);
});
if (this.observers['*']) {
this.observers['*'].forEach(function (observer) {
var _ref;
observer.apply(observer, (_ref = [event]).concat.apply(_ref, args));
});
}
}

@@ -60,0 +66,0 @@ }]);

@@ -92,2 +92,7 @@ 'use strict';

function createClassOnDemand(ClassOrObject) {
if (typeof ClassOrObject === 'function') return new ClassOrObject();
return ClassOrObject;
}
// init services

@@ -103,5 +108,16 @@ if (!this.options.isClone) {

s.interpolator = new _Interpolator2['default'](this.options);
if (this.backend) s.backendConnector = new _BackendConnector2['default'](this.backend, this.cache, s.resourceStore, s, this.options);
if (this.LanguageDetector) {
s.languageDetector = this.LanguageDetector;
if (this.backend) {
s.backendConnector = new _BackendConnector2['default'](createClassOnDemand(this.backend), createClassOnDemand(this.cache), s.resourceStore, s, this.options);
// pipe events from backendConnector
s.backendConnector.on('*', function (event) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
_this.emit.apply(_this, [event].concat(args));
});
}
if (this.languageDetector) {
s.languageDetector = createClassOnDemand(this.languageDetector);
s.languageDetector.init(s, this.options.detection);

@@ -111,2 +127,10 @@ }

this.translator = new _Translator2['default'](this.services, this.options);
// pipe events from translator
this.translator.on('*', function (event) {
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
_this.emit.apply(_this, [event].concat(args));
});
}

@@ -125,3 +149,6 @@

this.changeLanguage(this.options.lng, callback);
this.changeLanguage(this.options.lng, function (err, t) {
_this.emit('initialized', _this.options);
callback(err, t);
});
}

@@ -135,12 +162,2 @@ }, {

var done = function done(err) {
callback(err, function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _this2.t.apply(_this2, args);
});
};
if (!this.options.resources && this.services.backendConnector) {

@@ -165,6 +182,6 @@ (function () {

_this2.services.backendConnector.load(toLoad, _this2.options.ns, done);
_this2.services.backendConnector.load(toLoad, _this2.options.ns, callback);
})();
} else {
done(null);
callback(null);
}

@@ -184,3 +201,3 @@ }

if (module.type === 'languageDetector') {
this.LanguageDetector = module;
this.languageDetector = module;
}

@@ -209,3 +226,17 @@

value: function changeLanguage(lng, callback) {
var _this3 = this;
var done = function done(err) {
_this3.emit('languageChanged', lng);
if (callback) callback(err, function () {
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return _this3.t.apply(_this3, args);
});
};
if (!lng && this.services.languageDetector) lng = this.services.languageDetector.detect();
if (lng) {

@@ -216,6 +247,7 @@ this.language = lng;

if (this.services.languageDetector) this.services.languageDetector.cacheUserLanguage(lng);
this.emit('languageChanged', lng);
}
this.loadResources(callback);
this.loadResources(function (err) {
done(err);
});
}

@@ -225,3 +257,3 @@ }, {

value: function getFixedT(lng) {
var _this3 = this;
var _this4 = this;

@@ -231,3 +263,3 @@ var fixedT = function fixedT(key, options) {

options.lng = options.lng || fixedT.lng;
return _this3.t(key, options);
return _this4.t(key, options);
};

@@ -255,3 +287,3 @@ fixedT.lng = lng;

value: function loadNamespaces(ns, callback) {
var _this4 = this;
var _this5 = this;

@@ -261,3 +293,3 @@ if (typeof ns === 'string') ns = [ns];

ns.forEach(function (n) {
if (_this4.options.ns.indexOf(n) < 0) _this4.options.ns.push(n);
if (_this5.options.ns.indexOf(n) < 0) _this5.options.ns.push(n);
});

@@ -285,3 +317,3 @@

value: function cloneInstance(options, callback) {
var _this5 = this;
var _this6 = this;

@@ -293,3 +325,3 @@ if (options === undefined) options = {};

membersToCopy.forEach(function (m) {
clone[m] = _this5[m];
clone[m] = _this6[m];
});

@@ -296,0 +328,0 @@

@@ -49,15 +49,10 @@ 'use strict';

}, {
key: 'cleanNamespace',
value: function cleanNamespace(ns) {
if (typeof ns === 'string' && ns.indexOf('.') > -1) return ns.replace(/\./g, '###');
return ns;
}
}, {
key: 'getResource',
value: function getResource(lng, ns, key) {
if (key && ns.indexOf('.') > -1) ns = this.cleanNamespace(ns); // escape '.' in namespace - will be unescaped in utils.getPath
var path = lng + '.' + ns;
if (key) path += '.' + key;
var path = [lng, ns];
if (key && typeof key !== 'string') path = path.concat(key);
if (key && typeof key === 'string') path = path.concat(key.split('.'));
if (lng.indexOf('.') > -1) {
path = lng;
path = lng.split('.');
}

@@ -70,16 +65,11 @@

value: function addResource(lng, ns, key, value) {
// todo: evtl. let this be handled somewhere outside
// if (typeof ns !== 'string') {
// resource = ns;
// ns = o.ns.defaultNs;
// } else if (o.ns.namespaces.indexOf(ns) < 0) {
// o.ns.namespaces.push(ns);
// }
var cleanedNs = this.cleanNamespace(ns); // escape '.' in namespace - will be unescaped in utils.getPath
var path = [lng, ns];
if (key) path = path.concat(key.split('.'));
var path = lng + '.' + cleanedNs + '.' + key;
if (lng.indexOf('.') > -1) {
path = lng;
path = lng.split('.');
value = ns;
ns = path[1];
}
this.addNamespaces(ns);

@@ -89,3 +79,3 @@

// todo: evtl. just emit event
// TODO: evtl. just emit event
// if (o.useLocalStorage) {

@@ -98,9 +88,2 @@ // sync._storeLocal(resStore);

value: function addResources(lng, ns, resources) {
// if (typeof ns !== 'string') {
// resource = ns;
// ns = o.ns.defaultNs;
// } else if (o.ns.namespaces.indexOf(ns) < 0) {
// o.ns.namespaces.push(ns);
// }
for (var m in resources) {

@@ -113,17 +96,10 @@ if (typeof resources[m] === 'string') this.addResource(lng, ns, m, resources[m]);

value: function addResourceBundle(lng, ns, resources, deep) {
// todo: evtl. let this be handled somewhere outside
// if (typeof ns !== 'string') {
// resources = ns;
// ns = o.ns.defaultNs;
// } else if (o.ns.namespaces.indexOf(ns) < 0) {
// o.ns.namespaces.push(ns);
// }
var cleanedNs = this.cleanNamespace(ns); // escape '.' in namespace - will be unescaped in utils.getPath
var path = lng + '.' + cleanedNs;
var path = [lng, ns];
if (lng.indexOf('.') > -1) {
path = lng;
path = lng.split('.');
deep = resources;
resources = ns;
ns = path[1];
}
this.addNamespaces(ns);

@@ -141,3 +117,3 @@

// todo: evtl. just emit event
// TODO: evtl. just emit event
// if (o.useLocalStorage) {

@@ -150,6 +126,2 @@ // sync._storeLocal(resStore);

value: function removeResourceBundle(lng, ns) {
// if (typeof ns !== 'string') {
// ns = o.ns.defaultNs;
// }
if (this.hasResourceBundle(lng, ns)) {

@@ -159,3 +131,3 @@ delete this.data[lng][ns];

// if (o.useLocalStorage) {
// TODO: if (o.useLocalStorage) {
// sync._storeLocal(resStore);

@@ -167,5 +139,2 @@ // }

value: function hasResourceBundle(lng, ns) {
ns = this.cleanNamespace(ns); // escape '.' in namespace - will be unescaped in utils.getPath
//console.log(lng, ns, this.getResource(lng, ns) !== undefined, this.data)
return this.getResource(lng, ns) !== undefined;

@@ -177,3 +146,2 @@ }

if (!ns) ns = this.options.defaultNS;
ns = this.cleanNamespace(ns); // escape '.' in namespace - will be unescaped in utils.getPath

@@ -180,0 +148,0 @@ // TODO: COMPATIBILITY remove extend in v2.1.0

@@ -9,2 +9,4 @@ 'use strict';

var _get = function get(_x6, _x7, _x8) { var _again = true; _function: while (_again) { var object = _x6, property = _x7, receiver = _x8; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x6 = parent; _x7 = property; _x8 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -16,2 +18,4 @@

function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _utils = require('./utils');

@@ -21,2 +25,6 @@

var _EventEmitter2 = require('./EventEmitter');
var _EventEmitter3 = _interopRequireDefault(_EventEmitter2);
var _postProcessor = require('./postProcessor');

@@ -30,3 +38,5 @@

var Translator = (function () {
var Translator = (function (_EventEmitter) {
_inherits(Translator, _EventEmitter);
function Translator(services) {

@@ -37,2 +47,4 @@ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

_get(Object.getPrototypeOf(Translator.prototype), 'constructor', this).call(this);
if (services.resourceStore) this.resourceStore = services.resourceStore;

@@ -147,2 +159,4 @@ if (services.languageUtils) this.languageUtils = services.languageUtils;

}
this.emit('missingKey', lngs, namespace, key, res);
}

@@ -264,5 +278,5 @@

return Translator;
})();
})(_EventEmitter3['default']);
exports['default'] = Translator;
module.exports = exports['default'];

@@ -7,2 +7,3 @@ 'use strict';

exports.setPath = setPath;
exports.pushPath = pushPath;
exports.getPath = getPath;

@@ -16,3 +17,5 @@ exports.defaults = defaults;

function setPath(object, path, newValue) {
var stack = path.split('.');
var stack = undefined;
if (typeof path !== 'string') stack = [].concat(path);
if (typeof path === 'string') stack = path.split('.');

@@ -31,4 +34,25 @@ while (stack.length > 1) {

function pushPath(object, path, newValue, concat) {
var stack = undefined;
if (typeof path !== 'string') stack = [].concat(path);
if (typeof path === 'string') stack = path.split('.');
while (stack.length > 1) {
var _key2 = stack.shift();
if (_key2.indexOf('###') > -1) _key2 = _key2.replace(/###/g, '.');
if (!object[_key2]) object[_key2] = {};
object = object[_key2];
}
var key = stack.shift();
if (key.indexOf('###') > -1) key = key.replace(/###/g, '.');
object[key] = object[key] || [];
if (concat) object[key] = object[key].concat(newValue);
if (!concat) object[key].push(newValue);
}
function getPath(object, path) {
var stack = path.split('.');
var stack = undefined;
if (typeof path !== 'string') stack = [].concat(path);
if (typeof path === 'string') stack = path.split('.');

@@ -35,0 +59,0 @@ while (stack.length > 1) {

{
"name": "i18next",
"version": "2.0.0-alpha.11",
"version": "2.0.0-alpha.12",
"description": "i18next internationalization framework",

@@ -41,6 +41,6 @@ "main": "./bin/index.js",

"gulp-uglify": "1.4.2",
"i18next-browser-languagedetector": "0.0.2",
"i18next-localstorage-cache": "0.0.1",
"i18next-sprintf-postprocessor": "0.0.3",
"i18next-xhr-backend": "0.0.1",
"i18next-browser-languagedetector": "0.0.9",
"i18next-localstorage-cache": "0.0.2",
"i18next-sprintf-postprocessor": "0.0.5",
"i18next-xhr-backend": "0.0.3",
"istanbul": "gotwarlost/istanbul#source-map",

@@ -47,0 +47,0 @@ "karma": "0.13.14",

@@ -16,5 +16,6 @@ [x] cache layer on backendConnector

[ ] usage of EventEmitter
[ ] finalize build, publish alpha
[ ] move cache, backend, detector, postProcessor to own repos/package.json
[x] finalize build, publish alpha
[x] move cache, backend, detector, postProcessor to own repos/package.json
[ ] update current i18next and add changes here - freece v1.10.x
[ ] move XHR test to repo -> expose lib on this so we could grab eg. interpolator there
[ ] think about reintroducing array joining in translation
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc