Angular Translation in 4 steps only
Internationalization with @ngx-translate/core and @ngx-translate/http-loader
Step1: Installation:
npm i --save @ngx-translate/core @ngx-translate/http-loader
NB: if you’re still on Angular <4.3, please use Http from @angular/http with http-loader@0.1.0.
Read more: https://www.npmjs.com/package/@ngx-translate/core
Step 2: Importation:
After installing @ngx-translate/core and @ngx-translate/http-loader it’s time now to import them into out module.
Step 3: Define the translations:
Once you’ve imported the TranslateModule
, you can put your translations in a json file that will be imported with the TranslateHttpLoader
. The following translations should be stored in en.json
.
en.json
fr.json
Step 4: Use it now ;)
Summary
You can find the full project on GitHub.
Did you learn something new? If so please:
→ clap 👏 button below️ so more people can see this
Do you have questions?
Please leave your comments and queries in Medium, or contact me on Linkedin. I’m always happy to hear your suggestions or improvements. 👨💻