`LOCALE_ID` is always `en-US` during server side renderring, and inconsistent with browser build
See original GitHub issueLOCALE_ID
is always en-US
during server side renderring. And if we run the same prodution build in browser, LOCALE_ID
is correct as expect.
Bug Report or Feature Request (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Command (mark with an x
)
- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
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
Repro steps
Checkout https://github.com/clarkorz/angular6-ssr-issue-locale-fix-to-en
$ 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>
...
If I run the same prodution build in browser, I got es
for LOCALE_ID
:
$ yarn serve:browser
Open browser to access http://localhost:5000/es/
, I got es
in browser and LOCALE_ID is es
in console.
The log given by the failure
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
Desired functionality
LOCALE_ID
should be as same as the --i18n-locale
parameter of ng build
or configuration parameter i18nLocale
in angular.json
.
LOCALE_ID
should be consistent on both server side and browser side.
Mention any other details that might be useful
No.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
`LOCALE_ID` is always `en-US` during server side renderring ...
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....
Read more >Inconsistent behavior of toLocaleString() in different browser
To achieve this, I am using JavaScript method toLocaleString() . This only works fine in Chrome, in other browser it works inconsistently. For...
Read more >Server-side rendering - Apollo GraphQL Docs
Server -side rendering (SSR) is a performance optimization for modern web apps. It enables you to render your app's initial state to raw...
Read more >Localized Server-Side Rendering with React | Phrase
Our Express server builds our React app and renders it to a string. Instead of using a <BrowserRouter> , which wouldn't work on...
Read more >Server-side rendering (SSR) with Angular Universal
This guide describes Angular Universal, a technology that renders Angular applications on the server. A normal Angular application executes in the browser, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, with the new renderer the translations will be applied at runtime.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.