The Intl.Locale.prototype.minimize()
method attempts to remove information about the locale that would be added by calling Locale.maximize()
.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Syntax
locale.minimize()
Return value
A Locale
instance whose baseName
property returns the result of the Remove Likely Subtags algorithm executed against locale.baseName
.
Description
This method carries out the reverse of language identifier: language, script, and region subtags. Other subtags after the "-u" in the locale indentifier are called extension subtags and are not affected by the minimize() method. Examples of these subtags include Locale.hourCycle
, Locale.calendar
, and Locale.numeric
.
Examples
let myLocale = new Intl.Locale("fr-Latn-FR", {hourCycle: "h24", calendar: "gregory"}); console.log(myLocale.baseName); // Prints "fr-Latn-FR" console.log(myLocale.toString()); // Prints "fr-Latn-FR-u-ca-gregory-hc-h24" let myLocMinimized = myLocale.minimize(); console.log(myLocMinimized.baseName); // Prints "fr", since French is only written in the Latin script and is most likely to be spoken in France. console.log(myLocMinimized.toString()); // Prints "fr-u-ca-gregory-hc-h24". Notice that the extension tags (after "-u") remain unchanged.
Specifications
Specification | Status | Comment |
---|---|---|
Intl.Locale.prototype.minimize proposal |
Browser compatibility
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
minimize |
Chrome Full support 74 | Edge No support No | Firefox No support No | IE No support No | Opera No support No | Safari No support No | WebView Android Full support 74 | Chrome Android Full support 74 | Firefox Android No support No | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs No support No |
Legend
- Full support
- Full support
- No support
- No support