Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
// i18next, v1.10.2
// Copyright (c)2015 Jan Mühlemann (jamuhl).
// Distributed under MIT license
// http://i18next.com
!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd&&define([],b)}(this,function(){function a(a,b){if(!b||"function"==typeof b)return a;for(var c in b)a[c]=b[c];return a}function b(a,c){for(var d in c)d in a?b(a[d],c[d]):a[d]=c[d];return a}function c(a,b,c){var d,e=0,f=a.length,g=void 0===f||"[object Array]"!==Object.prototype.toString.apply(a)||"function"==typeof a;if(c)if(g){for(d in a)if(b.apply(a[d],c)===!1)break}else for(;f>e&&b.apply(a[e++],c)!==!1;);else if(g){for(d in a)if(b.call(a[d],d,a[d])===!1)break}else for(;f>e&&b.call(a[e],e,a[e++])!==!1;);return a}function d(a){return"string"==typeof a?a.replace(/[&<>"'\/]/g,function(a){return S[a]}):a}function e(a){var b=function(a){if(window.XMLHttpRequest)return a(null,new XMLHttpRequest);if(window.ActiveXObject)try{return a(null,new ActiveXObject("Msxml2.XMLHTTP"))}catch(b){return a(null,new ActiveXObject("Microsoft.XMLHTTP"))}return a(new Error)},c=function(a){if("string"==typeof a)return a;var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b.join("&")},d=function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b},e=function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a=d(a);var c,e,f,g,h,i,j,k="",l=0;do c=a.charCodeAt(l++),e=a.charCodeAt(l++),f=a.charCodeAt(l++),g=c>>2,h=(3&c)<<4|e>>4,i=(15&e)<<2|f>>6,j=63&f,isNaN(e)?i=j=64:isNaN(f)&&(j=64),k+=b.charAt(g)+b.charAt(h)+b.charAt(i)+b.charAt(j),c=e=f="",g=h=i=j="";while(l<a.length);return k},f=function(){for(var a=arguments[0],b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}return a},g=function(a,d,e,h){"function"==typeof e&&(h=e,e={}),e.cache=e.cache||!1,e.data=e.data||{},e.headers=e.headers||{},e.jsonp=e.jsonp||!1,e.async=void 0===e.async?!0:e.async;var i,j=f({accept:"*/*","content-type":"application/x-www-form-urlencoded;charset=UTF-8"},g.headers,e.headers);if(i="application/json"===j["content-type"]?JSON.stringify(e.data):c(e.data),"GET"===a){var k=[];if(i&&(k.push(i),i=null),e.cache||k.push("_="+(new Date).getTime()),e.jsonp&&(k.push("callback="+e.jsonp),k.push("jsonp="+e.jsonp)),k=k.join("&"),k.length>1&&(d+=d.indexOf("?")>-1?"&"+k:"?"+k),e.jsonp){var l=document.getElementsByTagName("head")[0],m=document.createElement("script");return m.type="text/javascript",m.src=d,void l.appendChild(m)}}b(function(b,c){if(b)return h(b);c.open(a,d,e.async);for(var f in j)j.hasOwnProperty(f)&&c.setRequestHeader(f,j[f]);c.onreadystatechange=function(){if(4===c.readyState){var a=c.responseText||"";if(!h)return;h(c.status,{text:function(){return a},json:function(){try{return JSON.parse(a)}catch(b){return V.error("Can not parse JSON. URL: "+d),{}}}})}},c.send(i)})},h={authBasic:function(a,b){g.headers.Authorization="Basic "+e(a+":"+b)},connect:function(a,b,c){return g("CONNECT",a,b,c)},del:function(a,b,c){return g("DELETE",a,b,c)},get:function(a,b,c){return g("GET",a,b,c)},head:function(a,b,c){return g("HEAD",a,b,c)},headers:function(a){g.headers=a||{}},isAllowed:function(a,b,c){this.options(a,function(a,d){c(-1!==d.text().indexOf(b))})},options:function(a,b,c){return g("OPTIONS",a,b,c)},patch:function(a,b,c){return g("PATCH",a,b,c)},post:function(a,b,c){return g("POST",a,b,c)},put:function(a,b,c){return g("PUT",a,b,c)},trace:function(a,b,c){return g("TRACE",a,b,c)}},i=a.type?a.type.toLowerCase():"get";h[i](a.url,a,function(b,c){200===b||0===b&&c.text()?a.success(c.json(),b,null):a.error(c.text(),b,null)})}function f(a,b){"function"==typeof a&&(b=a,a={}),a=a||{},V.extend(R,a),delete R.fixLng,R.functions&&(delete R.functions,V.extend(V,a.functions)),"string"==typeof R.ns&&(R.ns={namespaces:[R.ns],defaultNs:R.ns}),"string"==typeof R.fallbackNS&&(R.fallbackNS=[R.fallbackNS]),("string"==typeof R.fallbackLng||"boolean"==typeof R.fallbackLng)&&(R.fallbackLng=[R.fallbackLng]),R.interpolationPrefixEscaped=V.regexEscape(R.interpolationPrefix),R.interpolationSuffixEscaped=V.regexEscape(R.interpolationSuffix),R.lng||(R.lng=V.detectLanguage()),O=V.toLanguages(R.lng),J=O[0],V.log("currentLng set to: "+J),R.useCookie&&V.cookie.read(R.cookieName)!==J&&V.cookie.create(R.cookieName,J,R.cookieExpirationTime,R.cookieDomain),R.detectLngFromLocalStorage&&"undefined"!=typeof document&&window.localStorage&&V.localStorage.setItem("i18next_lng",J);var c=D;a.fixLng&&(c=function(a,b){return b=b||{},b.lng=b.lng||c.lng,D(a,b)},c.lng=J),Y.setCurrentLng(J),K&&R.setJqueryExt?v&&v():w&&w();var d;if(K&&K.Deferred&&(d=K.Deferred()),!R.resStore){var e=V.toLanguages(R.lng);"string"==typeof R.preload&&(R.preload=[R.preload]);for(var f=0,g=R.preload.length;g>f;f++)for(var h=V.toLanguages(R.preload[f]),i=0,j=h.length;j>i;i++)e.indexOf(h[i])<0&&e.push(h[i]);return L.sync.load(e,R,function(a,e){M=e,P=!0,b&&b(a,c),d&&(a?d.reject:d.resolve)(a||c)}),d?d.promise():void 0}return M=R.resStore,P=!0,b&&b(null,c),d&&d.resolve(c),d?d.promise():void 0}function g(){return P}function h(a,b){"string"==typeof a&&(a=[a]);for(var c=0,d=a.length;d>c;c++)R.preload.indexOf(a[c])<0&&R.preload.push(a[c]);return f(b)}function i(a,b,c,d){"string"!=typeof b?(c=b,b=R.ns.defaultNs):R.ns.namespaces.indexOf(b)<0&&R.ns.namespaces.push(b),M[a]=M[a]||{},M[a][b]=M[a][b]||{},d?V.deepExtend(M[a][b],c):V.extend(M[a][b],c),R.useLocalStorage&&Q._storeLocal(M)}function j(a,b){"string"!=typeof b&&(b=R.ns.defaultNs),M[a]=M[a]||{};var c=M[a][b]||{},d=!1;for(var e in c)c.hasOwnProperty(e)&&(d=!0);return d}function k(a,b){return"string"!=typeof b&&(b=R.ns.defaultNs),M[a]=M[a]||{},V.extend({},M[a][b])}function l(a,b){"string"!=typeof b&&(b=R.ns.defaultNs),M[a]=M[a]||{},M[a][b]={},R.useLocalStorage&&Q._storeLocal(M)}function m(a,b,c,d){"string"!=typeof b?(resource=b,b=R.ns.defaultNs):R.ns.namespaces.indexOf(b)<0&&R.ns.namespaces.push(b),M[a]=M[a]||{},M[a][b]=M[a][b]||{};for(var e=c.split(R.keyseparator),f=0,g=M[a][b];e[f];)f==e.length-1?g[e[f]]=d:(null==g[e[f]]&&(g[e[f]]={}),g=g[e[f]]),f++;R.useLocalStorage&&Q._storeLocal(M)}function n(a,b,c){"string"!=typeof b?(resource=b,b=R.ns.defaultNs):R.ns.namespaces.indexOf(b)<0&&R.ns.namespaces.push(b);for(var d in c)"string"==typeof c[d]&&m(a,b,d,c[d])}function o(a){R.ns.defaultNs=a}function p(a,b){q([a],b)}function q(a,b){var c={dynamicLoad:R.dynamicLoad,resGetPath:R.resGetPath,getAsync:R.getAsync,customLoad:R.customLoad,ns:{namespaces:a,defaultNs:""}},d=V.toLanguages(R.lng);"string"==typeof R.preload&&(R.preload=[R.preload]);for(var e=0,f=R.preload.length;f>e;e++)for(var g=V.toLanguages(R.preload[e]),h=0,i=g.length;i>h;h++)d.indexOf(g[h])<0&&d.push(g[h]);for(var j=[],k=0,l=d.length;l>k;k++){var m=!1,n=M[d[k]];if(n)for(var o=0,p=a.length;p>o;o++)n[a[o]]||(m=!0);else m=!0;m&&j.push(d[k])}j.length?L.sync._fetch(j,c,function(c,d){var e=a.length*j.length;V.each(a,function(a,c){R.ns.namespaces.indexOf(c)<0&&R.ns.namespaces.push(c),V.each(j,function(a,f){M[f]=M[f]||{},M[f][c]=d[f][c],e--,0===e&&b&&(R.useLocalStorage&&L.sync._storeLocal(M),b())})})}):b&&b()}function r(a,b,c){return"function"==typeof b?(c=b,b={}):b||(b={}),b.lng=a,f(b,c)}function s(){return J}function t(a){M={},r(J,a)}function u(){window.i18next=window.i18n,conflictReference?window.i18n=conflictReference:delete window.i18n}function v(){function a(a,b,c){if(0!==b.length){var d="text";if(0===b.indexOf("[")){var e=b.split("]");b=e[1],d=e[0].substr(1,e[0].length-1)}b.indexOf(";")===b.length-1&&(b=b.substr(0,b.length-2));var f;if("html"===d)f=R.defaultValueFromContent?K.extend({defaultValue:a.html()},c):c,a.html(K.t(b,f));else if("text"===d)f=R.defaultValueFromContent?K.extend({defaultValue:a.text()},c):c,a.text(K.t(b,f));else if("prepend"===d)f=R.defaultValueFromContent?K.extend({defaultValue:a.html()},c):c,a.prepend(K.t(b,f));else if("append"===d)f=R.defaultValueFromContent?K.extend({defaultValue:a.html()},c):c,a.append(K.t(b,f));else if(0===d.indexOf("data-")){var g=d.substr("data-".length);f=R.defaultValueFromContent?K.extend({defaultValue:a.data(g)},c):c;var h=K.t(b,f);a.data(g,h),a.attr(d,h)}else f=R.defaultValueFromContent?K.extend({defaultValue:a.attr(d)},c):c,a.attr(d,K.t(b,f))}}function b(b,c){var d=b.attr(R.selectorAttr);if(d||"undefined"==typeof d||d===!1||(d=b.text()||b.val()),d){var e=b,f=b.data("i18n-target");if(f&&(e=b.find(f)||b),c||R.useDataAttrOptions!==!0||(c=b.data("i18n-options")),c=c||{},d.indexOf(";")>=0){var g=d.split(";");K.each(g,function(b,d){""!==d&&a(e,d,c)})}else a(e,d,c);R.useDataAttrOptions===!0&&b.data("i18n-options",c)}}K.t=K.t||D,K.fn.i18n=function(a){return this.each(function(){b(K(this),a);var c=K(this).find("["+R.selectorAttr+"]");c.each(function(){b(K(this),a)})})}}function w(){function a(a,b,c){if(0!==b.length){var d="text";if(0===b.indexOf("[")){var e=b.split("]");b=e[1],d=e[0].substr(1,e[0].length-1)}b.indexOf(";")===b.length-1&&(b=b.substr(0,b.length-2)),"html"===d?a.innerHTML=D(b,c):"text"===d?a.textContent=D(b,c):"prepend"===d?a.insertAdjacentHTML(D(b,c),"afterbegin"):"append"===d?a.insertAdjacentHTML(D(b,c),"beforeend"):a.setAttribute(d,D(b,c))}}function b(b,c){var d=b.getAttribute(R.selectorAttr);if(d||"undefined"==typeof d||d===!1||(d=b.textContent||b.value),d){var e=b,f=b.getAttribute("i18n-target");if(f&&(e=b.querySelector(f)||b),d.indexOf(";")>=0)for(var g=d.split(";"),h=0,i=g.length;i>h;h++)""!==g[h]&&a(e,g[h],c);else a(e,d,c)}}L.translateObject=function(a,c){for(var d=a.querySelectorAll("["+R.selectorAttr+"]"),e=0,f=d.length;f>e;e++)b(d[e],c)}}function x(a,b,c,d){if(!a)return a;if(d=d||b,a.indexOf(d.interpolationPrefix||R.interpolationPrefix)<0)return a;var e=d.interpolationPrefix?V.regexEscape(d.interpolationPrefix):R.interpolationPrefixEscaped,f=d.interpolationSuffix?V.regexEscape(d.interpolationSuffix):R.interpolationSuffixEscaped,g="HTML"+f,h=b.replace&&"object"==typeof b.replace?b.replace:b;return V.each(h,function(b,h){var i=c?c+R.keyseparator+b:b;"object"==typeof h&&null!==h?a=x(a,h,i,d):d.escapeInterpolation||R.escapeInterpolation?(a=a.replace(new RegExp([e,i,g].join(""),"g"),V.regexReplacementEscape(h)),a=a.replace(new RegExp([e,i,f].join(""),"g"),V.regexReplacementEscape(V.escape(h)))):a=a.replace(new RegExp([e,i,f].join(""),"g"),V.regexReplacementEscape(h))}),a}function y(a,b){var c=",",d="{",e="}",f=V.extend({},b);for(delete f.postProcess;-1!=a.indexOf(R.reusePrefix)&&(N++,!(N>R.maxRecursion));){var g=a.lastIndexOf(R.reusePrefix),h=a.indexOf(R.reuseSuffix,g)+R.reuseSuffix.length,i=a.substring(g,h),j=i.replace(R.reusePrefix,"").replace(R.reuseSuffix,"");if(g>=h)return V.error("there is an missing closing in following translation value",a),"";if(-1!=j.indexOf(c)){var k=j.indexOf(c);if(-1!=j.indexOf(d,k)&&-1!=j.indexOf(e,k)){var l=j.indexOf(d,k),m=j.indexOf(e,l)+e.length;try{f=V.extend(f,JSON.parse(j.substring(l,m))),j=j.substring(0,k)}catch(n){}}}var o=G(j,f);a=a.replace(i,V.regexReplacementEscape(o))}return a}function z(a){return a.context&&("string"==typeof a.context||"number"==typeof a.context)}function A(a){return void 0!==a.count&&"string"!=typeof a.count}function B(a){return void 0!==a.indefinite_article&&"string"!=typeof a.indefinite_article&&a.indefinite_article}function C(a,b){b=b||{};var c=E(a,b),d=H(a,b);return void 0!==d||d===c}function D(a,b){return b=b||{},P?(N=0,G.apply(null,arguments)):(V.log("i18next not finished initialization. you might have called t function before loading resources finished."),b.defaultValue||"")}function E(a,b){return void 0!==b.defaultValue?b.defaultValue:a}function F(){for(var a=[],b=1;b<arguments.length;b++)a.push(arguments[b]);return{postProcess:"sprintf",sprintf:a}}function G(a,b){if(b&&"object"!=typeof b?"sprintf"===R.shortcutFunction?b=F.apply(null,arguments):"defaultValue"===R.shortcutFunction&&(b={defaultValue:b}):b=b||{},"object"==typeof R.defaultVariables&&(b=V.extend({},R.defaultVariables,b)),void 0===a||null===a||""===a)return"";"number"==typeof a&&(a=String(a)),"string"==typeof a&&(a=[a]);var c=a[0];if(a.length>1)for(var d=0;d<a.length&&(c=a[d],!C(c,b));d++);var e,f=E(c,b),g=H(c,b),h=b.lng?V.toLanguages(b.lng,b.fallbackLng):O,i=b.ns||R.ns.defaultNs;c.indexOf(R.nsseparator)>-1&&(e=c.split(R.nsseparator),i=e[0],c=e[1]),void 0===g&&R.sendMissing&&"function"==typeof R.missingKeyHandler&&(b.lng?R.missingKeyHandler(h[0],i,c,f,h):R.missingKeyHandler(R.lng,i,c,f,h));var j;j="string"==typeof R.postProcess&&""!==R.postProcess?[R.postProcess]:"array"==typeof R.postProcess||"object"==typeof R.postProcess?R.postProcess:[],"string"==typeof b.postProcess&&""!==b.postProcess?j=j.concat([b.postProcess]):("array"==typeof b.postProcess||"object"==typeof b.postProcess)&&(j=j.concat(b.postProcess)),void 0!==g&&j.length&&j.forEach(function(a){Z[a]&&(g=Z[a](g,c,b))});var k=f;if(f.indexOf(R.nsseparator)>-1&&(e=f.split(R.nsseparator),k=e[1]),k===c&&R.parseMissingKey&&(f=R.parseMissingKey(f)),void 0===g&&(f=x(f,b),f=y(f,b),j.length)){var l=E(c,b);j.forEach(function(a){Z[a]&&(g=Z[a](l,c,b))})}return void 0!==g?g:f}function H(a,b){b=b||{};var c,d,e=E(a,b),f=O;if(!M)return e;if("cimode"===f[0].toLowerCase())return e;if(b.lngs&&(f=b.lngs),b.lng&&(f=V.toLanguages(b.lng,b.fallbackLng),!M[f[0]])){var g=R.getAsync;R.getAsync=!1,L.sync.load(f,R,function(a,b){V.extend(M,b),R.getAsync=g})}var h=b.ns||R.ns.defaultNs;if(a.indexOf(R.nsseparator)>-1){var i=a.split(R.nsseparator);h=i[0],a=i[1]}if(z(b)){c=V.extend({},b),delete c.context,c.defaultValue=R.contextNotFound;var j=h+R.nsseparator+a+"_"+b.context;if(d=D(j,c),d!=R.contextNotFound)return x(d,{context:b.context})}if(A(b,f[0])){c=V.extend({lngs:[f[0]]},b),delete c.count,c._origLng=c._origLng||c.lng||f[0],delete c.lng,c.defaultValue=R.pluralNotFound;var k;if(Y.needsPlural(f[0],b.count)){k=h+R.nsseparator+a+R.pluralSuffix;var l=Y.get(f[0],b.count);l>=0?k=k+"_"+l:1===l&&(k=h+R.nsseparator+a)}else k=h+R.nsseparator+a;if(d=D(k,c),d!=R.pluralNotFound)return x(d,{count:b.count,interpolationPrefix:b.interpolationPrefix,interpolationSuffix:b.interpolationSuffix});if(!(f.length>1))return c.lng=c._origLng,delete c._origLng,d=D(h+R.nsseparator+a,c),x(d,{count:b.count,interpolationPrefix:b.interpolationPrefix,interpolationSuffix:b.interpolationSuffix});var m=f.slice();if(m.shift(),b=V.extend(b,{lngs:m}),b._origLng=c._origLng,delete b.lng,d=D(h+R.nsseparator+a,b),d!=R.pluralNotFound)return d}if(B(b)){var n=V.extend({},b);delete n.indefinite_article,n.defaultValue=R.indefiniteNotFound;var o=h+R.nsseparator+a+(b.count&&!A(b,f[0])||!b.count?R.indefiniteSuffix:"");if(d=D(o,n),d!=R.indefiniteNotFound)return d}for(var p,q=a.split(R.keyseparator),r=0,s=f.length;s>r&&void 0===p;r++){for(var t=f[r],u=0,v=M[t]&&M[t][h];q[u];)v=v&&v[q[u]],u++;if(void 0!==v&&(!R.showKeyIfEmpty||""!==v)){var w=Object.prototype.toString.apply(v);if("string"==typeof v)v=x(v,b),v=y(v,b);else if("[object Array]"!==w||R.returnObjectTrees||b.returnObjectTrees){if(null===v&&R.fallbackOnNull===!0)v=void 0;else if(null!==v)if(R.returnObjectTrees||b.returnObjectTrees){if("[object Number]"!==w&&"[object Function]"!==w&&"[object RegExp]"!==w){var C="[object Array]"===w?[]:{};V.each(v,function(c){C[c]=G(h+R.nsseparator+a+R.keyseparator+c,b)}),v=C}}else R.objectTreeKeyHandler&&"function"==typeof R.objectTreeKeyHandler?v=R.objectTreeKeyHandler(a,v,t,h,b):(v="key '"+h+":"+a+" ("+t+")' returned an object instead of string.",V.log(v))}else v=v.join("\n"),v=x(v,b),v=y(v,b);"string"==typeof v&&""===v.trim()&&R.fallbackOnEmpty===!0&&(v=void 0),p=v}}if(void 0===p&&!b.isFallbackLookup&&(R.fallbackToDefaultNS===!0||R.fallbackNS&&R.fallbackNS.length>0)){if(b.isFallbackLookup=!0,R.fallbackNS.length){for(var F=0,I=R.fallbackNS.length;I>F;F++)if(p=H(R.fallbackNS[F]+R.nsseparator+a,b),p||""===p&&R.fallbackOnEmpty===!1){var J=p.indexOf(R.nsseparator)>-1?p.split(R.nsseparator)[1]:p,K=e.indexOf(R.nsseparator)>-1?e.split(R.nsseparator)[1]:e;if(J!==K)break}}else b.ns=R.ns.defaultNs,p=H(a,b);b.isFallbackLookup=!1}return p}function I(){var a,b=R.lngWhitelist||[],c=[];if("undefined"!=typeof window&&!function(){for(var a=window.location.search.substring(1),b=a.split("&"),d=0;d<b.length;d++){var e=b[d].indexOf("=");if(e>0){var f=b[d].substring(0,e);f==R.detectLngQS&&c.push(b[d].substring(e+1))}}}(),R.useCookie&&"undefined"!=typeof document){var d=V.cookie.read(R.cookieName);d&&c.push(d)}if(R.detectLngFromLocalStorage&&"undefined"!=typeof window&&window.localStorage){var e=V.localStorage.getItem("i18next_lng");e&&c.push(e)}if("undefined"!=typeof navigator){if(navigator.languages)for(var f=0;f<navigator.languages.length;f++)c.push(navigator.languages[f]);navigator.userLanguage&&c.push(navigator.userLanguage),navigator.language&&c.push(navigator.language)}return function(){for(var d=0;d<c.length;d++){var e=c[d];if(e.indexOf("-")>-1){var f=e.split("-");e=R.lowerCaseLng?f[0].toLowerCase()+"-"+f[1].toLowerCase():f[0].toLowerCase()+"-"+f[1].toUpperCase()}if(0===b.length||b.indexOf(e)>-1){a=e;break}}}(),a||(a=R.fallbackLng[0]),a}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:0!=d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(a){"use strict";if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=c;arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!=d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));for(var e=d>=0?Math.min(d,c-1):c-Math.abs(d);e>=0;e--)if(e in b&&b[e]===a)return e;return-1}),"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var J,K=void 0,L={},M={},N=0,O=[],P=!1,Q={};Q={load:function(a,b,c){b.useLocalStorage?Q._loadLocal(a,b,function(d,e){for(var f=[],g=0,h=a.length;h>g;g++)e[a[g]]||f.push(a[g]);f.length>0?Q._fetch(f,b,function(a,b){V.extend(e,b),Q._storeLocal(b),c(a,e)}):c(d,e)}):Q._fetch(a,b,function(a,b){c(a,b)})},_loadLocal:function(a,b,c){var d={},e=(new Date).getTime();if(window.localStorage){var f=a.length;V.each(a,function(a,g){var h=V.localStorage.getItem("res_"+g);h&&(h=JSON.parse(h),h.i18nStamp&&h.i18nStamp+b.localStorageExpirationTime>e&&(d[g]=h)),f--,0===f&&c(null,d)})}},_storeLocal:function(a){if(window.localStorage)for(var b in a)a[b].i18nStamp=(new Date).getTime(),V.localStorage.setItem("res_"+b,JSON.stringify(a[b]))},_fetch:function(a,b,c){var d=b.ns,e={};if(b.dynamicLoad){var f=function(a,b){c(a,b)};if("function"==typeof b.customLoad)b.customLoad(a,d.namespaces,b,f);else{var g=x(b.resGetPath,{lng:a.join("+"),ns:d.namespaces.join("+")});V.ajax({url:g,cache:b.cache,success:function(a){V.log("loaded: "+g),f(null,a)},error:function(a,b,c){V.log("failed loading: "+g),f("failed loading resource.json error: "+c)},dataType:"json",async:b.getAsync,timeout:b.ajaxTimeout})}}else{var h,i=d.namespaces.length*a.length;V.each(d.namespaces,function(d,f){V.each(a,function(a,d){var g=function(a,b){a&&(h=h||[],h.push(a)),e[d]=e[d]||{},e[d][f]=b,i--,0===i&&c(h,e)};"function"==typeof b.customLoad?b.customLoad(d,f,b,g):Q._fetchOne(d,f,b,g)})})}},_fetchOne:function(a,b,c,d){var e=x(c.resGetPath,{lng:a,ns:b});V.ajax({url:e,cache:c.cache,success:function(a){V.log("loaded: "+e),d(null,a)},error:function(a,b,c){if(b&&200==b||a&&a.status&&200==a.status)V.error("There is a typo in: "+e);else if(b&&404==b||a&&a.status&&404==a.status)V.log("Does not exist: "+e);else{var f=b?b:a&&a.status?a.status:null;V.log(f+" when loading "+e)}d(c,{})},dataType:"json",async:c.getAsync,timeout:c.ajaxTimeout})},postMissing:function(a,b,c,d,e){var f={};f[c]=d;var g=[];if("fallback"===R.sendMissingTo&&R.fallbackLng[0]!==!1)for(var h=0;h<R.fallbackLng.length;h++)g.push({lng:R.fallbackLng[h],url:x(R.resPostPath,{lng:R.fallbackLng[h],ns:b})});else if("current"===R.sendMissingTo||"fallback"===R.sendMissingTo&&R.fallbackLng[0]===!1)g.push({lng:a,url:x(R.resPostPath,{lng:a,ns:b})});else if("all"===R.sendMissingTo)for(var h=0,i=e.length;i>h;h++)g.push({lng:e[h],url:x(R.resPostPath,{lng:e[h],ns:b})});for(var j=0,k=g.length;k>j;j++){var l=g[j];V.ajax({url:l.url,type:R.sendType,data:f,success:function(){V.log("posted missing key '"+c+"' to: "+l.url);for(var a=c.split("."),e=0,f=M[l.lng][b];a[e];)f=f[a[e]]=e===a.length-1?d:f[a[e]]||{},e++},error:function(){V.log("failed posting missing key '"+c+"' to: "+l.url)},dataType:"json",async:R.postAsync,timeout:R.ajaxTimeout})}},reload:t};var R={lng:void 0,load:"all",preload:[],lowerCaseLng:!1,returnObjectTrees:!1,fallbackLng:["dev"],fallbackNS:[],detectLngQS:"setLng",detectLngFromLocalStorage:!1,ns:{namespaces:["translation"],defaultNs:"translation"},fallbackOnNull:!0,fallbackOnEmpty:!1,fallbackToDefaultNS:!1,showKeyIfEmpty:!1,nsseparator:":",keyseparator:".",selectorAttr:"data-i18n",debug:!1,resGetPath:"locales/__lng__/__ns__.json",resPostPath:"locales/add/__lng__/__ns__",getAsync:!0,postAsync:!0,resStore:void 0,useLocalStorage:!1,localStorageExpirationTime:6048e5,dynamicLoad:!1,sendMissing:!1,sendMissingTo:"fallback",sendType:"POST",interpolationPrefix:"__",interpolationSuffix:"__",defaultVariables:!1,reusePrefix:"$t(",reuseSuffix:")",pluralSuffix:"_plural",pluralNotFound:["plural_not_found",Math.random()].join(""),contextNotFound:["context_not_found",Math.random()].join(""),escapeInterpolation:!1,indefiniteSuffix:"_indefinite",indefiniteNotFound:["indefinite_not_found",Math.random()].join(""),setJqueryExt:!0,defaultValueFromContent:!0,useDataAttrOptions:!1,cookieExpirationTime:void 0,useCookie:!0,cookieName:"i18next",cookieDomain:void 0,objectTreeKeyHandler:void 0,postProcess:void 0,parseMissingKey:void 0,missingKeyHandler:Q.postMissing,ajaxTimeout:0,shortcutFunction:"sprintf"},S={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},T={create:function(a,b,c,d){var e;if(c){var f=new Date;f.setTime(f.getTime()+60*c*1e3),e="; expires="+f.toGMTString()}else e="";d=d?"domain="+d+";":"",document.cookie=a+"="+b+e+";"+d+"path=/"},read:function(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "==e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(b))return e.substring(b.length,e.length)}return null},remove:function(a){this.create(a,"",-1)}},U={create:function(){},read:function(){return null},remove:function(){}},V={extend:K?K.extend:a,deepExtend:b,each:K?K.each:c,ajax:K?K.ajax:"undefined"!=typeof document?e:function(){},cookie:"undefined"!=typeof document?T:U,detectLanguage:I,escape:d,log:function(a){R.debug&&"undefined"!=typeof console&&console.log(a)},error:function(a){"undefined"!=typeof console&&console.error(a)},getCountyIndexOfLng:function(a){var b=0;return("nb-NO"===a||"nn-NO"===a||"nb-no"===a||"nn-no"===a)&&(b=1),b},toLanguages:function(a,b){function c(a){var b=a;if("string"==typeof a&&a.indexOf("-")>-1){var c=a.split("-");b=R.lowerCaseLng?c[0].toLowerCase()+"-"+c[1].toLowerCase():c[0].toLowerCase()+"-"+c[1].toUpperCase()}else b=R.lowerCaseLng?a.toLowerCase():a;return b}var d=this.log;b=b||R.fallbackLng,"string"==typeof b&&(b=[b]);var e=[],f=R.lngWhitelist||!1,g=function(a){!f||f.indexOf(a)>-1?e.push(a):d("rejecting non-whitelisted language: "+a)};if("string"==typeof a&&a.indexOf("-")>-1){var h=a.split("-");"unspecific"!==R.load&&g(c(a)),"current"!==R.load&&g(c(h[this.getCountyIndexOfLng(a)]))}else g(c(a));for(var i=0;i<b.length;i++)-1===e.indexOf(b[i])&&b[i]&&e.push(c(b[i]));return e},regexEscape:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},regexReplacementEscape:function(a){return"string"==typeof a?a.replace(/\$/g,"$$$$"):a},localStorage:{setItem:function(a,b){if(window.localStorage)try{window.localStorage.setItem(a,b)}catch(c){V.log('failed to set value for key "'+a+'" to localStorage.')}},getItem:function(a,b){if(window.localStorage)try{return window.localStorage.getItem(a,b)}catch(c){return void V.log('failed to get value for key "'+a+'" from localStorage.')}}}};V.applyReplacement=x;var W=[["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]],X={1:function(a){return Number(a>1)},2:function(a){return Number(1!=a)},3:function(){return 0},4:function(a){return Number(a%10==1&&a%100!=11?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)},5:function(a){return Number(0===a?0:1==a?1:2==a?2:a%100>=3&&10>=a%100?3:a%100>=11?4:5)},6:function(a){return Number(1==a?0:a>=2&&4>=a?1:2)},7:function(a){return Number(1==a?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)},8:function(a){return Number(1==a?0:2==a?1:8!=a&&11!=a?2:3)},9:function(a){return Number(a>=2)},10:function(a){return Number(1==a?0:2==a?1:7>a?2:11>a?3:4)},11:function(a){return Number(1==a||11==a?0:2==a||12==a?1:a>2&&20>a?2:3)},12:function(a){return Number(a%10!=1||a%100==11)},13:function(a){return Number(0!==a)},14:function(a){return Number(1==a?0:2==a?1:3==a?2:3)},15:function(a){return Number(a%10==1&&a%100!=11?0:a%10>=2&&(10>a%100||a%100>=20)?1:2)},16:function(a){return Number(a%10==1&&a%100!=11?0:0!==a?1:2)},17:function(a){return Number(1==a||a%10==1?0:1)},18:function(a){return Number(1==a?1:2)},19:function(a){return Number(1==a?0:0===a||a%100>1&&11>a%100?1:a%100>10&&20>a%100?2:3)},20:function(a){return Number(1==a?0:0===a||a%100>0&&20>a%100?1:2)},21:function(a){return Number(a%100==1?1:a%100==2?2:a%100==3||a%100==4?3:0)}},Y={rules:function(){var a,b={};for(a=W.length;a--;)b[W[a][0]]={name:W[a][1],numbers:W[a][2],plurals:X[W[a][3]]};return b}(),addRule:function(a,b){Y.rules[a]=b},setCurrentLng:function(a){if(!Y.currentRule||Y.currentRule.lng!==a){var b=a.split("-");Y.currentRule={lng:a,rule:Y.rules[b[0]]}}},needsPlural:function(a,b){var c,d=a.split("-");return c=Y.currentRule&&Y.currentRule.lng===a?Y.currentRule.rule:Y.rules[d[V.getCountyIndexOfLng(a)]],c&&c.numbers.length<=1?!1:1!==this.get(a,b)},get:function(a,b){function c(b,c){var d;if(d=Y.currentRule&&Y.currentRule.lng===a?Y.currentRule.rule:Y.rules[b]){var e;e=d.plurals(d.noAbs?c:Math.abs(c));var f=d.numbers[e];return 2===d.numbers.length&&1===d.numbers[0]&&(2===f?f=-1:1===f&&(f=1)),f}return 1===c?"1":"-1"}var d=a.split("-");return c(d[V.getCountyIndexOfLng(a)],b)}},Z={},$=function(a,b){Z[a]=b},_=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function b(a,b){for(var c=[];b>0;c[--b]=a);return c.join("")}var c=function(){return c.cache.hasOwnProperty(arguments[0])||(c.cache[arguments[0]]=c.parse(arguments[0])),c.format.call(null,c.cache[arguments[0]],arguments)};return c.format=function(c,d){var e,f,g,h,i,j,k,l=1,m=c.length,n="",o=[];for(f=0;m>f;f++)if(n=a(c[f]),"string"===n)o.push(c[f]);else if("array"===n){if(h=c[f],h[2])for(e=d[l],g=0;g<h[2].length;g++){if(!e.hasOwnProperty(h[2][g]))throw _('[sprintf] property "%s" does not exist',h[2][g]);e=e[h[2][g]]}else e=h[1]?d[h[1]]:d[l++];if(/[^s]/.test(h[8])&&"number"!=a(e))throw _("[sprintf] expecting number but found %s",a(e));switch(h[8]){case"b":e=e.toString(2);break;case"c":e=String.fromCharCode(e);break;case"d":e=parseInt(e,10);break;case"e":e=h[7]?e.toExponential(h[7]):e.toExponential();break;case"f":e=h[7]?parseFloat(e).toFixed(h[7]):parseFloat(e);break;case"o":e=e.toString(8);break;case"s":e=(e=String(e))&&h[7]?e.substring(0,h[7]):e;break;case"u":e=Math.abs(e);break;case"x":e=e.toString(16);break;case"X":e=e.toString(16).toUpperCase()}e=/[def]/.test(h[8])&&h[3]&&e>=0?"+"+e:e,j=h[4]?"0"==h[4]?"0":h[4].charAt(1):" ",k=h[6]-String(e).length,i=h[6]?b(j,k):"",o.push(h[5]?e+i:i+e)}return o.join("")},c.cache={},c.parse=function(a){for(var b=a,c=[],d=[],e=0;b;){if(null!==(c=/^[^\x25]+/.exec(b)))d.push(c[0]);else if(null!==(c=/^\x25{2}/.exec(b)))d.push("%");else{if(null===(c=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(b)))throw"[sprintf] huh?";if(c[2]){e|=1;var f=[],g=c[2],h=[];if(null===(h=/^([a-z_][a-z_\d]*)/i.exec(g)))throw"[sprintf] huh?";for(f.push(h[1]);""!==(g=g.substring(h[0].length));)if(null!==(h=/^\.([a-z_][a-z_\d]*)/i.exec(g)))f.push(h[1]);else{if(null===(h=/^\[(\d+)\]/.exec(g)))throw"[sprintf] huh?";f.push(h[1])}c[2]=f}else e|=2;if(3===e)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";d.push(c)}b=b.substring(c[0].length)}return d},c}(),aa=function(a,b){return b.unshift(a),_.apply(null,b)};return $("sprintf",function(a,b,c){return c.sprintf?"[object Array]"===Object.prototype.toString.apply(c.sprintf)?aa(a,c.sprintf):"object"==typeof c.sprintf?_(a,c.sprintf):a:a;

}),L.init=f,L.isInitialized=g,L.setLng=r,L.preload=h,L.addResourceBundle=i,L.hasResourceBundle=j,L.getResourceBundle=k,L.addResource=m,L.addResources=n,L.removeResourceBundle=l,L.loadNamespace=p,L.loadNamespaces=q,L.setDefaultNamespace=o,L.t=D,L.translate=D,L.exists=C,L.detectLanguage=V.detectLanguage,L.pluralExtensions=Y,L.sync=Q,L.functions=V,L.lng=s,L.addPostProcessor=$,L.applyReplacement=V.applyReplacement,L.options=R,L.noConflict=u,L});
New to GrepCode? Check out our FAQ X