feat(common): expose getLocaleCurrencyCode publicly (#34946)
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 #34946
This commit is contained in:

committed by
Andrew Kushnir

parent
62e1186140
commit
622737cee3
@ -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} 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} 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.
|
||||
|
Reference in New Issue
Block a user