Codementor Events

Extend @ngx-translate/core Feature with @rxweb/ngx-translate-extension

Published Nov 02, 2020
Extend @ngx-translate/core Feature with @rxweb/ngx-translate-extension

In this article, we will explore how to migrate an exisiting ngx-translate project to @rxweb/ngx-translate-extension which performs translation in the angular application

@rxweb/ngx-translate-extension is an extensible library available with lots of spectacular features which can be used by existing ngx-translate projects as well as non translate integrated projects. This library is designed to perform an extensible, spectatular, simplified and powerful internationalization in an angular application. To know more about this translation package view this article on Why @rxweb/ngx-translate-extension is intuitive than others ?

While looking for the best optimum solution to internationalize the angular project i went through a project on github. This project includes resolving the translation service and using attribute directives and pipes using manual language changing strategy

For existing @ngx-translate projects

Here is How To migrate the existing project and use the extensible features of @rxweb/ngx-translate-extension

I have cloned the github project of angular-localization-ngx and installed the nodemodules using command npm i, It contains one feeback forms which language changing manaually using code in the navbar and the output is as below :

article4.gif

Considering this github project example we need to follow the steps as mentioned below:

Installation

In the project install the necessary packages using below command :

npm i @rxweb/translate @rxweb/ngx-translate-extension

article1.gif

Import Translate Module

Resolve the translate module in app.module.ts by changing the import from @ngx-translate/core to @rxweb/ngx-translate-extension and resolve the global file path as below:

article2.gif

Translate Service Import

In the translate service file change the import the same way as done previously in the root module

The project is now migrated and ready to use the extended features provided by these packages. To ensure whether everything is running perfect and no service is broken check the spec comparison page where the same code is copied by following same steps of @ngx-translate/core

article3.gif

Conclusion

Here we covered the process to migrate the existing translation project to @rxweb/ngx-translate-extension

Among all the features covered by this package the most intuitive features are decorators, sanitizers which arent available in any other translation package currently, Besides this it includes power tool to optimize the translation keys including a powerful CLI

The complete information about this package is covered into the docs, You can share your comments and suggestions on gitter channel.

Discover and read more posts from Ushmi Dave
get started
post commentsBe the first to share your opinion
Diter Knobloch
a year ago

Thanks for the information! I find it very useful. Learning a new language means learning a lot of new words, and this can be overwhelming for many people. That’s why English To Malayalam Translation services are in high demand. They help people overcome language barriers and facilitate international trade.

Devendra Lohar
3 years ago

👍

Show more replies