Angular CLI - Ng Xi18n Command - Tutorialspoint
This chapter will discuss the Angular CLI ng xi18n command, including its syntax, arguments, options, and an example that shows how to use it in an Angular application.
The 'ng xi18n' Command
This ng xi18n Angular CLI command is used to extracts i18n messages from source code.
In software development, the term "i18n messages" refer to the process of designing and preparing software applications for global use.
This command is no longer supported in the latest CLI version. The Angular team recommends to use the extract-i18n command instead.
Syntax
Following is the syntax of the Angular CLI ng xi18n command −
ng xi18n <project> [options] ng i18n-extract <project> [options]Here,
- project: The name of the project to build. It can be an application or a library.
- options: These are the optional flags (options) that modify the behavior of the command.
Arguments
The argument for ng xi18n command is as follows −
| Sr.No. | Argument & Description |
|---|---|
| 1 | <project> The name of the project. It can be an application or library. |
Options
Below is a list of a few commonly used options (flags) with this command −
| Sr.No. | Option & 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 |
| 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 |
Example
Following is an example of using ng xi18n command in an Angular application −
Update your app.component.html code with the code below:
<div class="content" role="main"> <span i18n>app is running!</span> </div> <app-goals></app-goals> <router-outlet></router-outlet>Now the run the following command:
ng xi18nAs we know, this command is no longer supported in the latest CLI version, so it might throw an error:
Error: Unknown argument: xi18n Print Page Previous Next AdvertisementsTừ khóa » Ng Xi18n
-
Ng Xi18n - Angular
-
Ng Extract-i18n - Angular
-
Ng Xi18n - Angular 10 - W3cubDocs
-
Angular - Ng Xi18n - W3resource
-
Ng Xi18n Not Working For Library · Issue #17140 - GitHub
-
Exclude Directories From "ng Xi18n" · Issue #18885 - GitHub
-
Ng Xi18n - CLI - Angular References
-
Problems With Ng Xi18n When Adding New Tags - Stack Overflow
-
How To Use Internationalization (i18n) In Angular | DigitalOcean
-
Angular - Ng Xi18n
-
Ng Xi18n - Angular 10 Documentation - TypeError
-
Angular CLI - Ng Xi18n Command - Adglob Infosystem Pvt Ltd
-
Angular I18n: Performing Translations With Built-in Module - Lokalise
-
Ng Extract-i18n - Angular