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
fix(ivy): set LOCALE_ID when using the injector #31566
Conversation
4628a05
to
d33614c
Compare
d33614c
to
223c2a2
Compare
This PR will require a rebase once PR #31519 lands -> adding "blocked" label. |
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.
LGTM, aside from tests
import {describe, expect, inject, it} from '../testing/src/testing_internal'; | ||
|
||
{ | ||
describe('Application module', () => { | ||
it('should set the default locale to "en-US"', | ||
inject([LOCALE_ID], (defaultLocale: string) => { expect(defaultLocale).toEqual('en-US'); })); | ||
it('should set the default locale to DEFAULT_LOCALE_ID', |
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'm not sure we should change this test. It's specifically testing that the default is en-us
. If someone accidentally added an f
or something to DEFAULT_LOCALE_ID
, this test would still pass. We should enforce having to change this test if we want to change the default (which is unlikely).
Also: It doesn't look like we added a new test to make sure we don't regress on this bug (#31465). Can you add one?
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.
LGTM, with +1 to Kara's comments.
223c2a2
to
65dbfa0
Compare
c9aeebc
to
b048640
Compare
b048640
to
84e7038
Compare
I disabled the test for ivy for now so that we can need to fix the error in view engine first. |
@ocombe as we discussed offline, I was unable to repro the problem with VE/Ivy on the current master without other changes from this PR (the test fails for both Ivy and VE). I'm wondering if it'd be sufficient for the purposes of this PR to simplify the test that you've created to something like this:
|
In `BrowserModule` the value of `LOCALE_ID` is defined in the `APPLICATION_MODULE_PROVIDERS` after `APP_INITIALIZER` has run. This PR ensures that `LOCALE_ID` is also set for ivy at the same moment which allows the application to fetch the locale from a backend (for example). Fixes angular#31465 FW-1436 #resolve
84e7038
to
cb86add
Compare
cb86add
to
57430b5
Compare
In `BrowserModule` the value of `LOCALE_ID` is defined in the `APPLICATION_MODULE_PROVIDERS` after `APP_INITIALIZER` has run. This PR ensures that `LOCALE_ID` is also set for ivy at the same moment which allows the application to fetch the locale from a backend (for example). Fixes angular#31465 FW-1436 #resolve PR Close angular#31566
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
In
BrowserModule
the value ofLOCALE_ID
is defined in theAPPLICATION_MODULE_PROVIDERS
afterAPP_INITIALIZER
has run.This PR ensures that
LOCALE_ID
is also set for ivy at the same moment which allows the application to fetch the locale from a backend (for example).Fixes #31465
I also took the opportunity to define the default locale id as a constant for all packages (not just core/render3).