[Mifos-developer] Translations in Mifos X Web Apps: Angular's Internationalization vs ngx-translate

11 views
Skip to first unread message

Abhay Chawla

unread,
Jul 27, 2019, 12:01:02 PM7/27/19
to Ed Cable, Pranjal Goswami, Jivjyot Singh, Cajetan Rodrigues, Ankit Raj Ojha, Gaurav Saini, Mifos software development, Dev
Hello Everyone,

In the previous year's Google Summer of Code, we(Ed, Gaurav and I) initiated a discussion regarding the implementation of translations within the web-app wherein the various possibilities using which it can be done was discussed. As talked about in today's meeting I would like to share it with the community so we could further the discussion on the same.

Angular's Internationalization (https://angular.io/guide/i18n) is an official library provided by Angular to support translations. But it has a few drawbacks as of now considering our use case. 
1) It does not support runtime translations. That means every time we need to switch the language we need to rebuild the project which is not feasible. The project can only be built using a single language at once and then used.
2) The current translation files in the community-app, as well as the web-self-service-app, are in JSON format which is not supported by i18n. The only supported formats are XLIFF or XML. That means we cannot reuse the existing translations which will be a drawback for the web-app(as it is a large project with a lot of translations implemented already in community app) but not as much for the online-banking-app.

On the other hand, there is a 3rd party library called ngx-translate (https://github.com/ngx-translate/core) which overcomes both these drawbacks as it allows the use of JSON and supports runtime translation. 
But it being a 3rd party library is not officially supported neither tested(might have bugs or shortcomings) to the extent of Angular's official packages. That means we don't know for how long it will be kept updated/in sync to support Angular's updates. Its usage might lead to issues in the long run. If we decide to use it we will have to discuss the problems within the library that might lead to bugs and if they could be avoided.

There is an ongoing development by Angular's team to support runtime translations with the release of ivy. If that is implemented we would have official support but still, we might not be able to use the existing translation files unless there is JSON support. However, it is uncertain when it will be released. Looking at the recent comments in [1], I believe it isn't happening soon. 

References:

We could further discuss on this so that a decision can be made on how translations can proceed within the web-app projects.

Thanks,
Abhay.

Awasum Yannick

unread,
Jul 27, 2019, 12:34:20 PM7/27/19
to Dev, Pranjal Goswami, Mifos software development
Hi All,

Fims web app(written in Angular 2+) from Fineract CN has already supports English and Spanish: https://github.com/apache/fineract-cn-fims-web-app/tree/develop/src/assets/i18n

Maybe we should look at the way its been done there and learn from it. Looks like its ngx-translate: https://github.com/ngx-translate/core which is MIT licensed and actively maintained(last commit 2 days ago).

Translation is very important for Mifos and Fineract. Should we wait for the Angular team to finish their i18n implementation?


Thanks.
Awasum


Reply all
Reply to author
Forward
0 new messages