feat(common): expose getLocaleCurrencyCode publicly (#34810)
It was previously defined in core without being exposed publicly, whereas `getLocaleCurrencyName` and `getLocaleCurrencySymbol` were defined in common, and publicly exposed. This commit now privately exposes `ɵgetLocaleCurrencyCode` from core, and reexports it publicly from common. PR Close #34810
This commit is contained in:
parent
4ba478267e
commit
055533b6a7
|
@ -17,7 +17,7 @@ export {formatDate} from './i18n/format_date';
|
|||
export {formatCurrency, formatNumber, formatPercent} from './i18n/format_number';
|
||||
export {NgLocaleLocalization, NgLocalization} from './i18n/localization';
|
||||
export {registerLocaleData} from './i18n/locale_data';
|
||||
export {Plural, NumberFormatStyle, FormStyle, Time, TranslationWidth, FormatWidth, NumberSymbol, WeekDay, getNumberOfCurrencyDigits, getCurrencySymbol, getLocaleDayPeriods, getLocaleDayNames, getLocaleMonthNames, getLocaleId, getLocaleEraNames, getLocaleWeekEndRange, getLocaleFirstDayOfWeek, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocalePluralCase, getLocaleTimeFormat, getLocaleNumberSymbol, getLocaleNumberFormat, getLocaleCurrencyName, getLocaleCurrencySymbol, getLocaleDirection} from './i18n/locale_data_api';
|
||||
export {Plural, NumberFormatStyle, FormStyle, Time, TranslationWidth, FormatWidth, NumberSymbol, WeekDay, getNumberOfCurrencyDigits, getCurrencySymbol, getLocaleDayPeriods, getLocaleDayNames, getLocaleMonthNames, getLocaleId, getLocaleEraNames, getLocaleWeekEndRange, getLocaleFirstDayOfWeek, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocalePluralCase, getLocaleTimeFormat, getLocaleNumberSymbol, getLocaleNumberFormat, getLocaleCurrencyCode, getLocaleCurrencyName, getLocaleCurrencySymbol, getLocaleDirection} from './i18n/locale_data_api';
|
||||
export {parseCookieValue as ɵparseCookieValue} from './cookie';
|
||||
export {CommonModule} from './common_module';
|
||||
export {NgClass, NgClassBase, NgForOf, NgForOfContext, NgIf, NgIfContext, NgPlural, NgPluralCase, NgStyle, NgStyleBase, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, NgComponentOutlet} from './directives/index';
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ɵCurrencyIndex, ɵExtraLocaleDataIndex, ɵLocaleDataIndex, ɵfindLocaleData, ɵgetLocalePluralCase} from '@angular/core';
|
||||
import {ɵCurrencyIndex, ɵExtraLocaleDataIndex, ɵLocaleDataIndex, ɵfindLocaleData, ɵgetLocaleCurrencyCode, ɵgetLocalePluralCase} from '@angular/core';
|
||||
|
||||
import {CURRENCIES_EN, CurrenciesSymbols} from './currencies';
|
||||
|
||||
|
||||
/**
|
||||
* Format styles that can be used to represent numbers.
|
||||
* @see `getLocaleNumberFormat()`.
|
||||
|
@ -473,6 +475,20 @@ export function getLocaleCurrencyName(locale: string): string|null {
|
|||
return data[ɵLocaleDataIndex.CurrencyName] || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the default currency code for the given locale.
|
||||
*
|
||||
* The default is defined as the first currency which is still in use.
|
||||
*
|
||||
* @param locale The code of the locale whose currency code we want.
|
||||
* @returns The code of the default currency for the given locale.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function getLocaleCurrencyCode(locale: string): string|null {
|
||||
return ɵgetLocaleCurrencyCode(locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the currency values for a given locale.
|
||||
* @param locale A locale code for the locale format rules to use.
|
||||
|
|
|
@ -33,5 +33,5 @@ export {makeDecorator as ɵmakeDecorator} from './util/decorators';
|
|||
export {isObservable as ɵisObservable, isPromise as ɵisPromise} from './util/lang';
|
||||
export {clearOverrides as ɵclearOverrides, initServicesIfNeeded as ɵinitServicesIfNeeded, overrideComponentView as ɵoverrideComponentView, overrideProvider as ɵoverrideProvider} from './view/index';
|
||||
export {NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR} from './view/provider';
|
||||
export {LocaleDataIndex as ɵLocaleDataIndex, CurrencyIndex as ɵCurrencyIndex, ExtraLocaleDataIndex as ɵExtraLocaleDataIndex, getLocalePluralCase as ɵgetLocalePluralCase, findLocaleData as ɵfindLocaleData, registerLocaleData as ɵregisterLocaleData, unregisterAllLocaleData as ɵunregisterLocaleData} from './i18n/locale_data_api';
|
||||
export {LocaleDataIndex as ɵLocaleDataIndex, CurrencyIndex as ɵCurrencyIndex, ExtraLocaleDataIndex as ɵExtraLocaleDataIndex, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, findLocaleData as ɵfindLocaleData, registerLocaleData as ɵregisterLocaleData, unregisterAllLocaleData as ɵunregisterLocaleData} from './i18n/locale_data_api';
|
||||
export {allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, getSanitizationBypassType as ɵgetSanitizationBypassType, BypassType as ɵBypassType, unwrapSafeValue as ɵunwrapSafeValue, SafeHtml as ɵSafeHtml, SafeResourceUrl as ɵSafeResourceUrl, SafeScript as ɵSafeScript, SafeStyle as ɵSafeStyle, SafeUrl as ɵSafeUrl, SafeValue as ɵSafeValue} from './sanitization/bypass';
|
||||
|
|
|
@ -71,7 +71,6 @@ export function findLocaleData(locale: string): any {
|
|||
* @param locale The code of the locale whose currency code we want.
|
||||
* @returns The code of the default currency for the given locale.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function getLocaleCurrencyCode(locale: string): string|null {
|
||||
const data = findLocaleData(locale);
|
||||
|
|
|
@ -51,6 +51,8 @@ export declare enum FormStyle {
|
|||
|
||||
export declare function getCurrencySymbol(code: string, format: 'wide' | 'narrow', locale?: string): string;
|
||||
|
||||
export declare function getLocaleCurrencyCode(locale: string): string | null;
|
||||
|
||||
export declare function getLocaleCurrencyName(locale: string): string | null;
|
||||
|
||||
export declare function getLocaleCurrencySymbol(locale: string): string | null;
|
||||
|
|
Loading…
Reference in New Issue