Skip to content

Commit

Permalink
fixup(docs): Provide production-fr configuation for French translatio…
Browse files Browse the repository at this point in the history
…n build
  • Loading branch information
brandonroberts committed May 3, 2018
1 parent bd8fbdc commit b04f31a
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 2 deletions.
37 changes: 37 additions & 0 deletions aio/content/guide/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,43 @@ You then pass the configuration with the `ng serve` or `ng build` commands. The
ng serve --configuration=fr
</code-example>

For production builds, you define a separate `production-fr` build configuration in your `angular.json`.

<code-example format="." language="ts">
"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"
},
...
}
</code-example>

The same configuration options can also be provided through the CLI with your existing `production` configuration.

<code-example language="sh" class="code-shell">
ng build --prod --i18n-file src/locale/messages.fr.xlf --i18n-format xlf --i18n-locale fr
</code-example>

{@a merge-jit}
### Merge with the JIT compiler

Expand Down
2 changes: 1 addition & 1 deletion aio/tools/example-zipper/customizer/package-json/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{ "name": "start", "command": "ng serve" },
{ "name": "start:fr", "command": "ng serve --configuration=fr" },
{ "name": "build", "command": "ng build --prod" },
{ "name": "build:fr", "command": "ng build --prod --configuration=fr" },
{ "name": "build:fr", "command": "ng build --configuration=production-fr" },
{ "name": "test", "command": "ng test" },
{ "name": "lint", "command": "ng lint" },
{ "name": "e2e", "command": "ng e2e" },
Expand Down
22 changes: 22 additions & 0 deletions aio/tools/examples/shared/boilerplate/i18n/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,28 @@
"vendorChunk": false,
"buildOptimizer": true
},
"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"
},
"fr": {
"aot": true,
"outputPath": "dist/my-project-fr/",
Expand Down
2 changes: 1 addition & 1 deletion aio/tools/examples/shared/boilerplate/i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "ng serve",
"start:fr": "ng serve --configuration=fr",
"build": "ng build --prod",
"build:fr": "ng build --prod --configuration=fr",
"build:fr": "ng build --configuration=production-fr",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
Expand Down

0 comments on commit b04f31a

Please sign in to comment.