Internationalization & Localization
The generated application has Internationalization & Localization support. By default, all the code for Internationalization (I18N) and Localization (L10N) is provided in the generated application even when the Internationalization add-on is not selected. When this add-on is selected, the generated application UI has radio-buttons to allow the end-user to switch between the different locales.
Adding New Locales
You can support a new language by adding a new language file under src/assets/i18n folder and adding its entry in the src/app/app.component.ts file.
Each application, by default has an en.json in src/assets/i18n that represents the U.S. English language. If you want to support another language such as french, you’ll need to follow the steps below:
Create a new file named fr.json
Copy the contents of en.json into fr.json
Update the value of each key in french
en.json already has a key entry for English language i.e. “en” at the root-level. Add a key named "fr" to this file. Similarly, fr.json already has a key entry for the English language as the contents of the en.json were copied into fr.json. Add a key named "fr" to this file.
- Add “fr” in the list of languages in src/app/app.component.ts file.
Updated almost 2 years ago