MCPcopy Index your code
hub / github.com/angular/angular / findLocaleData

Function findLocaleData

packages/core/src/i18n/locale_data_api.ts:49–72  ·  view source on GitHub ↗
(locale: string)

Source from the content-addressed store, hash-verified

47 * @see [Internationalization (i18n) Guide](guide/i18n)
48 */
49export function findLocaleData(locale: string): any {
50 const normalizedLocale = normalizeLocale(locale);
51
52 let match = getLocaleData(normalizedLocale);
53 if (match) {
54 return match;
55 }
56
57 // let's try to find a parent locale
58 const parentLocale = normalizedLocale.split('-')[0];
59 match = getLocaleData(parentLocale);
60 if (match) {
61 return match;
62 }
63
64 if (parentLocale === 'en') {
65 return localeEn;
66 }
67
68 throw new RuntimeError(
69 RuntimeErrorCode.MISSING_LOCALE_DATA,
70 ngDevMode && `Missing locale data for the locale "${locale}".`,
71 );
72}
73
74/**
75 * Retrieves the default currency code for the given locale.

Callers 3

getLocaleCurrencyCodeFunction · 0.85
getLocalePluralCaseFunction · 0.85

Calls 2

getLocaleDataFunction · 0.85
normalizeLocaleFunction · 0.70

Tested by

no test coverage detected