Tutorial showing how to use the Intl JS API in NodeJS (i18n). We’ll install a module to unlock the Intl API languages for Node and test out RelativeTimeFormat to translate and localise relative times in JavaScript. I’ll tell you how to get started with the built-in internationalization library in JS for Node 12 and higher. We’ll change the locale to see how the translation works and test different BCP 47 language tags.

Internationalization is a difficult undertaking but using the Intl API is an easy way to get started, it’s great to see this new API in the JS language and available for use. Soon, you’ll be able to have confidence using it in the browser as modern browsers support the major Intl features. Have a look at the browser compatibility charts to see which browsers and versions of node are supported.

Use Intl.RelativeTimeFormat for language-sensitive relative time formatting.
#javascript #nodejs #webdevelopment

MDN Documentation:


Full ICU NPM package:


#node #nodejs #javascript

How to get started Internationalization in JavaScript with NodeJS
2 Likes35.85 GEEK