Skip to content

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

Draft
JeanMeche wants to merge 6 commits intoangular:mainfrom
JeanMeche:poc-intl-date
Draft

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

Conversation

@JeanMeche
Copy link
Member

@JeanMeche JeanMeche commented Apr 10, 2024

@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
@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 13 times, most recently from e9dd865 to 841fe08 Compare April 22, 2024 15:28
Copy link
Member

@devversion devversion left a comment

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
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
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.

Copy link
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

Copy link
Member Author

@JeanMeche JeanMeche May 5, 2024

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
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
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
Copy link
Contributor

csvn commented May 16, 2025

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
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

I wonder: any hope for v21 or no way?

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

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