Federico Nardone Aggiutorio
asked on
Angular i18 internationalization, how configure angular.json file
Hi all,
in order to translate my page and in according with this tutorial https://angular.io/guide/i18n I done the following simple operations but I don't see any translated texy. Why? Thank you very much!
1) Translation definitions. In the new folder src/locale I created the files messages.en.xlf and messages.it.xlf, with the following code (obviously it changes the target for each language):
2) Tag definition. In my html page I insert the following tag, with a placeholder:
3) In angular.json file, I insert the following rows:
Then I tried to build and serve but I don't see the translated text "bye bye". How can I solve it? Thank you very much!
in order to translate my page and in according with this tutorial https://angular.io/guide/i18n I done the following simple operations but I don't see any translated texy. Why? Thank you very much!
1) Translation definitions. In the new folder src/locale I created the files messages.en.xlf and messages.it.xlf, with the following code (obviously it changes the target for each language):
<trans-unit id="introductionHeader" datatype="html">
<source>placeholder</source>
<target>Ciao i18n! (it-IT)</target>
<note priority="1" from="description">An introduction header for this sample</note>
<note priority="1" from="meaning">User welcome</note>
<target state="new">bye bye</target>
</trans-unit>
2) Tag definition. In my html page I insert the following tag, with a placeholder:
<h1 i18n="@@introductionHeader">
placeholder
</h1>
3) In angular.json file, I insert the following rows:
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/mobile-client",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"i18nFile": "src/locale/messages.it.xlf", //This
"i18nLocale": "it", //This
"i18nFormat": "xlf", // This
"assets": [
(...)
Then I tried to build and serve but I don't see the translated text "bye bye". How can I solve it? Thank you very much!
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.