What is ngx-translate?
NGX-Translate is an internationalization library for Angular. It lets you define translations for your content in different languages and switch between them easily. Check out the demo on StackBlitz.
It gives you access to a service, a directive and a pipe to handle any dynamic or static content.
NGX-Translate is also extremely modular. It is written in a way that makes it really easy to replace any part with a custom implementation in case the existing one doesn't fit your needs.
How to use ngx-translate?
The main part of the library is named
core. You can use it on its own, but it is usually a good
idea to add a loader to load your translations into your application.
Head over to the core documentation to get started in 5 minutes and then choose one of the following loaders (or write your own):
- Http Loader: load json translation files with http
- Angular Universal Loader: load json translation files with fs instead of http
- Po Loader: load .po files with http
You can also extract the strings from your code with the extractor. This makes it really easy to start and maintain your translations.
This tutorial explains how to use ngx-translate, ngx-translate-extract and BabelEdit to translate your Angular app.
- BabelEdit — translation editor for JSON files
A question? An Issue?
Head over to the core repository to ask a question or post an issue. You can also contact me on twitter if you prefer.