
- Angular CLI Tutorial
- Angular CLI - Home
- Angular CLI - Overview
- Angular CLI - Environment Setup
- Angular CLI Commands
- Angular CLI - ng version
- Angular CLI - ng new
- Angular CLI - ng help
- Angular CLI - ng generate
- Angular CLI - ng build
- Angular CLI - ng run
- Angular CLI - ng serve
- Angular CLI - ng lint
- Angular CLI - ng test
- Angular CLI - ng e2e
- Angular CLI - ng add
- Angular CLI - ng analytics
- Angular CLI - ng config
- Angular CLI - ng doc
- Angular CLI - ng update
- Angular CLI - ng xi18n
- Angular CLI - Code Coverage
- Angular CLI - ng cache Command
- Angular CLI - ng completion Command
- Angular CLI - ng deploy Command
- Angular CLI - ng extracti18n Command
- Angular CLI Useful Resources
- Angular CLI - Quick Guide
- Angular CLI - Useful Resources
- Angular CLI - Discussion
Angular CLI - ng xi18n Command
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 xi18n
As we know, this command is no longer supported in the latest CLI version, so it might throw an error:
Error: Unknown argument: xi18n