-
Notifications
You must be signed in to change notification settings - Fork 480
How to build SSR with multi-lang (i18n) with Angular 9 #1497
Description
How to build SSR with i18n with Angular 9?
With the new angular version, documentation is not clear to me how to build angular 9 SSR with i18n.
Previously in version 8, I was doing the following commands:
ng build --configuration=production-ar && ng build --configuration=production-en && ng run website:server:production-en && ng run website:server:production-ar
- then
webpack --config apps/website/webpack.server.config.js --progress --colors
you can check my implementation in this demo repo: https://github.com/keserwan/testAngularPrerender
The output in the "dist" folder was the following:
dist>Website>
-server.js
-server
-ar
-en
-client
-ar
-en
Currently, I am lost how to build multi-lang without webpack.server.config.js .
Is there any template project for such requirements? I didn't find it in the documentation.
here is my current angular.json
here is my server.ts (I modified line 14 to read from /website/ar/browser)
How to make server.ts file work for both languages?
Should I have 2 instances of the server (line 44 in the image above)? one for 'en' and one for 'ar'?
What changes should I do to server.ts to do these 2 calls? Should I create 2 server.ts?
ng run website:server:production-en && ng run website:server:production-ar
🌍 Your Environment
@angular-devkit/architect 0.900.1
@angular-devkit/build-angular 0.900.1
@angular-devkit/build-ng-packagr 0.900.1
@angular-devkit/build-optimizer 0.900.1
@angular-devkit/build-webpack 0.900.1
@angular-devkit/core 8.3.23
@angular-devkit/schematics 8.3.23
@angular/cli 9.0.1
@angular/http 7.2.16
@ngtools/webpack 9.0.1
@nguniversal/builders 9.0.0
@nguniversal/common 9.0.0
@nguniversal/express-engine 9.0.0
@schematics/angular 8.3.23
@schematics/update 0.900.1
ng-packagr 9.0.0
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2