Intl.ListFormat.prototype.resolvedOptions()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.
Die Methode resolvedOptions()
von Intl.ListFormat
-Instanzen gibt ein neues Objekt zurück, dessen Eigenschaften die während der Initialisierung dieses ListFormat
-Objekts berechneten Optionen widerspiegeln.
Probieren Sie es aus
const deListFormatter1 = new Intl.ListFormat("de-DE", { type: "disjunction" });
const options1 = deListFormatter1.resolvedOptions();
console.log(options1.locale);
// Expected output (Firefox / Safari): "de-DE"
// Expected output (Chrome): "de"
console.log(options1.style);
// Expected output: "long"
console.log(options1.type);
// Expected output: "disjunction"
Syntax
resolvedOptions()
Parameter
Keine.
Rückgabewert
Ein neues Objekt mit Eigenschaften, die die während der Initialisierung dieses ListFormat
-Objekts berechneten Optionen widerspiegeln. Das Objekt hat die folgenden Eigenschaften, in der Reihenfolge, in der sie aufgelistet sind:
locale
-
Der BCP 47-Sprachcode für das tatsächlich verwendete Gebietsschema, ermittelt durch den Verhandlungsprozess des Gebietsschemas. Kein Unicode-Erweiterungsschlüssel wird in der Ausgabe enthalten sein.
type
-
Der für diese Eigenschaft im
options
-Argument bereitgestellte Wert, mit Standardeinstellungen, falls nötig. Es ist entweder"conjunction"
,"disjunction"
oder"unit"
. Der Standardwert ist"conjunction"
. style
-
Der für diese Eigenschaft im
options
-Argument bereitgestellte Wert, mit Standardeinstellungen, falls nötig. Es ist entweder"long"
,"short"
oder"narrow"
. Der Standardwert ist"long"
.
Beispiele
Verwendung von resolvedOptions
const deListFormatter = new Intl.ListFormat("de-DE", { style: "short" });
const usedOptions = de.resolvedOptions();
console.log(usedOptions.locale); // "de-DE"
console.log(usedOptions.style); // "short"
console.log(usedOptions.type); // "conjunction" (the default value)
Spezifikationen
Specification |
---|
ECMAScript® 2025 Internationalization API Specification # sec-Intl.ListFormat.prototype.resolvedoptions |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
resolvedOptions |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- See implementation notes.