Skip to content

Instantly share code, notes, and snippets.

@daniele-zurico
Last active February 9, 2019 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daniele-zurico/77f7c47b5455f178aa09468d74982762 to your computer and use it in GitHub Desktop.
Save daniele-zurico/77f7c47b5455f178aa09468d74982762 to your computer and use it in GitHub Desktop.
translation angular i18n
{
...
"architect": {
"build": {
...
"configurations": {
"production-fr": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"outputPath": "dist/my-project-fr/",
"i18nFile": "src/locale/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error"
},
"production-it": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"outputPath": "dist/my-project-it/",
"i18nFile": "src/locale/messages.it.xlf",
"i18nFormat": "xlf",
"i18nLocale": "it",
"i18nMissingTranslation": "error"
},
"fr": {
"aot": true,
"outputPath": "dist/my-project-fr/",
"i18nFile": "src/locale/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error"
},
"it": {
"aot": true,
"outputPath": "dist/my-project-it/",
"i18nFile": "src/locale/messages.it.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error"
},
"production": {
...
}
}
},
"serve": {
...
"configurations": {
"fr": {
"browserTarget": "translations-prj:build:fr"
},
"it": {
"browserTarget": "translations-prj:build:it"
},
...
}
},
...
},
"lint": {
...
}
}
},
...
}
@petlurikartheek
Copy link

how to add angular.json

@petlurikartheek
Copy link

how to add angular.json

@ricardosaracino
Copy link

ricardosaracino commented Feb 9, 2019

im running this but locale is still en-US

ng serve --configuration=fr

  constructor(public appService: AppService, @Inject(LOCALE_ID) public locale: string) {
  }
  ngOnInit() {

    console.log('AppComponent.locale: ', this.locale);

AppComponent.locale: en-US

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment