Dock  Koelpin

Dock Koelpin

1601261940

Internationalise your React Application

In a multi language world (And I’m not talking about programming languages!) We need our web apps to support multiple languages.

But on the developer side, maintaining this multi language support can be a real pain.

For the example of React-intl. Because of their usage of Context to enable the multi language, it is very hard to enable internationalisation in shared libraries and use shared components in your main application (Conflicts, confusion between contexts and more complexity in your app).

React application are already complex enough to add more complexity to the solution.

Another problem will be the storage of the translations. Only one JSON file can be used for one language. We could potentially merge them before sending them to the provider but it’s a complicated and really convenient usage.

Finally, keys are stored are a unique long string where by using JSON, we could simply nest them.


That’s where react-translation changes it!

@psyycker/react-translation

A modern translation library for React

www.npmjs.com

No context, no unique entry point and by using javascript events, no issue of conflicts between 2 versions of the library!

React Translation has been thought in a way where there is no entry point, no wrapper and therefore, no risk of conflict.

It is possible to add translations from different places and merge them automatically. You can them sort them in the way you’d prefer and have a better file architecture. And say bye to the long strings in your json files. You can nest your objects and have a better view on your translation files!

#react #javascript #language #international

Internationalise your React Application