ng serve --configuration=en throws error
### Versions
Output from: `ng --version`.
Angular CLI: 6.0.3
Node: 8.11.1
OS: darwin x64 (Sierra)
Angular: 6.0.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, material, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.3
@angular-devkit/build-angular 0.6.3
@angular-devkit/build-optimizer 0.6.3
@angular-devkit/core 0.6.3
@angular-devkit/schematics 0.6.3
@angular/cli 6.0.3
@ngtools/webpack 6.0.3
@schematics/angular 0.6.3
@schematics/update 0.6.3
rxjs 6.1.0
typescript 2.7.2
webpack 4.8.3
[](url)
**### Repro steps**
Step 1:
I did add this to my angular.json file for i18n translation - it's based on the doc [here](https://angular.io/guide/i18n#merge-the-completed-translation-file-into-the-app):
`...
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "demo:build"
},
"configurations": {
"production": {
"browserTarget": "demo:build:production"
},
"en": {
"aot": true,
"outputPath": "dist/en/",
"i18nFile": "src/assets/i18n/messages.en.xlf",
"i18nFormat": "xlf",
"i18nLocale": "en"
}
}
},
.......`
Step 2:
Run the command: `ng serve --configuration=en --port 4900`
Step 3: Run/try other command: `for lang in en de; do ng build --output-path=dist/$lang --aot --prod --i18n-file=src/assets/i18n/messages.$lang.xlf --i18n-format=xlf --locale=$lang; done`
**### Observed behavior**
When I run the command: `ng serve --configuration=en --port 4900`, I get the following error:
> Schema validation failed with the following errors:
> Data path "" should NOT have additional properties(outputPath).
When I run the following: `for lang in en de; do ng build --output-path=dist/$lang --aot --prod --i18n-file=src/assets/i18n/messages.$lang.xlf --i18n-format=xlf --locale=$lang; done`, I get the following error:
> Unknown option: '--locale'
**### Desired behavior**
What would like to see implemented?
i18n Internazionalization for different languages - in this case EN and DE
What is the usecase?
Serving the App in specific language based on the serve command mentioned above.
What did you expect to see?
Serving the App in specific language based on the serve command mentioned above.
Move your "en" configuration into configuration of build command. Then referance in configuration of serve command.
"serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { "browserTarget": "projec:build" }, "configurations": { "production": { "browserTarget": "project:build:production" }, "qa": { "browserTarget": "projec:build:qa" }
@chimung How do you reference the configuration from the serve area?
Also, I got the same problem. I think the documentation should be more explicit on which configurations do we have to edit, because there is more than one.
in my configuration of "qa" in serve. I reference by "name-of-your-project:build:qa". It will get configuration of "qa" in build
In this way, it would work:
"projects": {
"ProjectName": {
.....,
"build": {
"builder": "@angular-devkit/build-angular:browser",
....,
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
....
},
"en": {
"aot": true,
"outputPath": "dist/en",
"i18nFile": "src/assets/i18n/messages.en.xlf",
"i18nFormat": "xlf",
"i18nLocale": "en"
},
....
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ProjectName:build"
},
"configurations": {
"production": {
"browserTarget": "ProjectName:build:production"
},
"en": {
"browserTarget": "ProjectName:build:en"
}
}
},
.....
}
}
Any proper docs that guide us on ng serve with configurations in angular.json?
https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/internationalization.md
https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/internationalization.md should be updated with correct instructions on how to do this.
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.