-
Notifications
You must be signed in to change notification settings - Fork 480
LOCALE_ID
is always en-US
during server side renderring, and inconsistent with browser build #1062
Description
Bug Report
LOCALE_ID
is always en-US
during server side renderring. But if we run the same prodution build in browser, LOCALE_ID
is correct as expect.
According to i18n Guide:
To set your app's locale to another value, use the CLI parameter --configuration with the value of the locale id that you want to use
What is the expected behavior?
LOCALE_ID
should be as same as the --i18n-locale
parameter of ng build
or configuration parameter i18nLocale
in angular.json
.
What is the current behavior?
LOCALE_ID
is always en-US
during server side renderring.
What modules are related to this issue?
I'm not sure if this is an issue of universal or angular-cli. Tell me if I put this in a wrong place.
- [ ] aspnetcore-engine
- [ ] common
- [x] express-engine
- [ ] hapi-engine
- [ ] module-map-ngfactory-loader
Minimal reproduction with instructions:
$ git clone git@github.com:clarkorz/angular6-ssr-issue-locale-fix-to-en.git
$ cd angular6-ssr-issue-locale-fix-to-en
$ yarn
$ yarn build:i18n-ssr
$ yarn serve:ssr
Access es
endpoint, expect LOCALE_ID
to be es
.
$ curl http://localhost:4000/es/
...
<app-root ng-version="6.1.6"><h1>Hello</h1><p>locale is en-US</p></app-root>
...
LOCALE_ID
is always en-US
during server side renderring.
// in another terminal
$ curl http://localhost:4000/es/
// in serve terminal
Node Express server listening on http://localhost:4000
LOCALE_ID is en-US
What is the use-case or motivation for changing an existing behavior?
Get correct locale to render i18n related pipes in server side.
Request resource by providing correct locale.
etc.
Environment:
@nguniversal versions
- express-engine:
Angular CLI: 6.1.5
Node: 8.11.2
OS: darwin x64
Angular: 6.1.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.7.5
@angular-devkit/build-angular 0.7.5
@angular-devkit/build-optimizer 0.7.5
@angular-devkit/build-webpack 0.7.5
@angular-devkit/core 0.7.5
@angular-devkit/schematics 0.7.5
@angular/cli 6.1.5
@ngtools/webpack 6.1.5
@schematics/angular 0.7.5
@schematics/update 0.7.5
rxjs 6.3.1
typescript 2.9.2
webpack 4.9.2
Is there anything else we should know?
No.