You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This indeed seems to be caused by a library that is importing @angular/localize. I suggest you file an issue with the author of the library as @angular/localize should not be imported directly in libraries.
I expected something like this, but it took me ages to find the problem.
Maybe a warning at the right place (when $localize gets overwritten?) could help out and save a lot of time, especially when upgrading from older ng versions.
Command
build, serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I used
@angular-devkit/build-angular:browser-esbuild
as a drop in replacement for browser builder.Problem occured:
LOCALE_ID in application was suddenly 'en-US' instead of configured sourceLocale 'de-AT'.
(with ng build and ng serve)
Workaround/Fix found (maybe logical but not for a drop in replacement):
import '@angular/localize'
from sources (also from polyfills.ts)types: ['@angular/localize' ]
to tsconfig.lib.jsonFindings during debugging (with ng serve though):
Watched value:
globalThis.$localize.locale: undefined
At this point of time $localize.locale is correctly set to 'de-AT'.
Watched value:
globalThis.$localize.locale: 'de-AT'
Then $localize gets overwritten because of some used library like
(which is probably caused by an
import '@angular/localize'
statement in the lib source)$localize.locale
changes from'de-AT'
toundefined
Watched value:
globalThis.$localize.locale: undefined
And the angular core returns the fallback
'en-US'
Minimal Reproduction
Couldnot reproduce it in a monorepo, gave up.
I have my lib packages in a nexus repository manager and the app in another repo.
But even if this issue will get closed, it is a good tip that I could have needed with my search.
angular.json i18n in the app is set like this:
Just a guess: Might also be related to #26350
Exception or Error
No response
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: