!function(e){var a="i18n",r=e.Core.newType("hafasModule"),n=e.Core.newType("hafasVersion",0,1);r.getVersion=function(){return n};r.get=function(a,n){return function(a,n){if(void 0!==a){var t=a.split(".").reduce((function(e,a){return void 0===e?"":e[a]}),e.i18n);return"string"!=typeof t?"string"==typeof a&&""!==a&&null===a.match(/^t_._/g)?a:(r.warn("i18n","_getKeyValue","Text nicht gefunden! key='"+a+"'"),"NO-TXT"):(-1!==t.indexOf("{{")&&-1!==t.indexOf("}}")&&(t=e.Modules.Render.renderTemplateString(t,n||{})),t)}}(a,n)},r.pluralize=function(e,a,n){return a=parseFloat(a),!e||isNaN(a)?"":1===Math.abs(a)?r.get(e+"_S",n):r.get(e+"_P",n)},r.determineLanguage=function(a){var r=[];if((a=a||{}).urlParam){var n=e.Core.getParameterByName(a.urlParam);n&&r.push(n)}a.language&&r.push(a.language);try{if(a.localStorageKey&&localStorage&&localStorage.getItem&&a.localStorageKey){var t=localStorage.getItem(a.localStorageKey);t&&(t=JSON.parse(t),(new Date).getTime()>t.expires?localStorage.removeItem(a.localStorageKey):r.push(t.lang))}}catch(a){e.logger.warn(e.logger.ERROR_TYPES.JS,"i18n.readFromStorage","Fehler: Sprache kann nicht aus localStorage gelesen werden.",a)}if(e.Config.Switches.useBrowserLanguage&&(navigator.language||navigator.browserLanguage)){var o=(navigator.language||navigator.browserLanguage||"").replace("-","_");r.push(o),r.push(o.slice(0,2))}r.push(e.Config.defaultLang);for(var g=e.Config.languages,i=0,l=r.length;i<l;i++)for(var u=r[i],s=0,c=g.length;s<c;s++){var f=g[s];if(f.lang===u||f.iso===u||f.hciLang===u)return f}return g[0]},e.Core.registerType(a,"i18n",(function(a){if(void 0===e.i18n)e.Core.newType("hafasRequest",{requestType:"customUrl",method:"get",url:a.i18nSrc+a.lang+".json?v="+e.Core.getAntiCacheParam(),callback:function(r){e.i18n=r,a.callback()}.bind(this),errorCallback:e.bind((function(e){throw error(e)}),this)})})),e.Core.registerModule(a,r)}(window.Hafas=window.Hafas||{});