ECMAScript Internationalization API - Intl
From WikiMLT
The Intl
object is the namespace for the ECMAScript Internationalization API, which provides language sensitive string comparison, number formatting, and date and time formatting. The Intl
object provides access to several constructors as well as functionality common to the internationalization constructors and other language sensitive functions.
Video 1. Web Dev Simplified on YouTube: Formatting Is So Easy With The Intl JavaScript API.
References
- MDN:
Intl
ECMAScript Internationalization API
Simple example
const formatter = new Intl.RelativeTimeFormat("bg-BG", { style: "long" });
formatter.format(-1, "minute");
'преди 1 минута'