emby.idonthaveagmail.com
Open in
urlscan Pro
66.181.119.213
Public Scan
Submitted URL: http://emby.idonthaveagmail.com/web/modules/common/globalize.js?v=4.9.0.24
Effective URL: https://emby.idonthaveagmail.com/web/modules/common/globalize.js?v=4.9.0.24
Submission: On October 29 via api from US — Scanned from DE
Effective URL: https://emby.idonthaveagmail.com/web/modules/common/globalize.js?v=4.9.0.24
Submission: On October 29 via api from US — Scanned from DE
Form analysis
0 forms found in the DOMText Content
define(["exports","./../emby-apiclient/events.js","./../emby-apiclient/connectionmanager.js","./usersettings/usersettings.js"],function(_exports,_events,_connectionmanager,_usersettings){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var currentCulture,currentDateTimeCulture,currentLocales,cacheParam,allTranslations={},allStrings={},rtlLocales=["ar","he","fa","ur","ug"],arabicLocales=["ar","fa","ur","ug"];function getCurrentLocale(){return currentCulture}function updateCurrentCulture(){var culture,dir,dateTimeCulture;try{culture=_usersettings.default.language()}catch(err){}culture=culture||function(){var culture="undefined"==typeof document?null:document.documentElement.getAttribute("data-culture");return culture||navigator.language||navigator.userLanguage||(navigator.languages&&navigator.languages.length?navigator.languages[0]:"en-us")}(),"undefined"!=typeof document&&CSS.supports("text-align","start")&&CSS.supports("inset-inline-start","0")&&(dir=rtlLocales.includes((culture||"").toLowerCase())?"rtl":"ltr","rtl"==(document.dir=dir)?document.documentElement.classList.add("rtl"):document.documentElement.classList.remove("rtl"),arabicLocales.includes((culture||"").toLowerCase())?document.documentElement.classList.add("rtl-arabic"):document.documentElement.classList.remove("rtl-arabic")),currentCulture=normalizeLocaleName(culture),currentLocales=[currentCulture];try{dateTimeCulture=_usersettings.default.dateTimeLocale()}catch(err){}currentDateTimeCulture=dateTimeCulture?normalizeLocaleName(dateTimeCulture):currentCulture,function(culture){for(var i in allTranslations)ensureTranslation(allTranslations[i],culture)}(currentCulture),_connectionmanager.default.setCurrentLocale(currentCulture)}function ensureTranslation(translationInfo,culture){return translationInfo.dictionaries[culture]?Promise.resolve():function(translations,lang){lang=normalizeLocaleName(lang);var filtered=translations.filter(function(t){return normalizeLocaleName(t.lang)===lang});filtered.length||(filtered=translations.filter(function(t){return"en-us"===normalizeLocaleName(t.lang)}));if(!filtered.length)return Promise.resolve();translations=filtered[0].path;cacheParam&&(translations=(translations+=-1===translations.indexOf("?")?"?":"&")+cacheParam);return("undefined"==typeof XMLHttpRequest?function(url){return fetch(url).then(function(response){return response.json()})}:function(url){return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest;xhr.open("GET",url,!0),xhr.onload=function(e){this.status<400?resolve(JSON.parse(this.response)):resolve()},xhr.onerror=function(){resolve()},xhr.send()})})(translations)}(translationInfo.translations,culture).then(function(dictionary){translationInfo.dictionaries[culture]=!0,dictionary&&(allStrings[culture]?allStrings[culture]=Object.assign(dictionary,allStrings[culture]||{}):allStrings[culture]=dictionary)})}function normalizeLocaleName(culture){var parts=(culture=culture.replace("_","-")).split("-"),parts=(culture=2===parts.length&&parts[0].toLowerCase()===parts[1].toLowerCase()?parts[0].toLowerCase():culture).toLowerCase();return"ca-es"===parts?"ca":"sv-se"===parts?"sv":parts}function register(options){allTranslations[options.name]={translations:options.strings||options.translations,dictionaries:{}}}function translateKey(key){var dictionary=allStrings[currentCulture];if(dictionary){dictionary=dictionary[key];if(dictionary)return dictionary}return key}function translate(key){for(var val=translateKey(key),i=1;i<arguments.length;i++)val=val.replaceAll("{"+(i-1)+"}",arguments[i]);return val}function translateHtml(html){var endIndex,startIndex=html.indexOf("${");return-1===startIndex||-1===(endIndex=html.indexOf("}",startIndex+=2))?html:(endIndex=translateKey(startIndex=html.substring(startIndex,endIndex)),translateHtml(html=html.replace("${"+startIndex+"}",endIndex)))}updateCurrentCulture(),_events.default.on(_connectionmanager.default,"localusersignedin",updateCurrentCulture),_events.default.on(_usersettings.default,"change",function(e,name){"language"!==name&&"datetimelocale"!==name||updateCurrentCulture()});_exports.default={getString:translate,translate:translate,translateDocument:translateHtml,translateHtml:translateHtml,loadStrings:function(options){var locale=currentCulture;return"string"==typeof options?ensureTranslation(allTranslations[options],locale):(register(options),ensureTranslation(allTranslations[options.name],locale))},getCurrentLocale:getCurrentLocale,getCurrentDateTimeLocale:function(){return currentDateTimeCulture},getCurrentLocales:function(){return currentLocales},register:register,setCacheParam:function(value){cacheParam=value}}});