docs: add deprecation info about default currency code (#32584)
In v10 the default currency code will be taken from the current locale, rather than simply defaulting to `USD`. PR Close #32584
This commit is contained in:
parent
39b479dae0
commit
58f10026c4
|
@ -36,6 +36,7 @@ v9 - v12
|
||||||
| Area | API or Feature | May be removed in |
|
| Area | API or Feature | May be removed in |
|
||||||
| ----------------------------- | --------------------------------------------------------------------------- | ----------------- |
|
| ----------------------------- | --------------------------------------------------------------------------- | ----------------- |
|
||||||
| `@angular/common` | [`ReflectiveInjector`](#reflectiveinjector) | <!--v8--> v10 |
|
| `@angular/common` | [`ReflectiveInjector`](#reflectiveinjector) | <!--v8--> v10 |
|
||||||
|
| `@angular/common` | [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation) | <!--v9--> v11 |
|
||||||
| `@angular/core` | [`CollectionChangeRecord`](#core) | <!--v7--> v10 |
|
| `@angular/core` | [`CollectionChangeRecord`](#core) | <!--v7--> v10 |
|
||||||
| `@angular/core` | [`DefaultIterableDiffer`](#core) | <!--v7--> v10 |
|
| `@angular/core` | [`DefaultIterableDiffer`](#core) | <!--v7--> v10 |
|
||||||
| `@angular/core` | [`ReflectiveKey`](#core) | <!--v8--> v10 |
|
| `@angular/core` | [`ReflectiveKey`](#core) | <!--v8--> v10 |
|
||||||
|
@ -74,6 +75,14 @@ Tip: In the [API reference section](api) of this doc site, deprecated APIs are i
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{@a common}
|
||||||
|
### @angular/common
|
||||||
|
|
||||||
|
| API | Replacement | Deprecation announced | Notes |
|
||||||
|
| --------------------------------------------------------------------------------------------- | --------------------------------------------------- | --------------------- | ----- |
|
||||||
|
| [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation) | `{provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}` | v9 | From v11 the default code will be extracted from the locale data given by `LOCAL_ID`, rather than `USD`. |
|
||||||
|
|
||||||
|
|
||||||
{@a core}
|
{@a core}
|
||||||
### @angular/core
|
### @angular/core
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ See our [template type-checking guide](guide/template-typecheck) for more inform
|
||||||
| API | Replacement | Notes |
|
| API | Replacement | Notes |
|
||||||
| ------------------------------------------------------------------------| ------------------------------------ | ----- |
|
| ------------------------------------------------------------------------| ------------------------------------ | ----- |
|
||||||
| [`entryComponents`](api/core/NgModule#entryComponents) | none | See [`entryComponents`](guide/deprecations#entryComponents) |
|
| [`entryComponents`](api/core/NgModule#entryComponents) | none | See [`entryComponents`](guide/deprecations#entryComponents) |
|
||||||
|
| [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation)| `{provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}` | From v11 the default code will be extracted from the locale data given by `LOCAL_ID`, rather than `USD`. |
|
||||||
| [`ANALYZE_FOR_ENTRY_COMPONENTS`](api/core/ANALYZE_FOR_ENTRY_COMPONENTS) | none | See [`ANALYZE_FOR_ENTRY_COMPONENTS`](guide/deprecations#entryComponents) |
|
| [`ANALYZE_FOR_ENTRY_COMPONENTS`](api/core/ANALYZE_FOR_ENTRY_COMPONENTS) | none | See [`ANALYZE_FOR_ENTRY_COMPONENTS`](guide/deprecations#entryComponents) |
|
||||||
| `ModuleWithProviders` without a generic | `ModuleWithProviders` with a generic | See [`ModuleWithProviders` section](guide/deprecations#moduleWithProviders) |
|
| `ModuleWithProviders` without a generic | `ModuleWithProviders` with a generic | See [`ModuleWithProviders` section](guide/deprecations#moduleWithProviders) |
|
||||||
| Undecorated base classes that use Angular features | Base classes with `@Directive()` decorator that use Angular features | See [undecorated base classes section](guide/deprecations#undecorated-base-classes) |
|
| Undecorated base classes that use Angular features | Base classes with `@Directive()` decorator that use Angular features | See [undecorated base classes section](guide/deprecations#undecorated-base-classes) |
|
||||||
|
|
|
@ -123,9 +123,7 @@ export class PercentPipe implements PipeTransform {
|
||||||
*/
|
*/
|
||||||
transform(value: any, digitsInfo?: string, locale?: string): string|null {
|
transform(value: any, digitsInfo?: string, locale?: string): string|null {
|
||||||
if (isEmpty(value)) return null;
|
if (isEmpty(value)) return null;
|
||||||
|
|
||||||
locale = locale || this._locale;
|
locale = locale || this._locale;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const num = strToNumber(value);
|
const num = strToNumber(value);
|
||||||
return formatPercent(num, locale, digitsInfo);
|
return formatPercent(num, locale, digitsInfo);
|
||||||
|
@ -143,6 +141,26 @@ export class PercentPipe implements PipeTransform {
|
||||||
* that determine group sizing and separator, decimal-point character,
|
* that determine group sizing and separator, decimal-point character,
|
||||||
* and other locale-specific configurations.
|
* and other locale-specific configurations.
|
||||||
*
|
*
|
||||||
|
* {@a currency-code-deprecation}
|
||||||
|
* <div class="alert is-helpful">
|
||||||
|
*
|
||||||
|
* **Deprecation notice:**
|
||||||
|
*
|
||||||
|
* The default currency code is currently always `USD` but this is deprecated from v9.
|
||||||
|
*
|
||||||
|
* **In v11 the default currency code will be taken from the current locale identified by
|
||||||
|
* the `LOCAL_ID` token. See the [i18n guide](guide/i18n#setting-up-the-locale-of-your-app) for
|
||||||
|
* more information.**
|
||||||
|
*
|
||||||
|
* If you need the previous behavior then set it by creating a `DEFAULT_CURRENCY_CODE` provider in
|
||||||
|
* your application `NgModule`:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* {provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* </div>
|
||||||
|
*
|
||||||
* @see `getCurrencySymbol()`
|
* @see `getCurrencySymbol()`
|
||||||
* @see `formatCurrency()`
|
* @see `formatCurrency()`
|
||||||
*
|
*
|
||||||
|
|
|
@ -39,6 +39,23 @@ export const LOCALE_ID = new InjectionToken<string>('LocaleId');
|
||||||
*
|
*
|
||||||
* See the [i18n guide](guide/i18n#setting-up-locale) for more information.
|
* See the [i18n guide](guide/i18n#setting-up-locale) for more information.
|
||||||
*
|
*
|
||||||
|
* <div class="alert is-helpful">
|
||||||
|
*
|
||||||
|
* **Deprecation notice:**
|
||||||
|
*
|
||||||
|
* The default currency code is currently always `USD` but this is deprecated from v9.
|
||||||
|
*
|
||||||
|
* **In v10 the default currency code will be taken from the current locale.**
|
||||||
|
*
|
||||||
|
* If you need the previous behavior then set it by creating a `DEFAULT_CURRENCY_CODE` provider in
|
||||||
|
* your application `NgModule`:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* {provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* </div>
|
||||||
|
*
|
||||||
* @usageNotes
|
* @usageNotes
|
||||||
* ### Example
|
* ### Example
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue