MCPcopy Create free account
hub / github.com/UI5/webcomponents / getLocaleData

Function getLocaleData

packages/localization/src/locale/getLocaleData.ts:16–28  ·  view source on GitHub ↗
(lang: string)

Source from the content-addressed store, hash-verified

14 * @returns { Promise<LocaleData> }
15 */
16const getLocaleData = async (lang: string): Promise<LocaleData> => {
17 const locale = getLocale(lang);
18 const localeLang = locale.getLanguage();
19
20 if (!instances.has(localeLang)) {
21 await fetchCldr(locale.getLanguage(), locale.getRegion(), locale.getScript());
22 // @ts-expect-error - The LocaleData constructor expects a LocaleT, but we are passing a Locale. This is a known issue and can be ignored for now.
23 // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
24 instances.set(localeLang, new LocaleData(locale as unknown as LocaleT));
25 }
26
27 return instances.get(localeLang)!;
28};
29
30export default getLocaleData;

Callers 1

loadResourceFunction · 0.50

Calls 6

getLocaleFunction · 0.85
fetchCldrFunction · 0.85
getLanguageMethod · 0.80
getRegionMethod · 0.80
getScriptMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…