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

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

{"version":3,"file":"getLocale.js","sourceRoot":"","sources":["../../src/locale/getLocale.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;AAExC,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE;IAC1C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACrB,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;KAClC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAE,EAAE;IAC9C,IAAI;QACH,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YACrC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;SAC/B;KACD;IAAC,OAAO,CAAC,EAAE;QACX,SAAS;KACT;IAED,OAAO,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,SAAS,GAAG,CAAC,IAAa,EAAU,EAAE;IAC3C,IAAI,IAAI,EAAE;QACT,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;KACnC;IAED,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAE3C,IAAI,cAAc,EAAE;QACnB,OAAO,iBAAiB,CAAC,cAAc,CAAC,CAAC;KACzC;IAED,OAAO,qBAAqB,CAAC,uBAAuB,EAAE,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","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"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy