Skip to content

docs: fix CurrencyPipe locale override example#69215

Open
erkamyaman wants to merge 1 commit into
angular:mainfrom
erkamyaman:docs-fix-currencypipe-locale-example
Open

docs: fix CurrencyPipe locale override example#69215
erkamyaman wants to merge 1 commit into
angular:mainfrom
erkamyaman:docs-fix-currencypipe-locale-example

Conversation

@erkamyaman
Copy link
Copy Markdown
Contributor

The "Override current locale for CurrencyPipe" example used {{ amount | currency: 'en-US' }}, but the first CurrencyPipe argument is the currency code, not the locale, so 'en-US' was treated as an invalid currency code (rendered literally as the symbol) and the locale was never overridden. Since locale is the fourth positional argument, the example now passes a valid currency code, display, and digits before it ('USD' : 'symbol' : '1.2-2' : 'en-US'), matching the parameter order shown on the CurrencyPipe API page.

PR Checklist

Please check that your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other

What is the current behavior?

On the Format data based on locale page, the "Override current locale for CurrencyPipe" section shows {{ amount | currency: 'en-US' }}. The first CurrencyPipe argument is the currency code, not the locale, so 'en-US' is treated as a (non-existent) currency code, rendered literally as the symbol (e.g. en-US1,234.50), and the locale is never overridden. The example does not do what the section describes.

image

What is the new behavior?

The example passes the locale as the fourth positional argument with valid preceding arguments: {{ amount | currency: 'USD' : 'symbol' : '1.2-2' : 'en-US' }}, which actually overrides the locale. This matches the parameter order on the CurrencyPipe API page and its canonical example, packages/examples/common/pipes/ts/currency_pipe.ts, which uses the same shape ({{ b | currency: 'CAD' : 'symbol' : '4.2-2' : 'fr' }}). Only the code example changed; the surrounding prose is unchanged.

image

Does this PR introduce a breaking change?

  • Yes
  • No

The "Override current locale for CurrencyPipe" example used `{{ amount | currency: 'en-US' }}`, but the first `CurrencyPipe` argument is the currency code, not the locale, so `'en-US'` was treated as an invalid currency code (rendered literally as the symbol) and the locale was never overridden. Since `locale` is the fourth positional argument, the example now passes a valid currency code, display, and digits before it (`'USD' : 'symbol' : '1.2-2' : 'en-US'`), matching the parameter order shown on the CurrencyPipe API page.
@pullapprove pullapprove Bot requested a review from josephperrott June 7, 2026 10:28
@angular-robot angular-robot Bot added the area: docs Related to the documentation label Jun 7, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jun 7, 2026
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Jun 7, 2026
@JeanMeche JeanMeche removed the request for review from josephperrott June 7, 2026 22:40
@JeanMeche JeanMeche removed the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: docs Related to the documentation target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants