I18N with Express/Jade: Strings with embedded tags and interpolation I18N with Express/Jade: Strings with embedded tags and interpolation express express

I18N with Express/Jade: Strings with embedded tags and interpolation


You probably found a solution by now (if so, please tell us what it is), but if you didn't, you might want to look at the i18next-node library. It supports variables, so you could do things like:

// Localized resources{             'en-GB': {    translation: {         space_temperature_is: 'Space temperature is __COUNT__ degrees Celsius.'     }   }  'fr-FR': {    translation: {         space_temperature_is: 'Température de l'espace est de __COUNT__ degrés Celsius.'     }   }};

Then, in your jade template, you would do:

// This translates to "Space temperature is 28 degrees Celsius."i18n.t('space_temperature_is', { COUNT: 28 });

The library is really well documented, but, if you're in a hurry, here's an article that I found useful as a quick introduction.


As we can see it on the short doc, there is a sprinf style functionhttps://github.com/mashpie/i18n-nodeI think this would help you to achive you goal