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
feat(common): Add anIntl
implementation for the i18n sub-system.
#55283
base: main
Are you sure you want to change the base?
Conversation
6c939c3
to
0ceb875
Compare
0ceb875
to
7c177e2
Compare
Intl
implementation for the i18n sub-system.
f270b14
to
d5c6da5
Compare
767753e
to
1ca64d6
Compare
…tation for Date formatting angular#55283 introduced an Intl implementation for the i18n sub-system. For dates, the change might be considered breaking. This migration schematics aims to migrate every existing app, to opt-out of the new `Intl` based implementation to smooth out the transition to the new implementation. A TODO is added to invite developers to try-out themselves the new implementation.
1ca64d6
to
ac18c25
Compare
722eb2d
to
8a8c659
Compare
5492c02
to
a31b351
Compare
Intl
implementation for the i18n sub-system. Intl
implementation for the i18n sub-system.
a31b351
to
c493b53
Compare
Ahead of angular#55283 and with what we learned from it, let's improve our test coverage on the i18n subsystem.
c493b53
to
0fd1e55
Compare
6d1e085
to
b37e564
Compare
There was a problem hiding this 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
|
||
afterAll(() => ɵunregisterLocaleData()); | ||
// Following ignore is to ease the review of the diff | ||
// prettier-ignore |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@@ -90,18 +92,21 @@ export function getLocaleCurrencyCode(locale: string): string|null { | |||
* @see {@link NgPlural} | |||
* @see [Internationalization (i18n) Guide](guide/i18n) | |||
*/ | |||
export function getLocalePluralCase(locale: string): (value: number) => number { | |||
const data = findLocaleData(locale); | |||
return data[LocaleDataIndex.PluralCase]; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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.
There was a problem hiding this comment.
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.
57687bb
to
51ed5fe
Compare
…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.
30a12e6
to
344b8d2
Compare
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 .
323772d
to
42b4fa9
Compare
Angular's i18n subsystem is responsible for providing localised formatting of numbers, percents, percentages and dates.
This feature replaces the default implementation of the i18N subsystem.
The commits add a new implementation that relies on the platform-provided
Intl
API.With this new implementation relying on a platform API, it is not necessary anymore the load locale files (See #20487) .
The new implementation is available via an opt-in :
useIntlImplementation()
.This feature fixes the following issues:
Intl
browser APIs for internationalization #49143zh-Hant-TW
orzh-TW
locale in@angular/common
#54114Closes #54470