Angular uses the Unicode locale identifier (Unicode locale ID) to find the correct locale data for internationalization of text strings.
A locale ID specifies the language, country, and an optional code for further variants or subdivisions. A locale ID consists of the language identifier, a dash (-
) character, and the locale extension.
{language_id}-{locale_extension}
To accurately translate your Angular project, you must decide which languages and locales you are targeting for internationalization.
Many countries share the same language, but differ in usage. The differences include grammar, punctuation, formats for currency, decimal numbers, dates, and so on.
For the examples in this guide, use the following languages and locales.
Language | Locale | Unicode locale ID |
---|---|---|
English | Canada | en-CA |
English | United States of America | en-US |
French | Canada | fr-CA |
French | France | fr-FR |
The Angular repository includes common locales.
For a list of language codes, see ISO 639-2.
Use the Angular CLI to set the source language in which you are writing the component template and code.
By default, Angular uses en-US
as the source locale of your project.
To change the source locale of your project for the build, complete the following actions.
angular.json
workspace build configuration filesourceLocale
field
© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v12.angular.io/guide/i18n-common-locale-id