All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.prod.locale.getLocale.js.map Maven / Gradle / Ivy

{
  "version": 3,
  "sources": ["../../../src/locale/getLocale.ts"],
  "sourcesContent": ["import detectNavigatorLanguage from \"../util/detectNavigatorLanguage.js\";\nimport { getLanguage as getConfigLanguage } from \"../config/Language.js\";\nimport Locale from \"./Locale.js\";\nimport { DEFAULT_LOCALE } from \"../generated/AssetParameters.js\";\n\nconst cache = new Map();\n\nconst getLocaleInstance = (lang: string) => {\n\tif (!cache.has(lang)) {\n\t\tcache.set(lang, new Locale(lang));\n\t}\n\n\treturn cache.get(lang)!;\n};\n\nconst convertToLocaleOrNull = (lang: string) => {\n\ttry {\n\t\tif (lang && typeof lang === \"string\") {\n\t\t\treturn getLocaleInstance(lang);\n\t\t}\n\t} catch (e) {\n\t\t// ignore\n\t}\n\n\treturn new Locale(DEFAULT_LOCALE);\n};\n\n/**\n * Returns the locale based on the parameter or configured language Configuration#getLanguage\n * If no language has been configured - a new locale based on browser language is returned\n */\nconst getLocale = (lang?: string): Locale => {\n\tif (lang) {\n\t\treturn convertToLocaleOrNull(lang);\n\t}\n\n\tconst configLanguage = getConfigLanguage();\n\n\tif (configLanguage) {\n\t\treturn getLocaleInstance(configLanguage);\n\t}\n\n\treturn convertToLocaleOrNull(detectNavigatorLanguage());\n};\n\nexport default getLocale;\n"],
  "mappings": "aAAA,OAAOA,MAA6B,qCACpC,OAAS,eAAeC,MAAyB,wBACjD,OAAOC,MAAY,cACnB,OAAS,kBAAAC,MAAsB,kCAE/B,MAAMC,EAAQ,IAAI,IAEZC,EAAqBC,IACrBF,EAAM,IAAIE,CAAI,GAClBF,EAAM,IAAIE,EAAM,IAAIJ,EAAOI,CAAI,CAAC,EAG1BF,EAAM,IAAIE,CAAI,GAGhBC,EAAyBD,GAAiB,CAC/C,GAAI,CACH,GAAIA,GAAQ,OAAOA,GAAS,SAC3B,OAAOD,EAAkBC,CAAI,CAE/B,MAAY,CAEZ,CAEA,OAAO,IAAIJ,EAAOC,CAAc,CACjC,EAMMK,EAAaF,GAA0B,CAC5C,GAAIA,EACH,OAAOC,EAAsBD,CAAI,EAGlC,MAAMG,EAAiBR,EAAkB,EAEzC,OAAIQ,EACIJ,EAAkBI,CAAc,EAGjCF,EAAsBP,EAAwB,CAAC,CACvD,EAEA,eAAeQ",
  "names": ["detectNavigatorLanguage", "getConfigLanguage", "Locale", "DEFAULT_LOCALE", "cache", "getLocaleInstance", "lang", "convertToLocaleOrNull", "getLocale", "configLanguage"]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy