@@ -91,7 +91,7 @@ a(id="i18n-directive")
91
91
:marked
92
92
### i18n directive
93
93
94
- The i18n directive is what tells Angular where it should inject the translations.
94
+ The ` i18n` directive is what tells Angular where it should inject the translations.
95
95
It is used by both the JiT and the AoT approaches.
96
96
97
97
We simply add the attribute `i18n` to an element and the content string will be replaced when necessary.
@@ -128,7 +128,7 @@ a(id="i18n-plural-pipe")
128
128
129
129
.alert.is-important
130
130
:marked
131
- The plural pipe is not yet supported by the ng-xi18n messages extractor.
131
+ The ng-xi18n messages extractor doesn't support the plural pipe right now.
132
132
133
133
134
134
a( id ="i18n-select-pipe" )
@@ -144,7 +144,7 @@ a(id="i18n-select-pipe")
144
144
+ makeExample('i18n/ts-snippets/i18n.config.snippets.ts' , 'i18n-select-pipe' )( format ="." )
145
145
.alert.is-important
146
146
:marked
147
- The select pipe is not yet supported by the ng-xi18n messages extractor .
147
+ The ng-xi18n messages extractor doesn't support the select pipe right now .
148
148
149
149
150
150
a( id ="extract" )
@@ -163,14 +163,15 @@ a(id="ng-xi18n")
163
163
To use it, the first thing that we have to do is to install it:
164
164
165
165
code-example( language ="sh" ) .
166
- npm install @angular/compiler-cli --save
166
+ npm install @angular/compiler-cli @angular/platform-server typescript@2.0.2 --save
167
167
168
168
:marked
169
- Like `ngc`, `ng-xi18n` is based on `tsc`, the TypeScript compiler. It uses the file `tsconfig.json` to determine where
170
- are our files. We have to make sure that we have defined the parameter `files` so that it knows what is the entry point
171
- of our application.
169
+ Like `ngc`, `ng-xi18n` is based on `tsc`, the TypeScript compiler.
172
170
173
- + makeExample('i18n/ts-snippets/i18n.config.snippets.ts' , 'tsconfig1' )( format ="." )
171
+ Let's edit our `tsconfig.json` file and add the `angularCompilerOptions` with `genDir` pointing to the folder where we
172
+ want `ng-xi18n` to generate the file.
173
+
174
+ + makeExample('i18n/ts-snippets/i18n.config.snippets.ts' , 'tsconfig' )( format ="." )
174
175
175
176
:marked
176
177
We can then use the `ng-xi18n` binary to generate a file named `messages.xlf` at the root of our application.
@@ -187,11 +188,6 @@ code-example(language="sh").
187
188
188
189
:marked
189
190
If we want to generate this `messages.xlf` file somewhere in particular, `ng-xi18n` uses the same parameters as `ngc`.
190
-
191
- Let's edit our `tsconfig.json` file and add the `angularCompilerOptions` with `genDir` pointing to the folder where we
192
- want `ng-xi18n` to generate the file.
193
-
194
- + makeExample('i18n/ts-snippets/i18n.config.snippets.ts' , 'tsconfig2' )( format ="." )
195
191
196
192
:marked
197
193
The generated `messages.xlf` file uses by default the format `XML Localisation Interchange File Format` (XLIFF, version 1.2).
@@ -225,7 +221,7 @@ a(id="translate")
225
221
226
222
.alert.is-helpful
227
223
:marked
228
- Using a versionning system such as `GIT` can help us find out easily what new translations have been generated by
224
+ Using a versioning system such as `GIT` can help us find out easily what new translations have been generated by
229
225
the messages extractor.
230
226
231
227
a( id ="use-jit" )
@@ -238,7 +234,7 @@ a(id="use-jit")
238
234
Angular 2 understand `xlf` and `xmb` formats, but we have to provide these message into our application.
239
235
To do that we will have to define a few providers at bootstrap time.
240
236
241
- Let's say that we have the following bootstrap file:
237
+ Having the following bootstrap file:
242
238
243
239
+ makeExample('i18n/ts-snippets/i18n.config.snippets.ts' , 'bootstrap' )( format ="." )
244
240
@@ -291,7 +287,7 @@ a(id="use-aot")
291
287
If we want to generate precompiled files for our french translations, we will use:
292
288
293
289
code-example( language ="sh" ) .
294
- ngc --i18nFile=./src /i18n/messages.fr.xlf --locale=fr --i18nFormat=xlf
290
+ ngc --i18nFile=./app /i18n/messages.fr.xlf --locale=fr --i18nFormat=xlf
295
291
296
292
.alert.is-helpful
297
293
:marked
0 commit comments