new Intl.Locale(tag) turns a locale string into an object with properties such as language, region and script. Methods like maximize() and minimize() fill in or remove likely subtags.
Some engines also expose helpers such as calendars and hourCycles for what that locale commonly uses.
Remember
new Intl.Locale(tag)
loc.language / loc.region / loc.script
loc.maximize() / loc.minimize()
tag example: "ja-JP" or "en-Latn-US"
Syntax
Create a Locale from a tag, then read its parts.
JavaScript
const loc = new Intl.Locale("ja-JP");
console.log(loc.language + "-" + loc.region);
The Try It page first checks that Intl.Locale exists, because it may be missing in older browsers. In an older browser it prints a short explanation and the output above. In current browsers it runs the code for real.
How It Works
Split the tag. Language is ja, region is JP.
toString. Rebuilds a canonical tag string.
No guessing yet. Script is empty until you maximize.
Example 2 — Add and Remove Likely Subtags
Maximize fills in the likely script. Minimize removes what can be inferred.
JavaScript
const ja = new Intl.Locale("ja-JP").maximize();
const en = new Intl.Locale("en-Latn-US").minimize();
console.log("maximize: " + ja.language + "|" + ja.script + "|" + ja.region);
console.log("minimize: " + en.toString());
The Try It page first checks that Intl.Locale exists, because it may be missing in older browsers. In an older browser it prints a short explanation and the output above. In current browsers it runs the code for real.
How It Works
maximize. Japanese in Japan likely uses the Jpan script.
minimize.en-Latn-US can shrink to en when subtags are the likely defaults.
New objects. Both methods return a Locale; they do not mutate the original.
Example 3 — Calendars and Hour Cycles
Read common calendars and hour cycles for Japanese (Japan).
The Try It page first checks that Intl.Locale exists, because it may be missing in older browsers. In an older browser it prints a short explanation and the output above. In current browsers it runs the code for real.
How It Works
calendars. Japan commonly lists Gregorian and Japanese calendars.
hourCycles.h23 means a 0β23 hour clock preference.
Engine data. These helpers describe locale preferences, not a guarantee for every formatter option.
Compatibility
Browser & Runtime Support
Intl.Locale arrived with the Intl.Locale proposal (ES2018βES2020). Current browsers and Node.js 12+ support it.
✓ ES2020 · Widely supported
Intl.Locale
Supported in Chrome 74+, Edge 79+, Firefox 75+, Safari 14+, Opera 62+ and Node.js 12+.
ES2020Standard since
Google Chrome74+ · Desktop & Mobile
Full support
Microsoft Edge79+ · Chromium based
Full support
Mozilla Firefox75+ · Desktop & Mobile
Full support
Apple Safari14+ · macOS & iOS
Full support
Opera62+ · Chromium based
Full support
Samsung InternetRecent versions · Android
Supported
Android WebView74+ · Chromium based
Supported
Node.js12+ · Server runtime
Supported
DenoSupported · JavaScript runtime
Supported
BunSupported · JavaScript runtime
Supported
Internet ExplorerNo native support
Not supported
Intl.LocaleExcellent
Bottom line: Safe in current browsers. Guard with typeof Intl.Locale === "function" for older engines.
Frequently Asked Questions
It parses a locale tag into properties such as language, region and script, and can maximize or minimize likely subtags.
It adds likely missing subtags, for example the script Jpan for ja-JP.
It removes subtags that can be inferred from likely defaults, which can shorten a tag.
Yes. Intl formatters accept a Locale object or a string tag.
On older engines, check typeof Intl.Locale === "function" before constructing one.