feat(common): Add an`Intl` implementation for the i18n sub-system. by JeanMeche · Pull Request #55283 · angular/angular · GitHub
Skip to content

feat(common): Add anIntl implementation for the i18n sub-system. - #55283

Closed
JeanMeche wants to merge 6 commits into
angular:mainfrom
JeanMeche:poc-intl-date
Closed

feat(common): Add anIntl implementation for the i18n sub-system. #55283
JeanMeche wants to merge 6 commits into
angular:mainfrom
JeanMeche:poc-intl-date

Conversation

@JeanMeche

@JeanMeche JeanMeche commented Apr 10, 2024

Copy link
Copy Markdown
Member

@angular-robot angular-robot Bot added the detected: feature PR contains a feature commit label Apr 10, 2024
@JeanMeche
JeanMeche force-pushed the poc-intl-date branch 2 times, most recently from 6c939c3 to 0ceb875 Compare April 10, 2024 15:02
@angular-robot angular-robot Bot added the detected: deprecation PR contains a commit with a deprecation label Apr 10, 2024
@JeanMeche JeanMeche changed the title feat(common): Add support for i18N using the Intl API feat(common): Add and enable the Intl implementation for the i18n sub-system. Apr 10, 2024
Comment thread packages/core/src/i18n/locale_data_api.ts Outdated
@JeanMeche JeanMeche changed the title feat(common): Add and enable the Intl implementation for the i18n sub-system. feat(common): Add and enable the Intl implementation for the i18n sub-system. Apr 10, 2024
@JeanMeche JeanMeche added feature Label used to distinguish feature request from other issues breaking changes area: i18n Issues related to localization and internationalization and removed detected: feature PR contains a feature commit labels Apr 11, 2024
@ngbot ngbot Bot added this to the Backlog milestone Apr 11, 2024
@JeanMeche JeanMeche added the action: review The PR is still awaiting reviews from at least one requested reviewer label Apr 11, 2024
@angular-robot angular-robot Bot added the detected: feature PR contains a feature commit label Apr 11, 2024
@alxhub alxhub self-assigned this Apr 11, 2024
@angular-robot angular-robot Bot added the detected: breaking change PR contains a commit with a breaking change label Apr 12, 2024
@JeanMeche
JeanMeche force-pushed the poc-intl-date branch 2 times, most recently from 767753e to 1ca64d6 Compare April 12, 2024 10:27
@JeanMeche
JeanMeche marked this pull request as ready for review April 12, 2024 10:42
@pullapprove
pullapprove Bot requested review from AndrewKushnir and atscott April 12, 2024 10:42
@angular-robot angular-robot Bot removed the detected: breaking change PR contains a commit with a breaking change label Apr 18, 2024
@JeanMeche
JeanMeche force-pushed the poc-intl-date branch 11 times, most recently from e9dd865 to 841fe08 Compare April 22, 2024 15:28

@devversion devversion left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of currency formatting + plural

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a follow-up to remove this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix the formatting once the PR is merge.

Comment thread packages/common/src/i18n/format_number.ts Outdated
Comment thread packages/common/src/i18n/format_number.ts Outdated
Comment thread goldens/public-api/common/index.md Outdated
Comment thread packages/common/test/i18n/format_number_spec.ts Outdated
Comment thread packages/common/src/i18n/intl_helpers.ts Outdated
Comment thread packages/common/src/i18n/intl_helpers.ts Outdated
Comment thread packages/common/src/i18n/intl_helpers.ts Outdated
Comment thread packages/common/src/i18n/intl_helpers.ts Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a breaking change? i.e. there isn't even a way to get back to legacy CLDR here AFAICT

@JeanMeche JeanMeche May 5, 2024

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TGP returned green for this.

Here is the support form Intl.PluralRules.supportedLocalesOf, it is widely within the scope of our supported browser versions.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/supportedLocalesOf

Depending on how strict we are on our breaking change policy, I can be considered breaking or non-breaking. Happy to know what you (and others) think about this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Google3 actually use the CLDR plural data? I don't know off hand.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed my mind on this. Let's stay on the safe side and make plural also opt-in.

@csvn

csvn commented May 16, 2025

Copy link
Copy Markdown
Contributor

I hope I'm not being a nuisance, but what is the status for this PR? I see it was removed from v20 milestone recently, and the last thing mentioned was in #57916:

I hope that we can ship it with v19, mid November.

  • Since using Intl is opt-in, can't this land in a minor version?
  • I looked through tests and code a bit, is there any work left for this to be "done"?

I've been considering replacing @angular/common in our application with pipes/helpers based on Intl so we can format based on the users current locale instead, which is a lot messier when registerLocaleData() is required to use. I thought we'd wait perhaps for this PR to land though, to avoid building something custom if it will be supported in Angular. 😅

@PowerKiKi

Copy link
Copy Markdown
Contributor

I was sure this PR was merged and released already. So I was rather confused when I tried to use intl implementation, but couldn't find anything about it in current Angular source code.

I too would appreciate using this new, lighter, way to do format things. Anything we can do to help move it forward ?

…nd currencies

This commit adds an `Intl` implementation to format numbers, percents and currencies.
The implementation is based on the `Intl` API and allows to drop the static imports for the locale date files.

fixes angular#33803
With this commit, plurals formatting does not depend on the CLDR locale data anymore.
With this commit, the Intl implementation because the default one and doesn't require the CLDR locale data imports anymore.

Opt-out is possible by invoking `useLegacyDateFormatting()` ahead of bootstrap.

BREAKING CHANGE: Some custom date format aren't supported any more (`cccccc`, `EEEEEE`, `aaaaa`, `b` to `bbbbb` and `B` to `BBBBB`)
The `DatePipe` will not support offset timezone anymore, use IANA timezones instead .
@mauriziocescon

Copy link
Copy Markdown

I wonder: any hope for v21 or no way?

@angular-robot

angular-robot Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

This draft PR is being closed because it has been stale for 28 days and has seen no activity from you. If you'd like to see this change land, you can re-open this PR. Thank you for being an Angular contributor!

@angular-automatic-lock-bot

Copy link
Copy Markdown

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: common Issues related to APIs in the @angular/common package area: i18n Issues related to localization and internationalization detected: breaking change PR contains a commit with a breaking change detected: feature PR contains a feature commit feature Label used to distinguish feature request from other issues target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use platform Intl APIs in Angular's i18n subsystem

8 participants