jeresig / i18n-node-2

Lightweight simple translation module for node.js / express.js with dynamic json storage. Uses common __('...') syntax in app and templates.
MIT License
507 stars 79 forks source link

Feature Request: override current language manually #109

Closed omar84 closed 7 years ago

omar84 commented 7 years ago

First, thanks for the great work you've done here..

I'd like to be able to override the current language, to show a translation of the phrase I want to use.

it could be something like:

languages = ['en', 'fr']; // assuming the default language is 'en' console.log( req.i18n.('global.language') ); //prints: English console.log( req.i18n.o('fr', 'global.language') ); //prints: Français

Can this be done? and how soon? Thanks.

gjuchault commented 7 years ago

https://github.com/jeresig/i18n-node-2/blob/master/i18n.js#L153

You might want to try using translate directly

omar84 commented 7 years ago

Worked perfectly.. thanks :)