I18n default currency from locale#34724
I18n default currency from locale#34724petebacondarwin wants to merge 2 commits intoangular:masterfrom
Conversation
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
be32a19 to
7aeedea
Compare
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
7aeedea to
6bfc538
Compare
6bfc538 to
27f01ee
Compare
|
@petebacondarwin quick comment: it looks like unrelated fixup commit was added to this PR. I've also started a Blueprint Presubmit for this PR as you requested (by adding the "presubmit" label). Thank you. |
|
Thanks @AndrewKushnir - The fixup commit is for this PR but for some reason it picked up the wrong commit message. I'll change that. |
8ade2a2 to
2ca5f8e
Compare
|
I need to write a migration to go with this change that will add in a provider for the default to ensure that current projects do not change unexpectedly. |
The default currency code used for things like `CurrencyPipe` is now
taken from the current locale. Previously this was set to `USD` if the
developer did not explicitly provide the `DEFAULT_CURRENCY_CODE` injectable.
BREAKING CHANGE:
If `DEFAULT_CURRENCY_CODE` was not provided, the default currency for
`CurrencyPipe` was always `USD`. Now it will be the currency code for
the currently configured locale, which set by providing `LOCALE_ID` or by
setting the value globally (`$localize.locale` in IVY or `goog.LOCALE`
in G3).
To recover the original behaviour provide `DEFAULT_CURRENCY_CODE`, in your
application `NgModule`, as follows:
```ts
{provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'},
```
2ca5f8e to
f12eccd
Compare
|
After further discussion, it is decided that this is not actually a desirable change. If the application wishes to display prices in locale specific currencies then it would not only need to change the currency symbol being displayed but also the value of the currency based on the current exchange rate. So automatically setting the default currency to the current locale is not enough on its own, without further logic to update the value. It is already possible to set the default currency code by providing the Therefore we do not intend to land this PR. Closing. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR is for v10 only. It adds a breaking change that is not wanted in v9.