diff --git a/aio/content/guide/deprecations.md b/aio/content/guide/deprecations.md index a0f5ebe7f2707..6d28414fd0002 100644 --- a/aio/content/guide/deprecations.md +++ b/aio/content/guide/deprecations.md @@ -36,6 +36,7 @@ v9 - v12 | Area | API or Feature | May be removed in | | ----------------------------- | --------------------------------------------------------------------------- | ----------------- | | `@angular/common` | [`ReflectiveInjector`](#reflectiveinjector) | v10 | +| `@angular/common` | [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation) | v11 | | `@angular/core` | [`CollectionChangeRecord`](#core) | v10 | | `@angular/core` | [`DefaultIterableDiffer`](#core) | v10 | | `@angular/core` | [`ReflectiveKey`](#core) | v10 | @@ -74,6 +75,14 @@ Tip: In the [API reference section](api) of this doc site, deprecated APIs are i +{@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} ### @angular/core @@ -305,7 +314,7 @@ However, in practice, Angular simply ignores two-way bindings to template variab ``` {@a undecorated-base-classes} -### Undecorated base classes using Angular features +### Undecorated base classes using Angular features As of version 9, it's deprecated to have an undecorated base class that: @@ -355,8 +364,8 @@ class Dir extends Base { } ``` -In version 9, the CLI has an automated migration that will update your code for you when `ng update` is run. -See [the dedicated migration guide](guide/migration-undecorated-classes) for more information about the change and more examples. +In version 9, the CLI has an automated migration that will update your code for you when `ng update` is run. +See [the dedicated migration guide](guide/migration-undecorated-classes) for more information about the change and more examples. diff --git a/aio/content/guide/updating-to-version-9.md b/aio/content/guide/updating-to-version-9.md index a97fe02c5a8a4..59ec0a4e7265d 100644 --- a/aio/content/guide/updating-to-version-9.md +++ b/aio/content/guide/updating-to-version-9.md @@ -35,6 +35,7 @@ See our [template type-checking guide](guide/template-typecheck) for more inform | API | Replacement | Notes | | ------------------------------------------------------------------------| ------------------------------------ | ----- | | [`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) | | `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) | diff --git a/packages/common/src/pipes/number_pipe.ts b/packages/common/src/pipes/number_pipe.ts index f832e59365cf6..db8c6546faf67 100644 --- a/packages/common/src/pipes/number_pipe.ts +++ b/packages/common/src/pipes/number_pipe.ts @@ -123,9 +123,7 @@ export class PercentPipe implements PipeTransform { */ transform(value: any, digitsInfo?: string, locale?: string): string|null { if (isEmpty(value)) return null; - locale = locale || this._locale; - try { const num = strToNumber(value); return formatPercent(num, locale, digitsInfo); @@ -143,6 +141,26 @@ export class PercentPipe implements PipeTransform { * that determine group sizing and separator, decimal-point character, * and other locale-specific configurations. * + * {@a currency-code-deprecation} + *
+ * + * **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'} + * ``` + * + *
+ * * @see `getCurrencySymbol()` * @see `formatCurrency()` * diff --git a/packages/core/src/i18n/tokens.ts b/packages/core/src/i18n/tokens.ts index 6c79eaec545c3..ead8845db1a41 100644 --- a/packages/core/src/i18n/tokens.ts +++ b/packages/core/src/i18n/tokens.ts @@ -39,6 +39,23 @@ export const LOCALE_ID = new InjectionToken('LocaleId'); * * See the [i18n guide](guide/i18n#setting-up-locale) for more information. * + *
+ * + * **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'} + * ``` + * + *
+ * * @usageNotes * ### Example *