O'Reilly logo

Cross-platform Desktop Application Development: Electron, Node, NW.js, and React by Dmitry Sheiko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Multilingual support

Localization dates and numbers is a good thing, but it will be more exciting to provide translation to multiple languages. We have a number of terms across the application, namely, the column titles of the file list and tooltips (via the title attribute) on windowing action buttons. What we need is a dictionary. Normally, it implies sets of token translation pairs mapped to language codes or locales. Thus, when you request from the translation service a term, it can correlate to a matching translation according to the currently used language/locale.

Here, I have suggested making the dictionary a static module that can be loaded with the required function:

./js/Data/dictionary.js

exports.dictionary = {   "en-US": {  NAME: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required