📅  最后修改于: 2020-10-27 02:45:08             🧑  作者: Mango
ng xi18n [options]
ng i18n-extract [options]
ng xi18n命令从源代码中提取i18n消息。选项是可选参数。
Sr.No. | Argument & Syntax | Description |
---|---|---|
1 | The name of the project. It can be an application or library. |
Sr.No. | Option & Syntax | Description |
---|---|---|
1 | –browserTarget=browserTarget | Target to extract from. |
2 | –configuration=configuration |
A named build target, as specified in the “configurations” section of angular.json. Each named target is accompanied by a configuration of option defaults for that target. Setting this explicitly overrides the “–prod” flag. Aliases: -c |
3 | –createCommits=true|false |
Create source control commits for updates and migrations. Default: false Aliases: -C |
4 | –format=xmb|xlf|xlif|xliff|xlf2|xliff2 |
Output format for the generated file. Default: xlf |
5 | –help=true|false|json|JSON |
Shows a help message for this command in the console. Default: false |
6 | –outFile=outFile | Name of the file to output. |
7 | –outputPath=outputPath | Path where output will be placed. |
8 | –prod=true|false | Shorthand for “–configuration=production”. When true, sets the build configuration to the production target. By default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination. |
9 | –progress=true|false |
Log progress to the console. Default: true |
首先转到使用ng build命令更新的角度项目。如下更新app.component.html:
app.component.spec.ts
app is running!
现在运行xi18n命令。
\>Node\>TutorialsPoint> ng xi18n
添加本地化支持。
\>Node\>TutorialsPoint> ng add @angular/localize
Installing packages for tooling via npm.
Installed packages for tooling via npm.
UPDATE src/polyfills.ts (3064 bytes)
现在ng将在根文件夹中创建一个messages.xlf文件,该文件是行业标准的转换文件。
messages.xlf
src/app/app.component.html
2