Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I18n default currency from locale #34724

Commits on Apr 14, 2020

  1. fix(core): get default currency code from current locale

    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'},
    ```
    petebacondarwin committed Apr 14, 2020
    Copy the full SHA
    22b4c8b View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    f12eccd View commit details
    Browse the repository at this point in the history