From 4b1a9203c547c019fc5398082ae19a3f3d4c3efe Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:15 -0500 Subject: initial commit --- .../intl/collator/compare/index.html | 101 +++++++++ .../global_objects/intl/collator/index.html | 179 +++++++++++++++ .../intl/collator/prototype/index.html | 79 +++++++ .../intl/collator/resolvedoptions/index.html | 100 +++++++++ .../intl/collator/supportedlocalesof/index.html | 98 ++++++++ .../intl/datetimeformat/format/index.html | 101 +++++++++ .../intl/datetimeformat/formattoparts/index.html | 169 ++++++++++++++ .../global_objects/intl/datetimeformat/index.html | 248 +++++++++++++++++++++ .../intl/datetimeformat/prototype/index.html | 83 +++++++ .../intl/datetimeformat/resolvedoptions/index.html | 107 +++++++++ .../datetimeformat/supportedlocalesof/index.html | 99 ++++++++ .../intl/getcanonicallocales/index.html | 74 ++++++ .../reference/global_objects/intl/index.html | 129 +++++++++++ .../intl/numberformat/format/index.html | 98 ++++++++ .../global_objects/intl/numberformat/index.html | 195 ++++++++++++++++ .../intl/numberformat/prototype/index.html | 81 +++++++ .../numberformat/supportedlocalesof/index.html | 98 ++++++++ .../global_objects/intl/pluralrules/index.html | 161 +++++++++++++ .../intl/pluralrules/supportedlocalesof/index.html | 85 +++++++ 19 files changed, 2285 insertions(+) create mode 100644 files/de/web/javascript/reference/global_objects/intl/collator/compare/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/collator/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/collator/prototype/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/collator/resolvedoptions/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/collator/supportedlocalesof/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/datetimeformat/format/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/datetimeformat/formattoparts/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/datetimeformat/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/datetimeformat/prototype/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/datetimeformat/resolvedoptions/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/datetimeformat/supportedlocalesof/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/getcanonicallocales/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/numberformat/format/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/numberformat/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/numberformat/prototype/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/numberformat/supportedlocalesof/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/pluralrules/index.html create mode 100644 files/de/web/javascript/reference/global_objects/intl/pluralrules/supportedlocalesof/index.html (limited to 'files/de/web/javascript/reference/global_objects/intl') diff --git a/files/de/web/javascript/reference/global_objects/intl/collator/compare/index.html b/files/de/web/javascript/reference/global_objects/intl/collator/compare/index.html new file mode 100644 index 0000000000..c54c1a2869 --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/collator/compare/index.html @@ -0,0 +1,101 @@ +--- +title: Intl.Collator.prototype.compare +slug: Web/JavaScript/Reference/Global_Objects/Intl/Collator/compare +tags: + - Collator + - Internationalization + - JavaScript + - Property + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Collator/compare +--- +
{{JSRef}}
+ +

Die Intl.Collator.prototype.compare Eigenschaft gibt eine Funktion zurück, die zwei Strings, abhängig von der Sortierreihenfolge des {{jsxref("Collator")}} Objektes, vergleicht.

+ +
{{EmbedInteractiveExample("pages/js/intl-collator-prototype-compare.html")}}
+ + + +

Syntax

+ +
collator.compare(string1, string2)
+ +

Parameter

+ +
+
string1
+
string2
+
Die Strings, die miteinander verglichen werden sollen.
+
+ +

Beschreibung

+ +

Die Funktion, die von dem Getter compare zurückgegeben wird, gibt eine Zahl zurück, die angibt, wie string1 und string2 in der Sortierreihenfolge des {{jsxref("Collator")}} Objektes zueinander stehen: Ein negativer Wert gibt an, string1 vor string2 kommt; Ein positiver Wert gibt an, dass string1 nach string2 kommt; 0 gibt an, dass beide gleich sind.

+ +

Beispiele

+ +

Einsatz von compare zum Sortieren von Arrays

+ +

Man kann die vom Getter compare zurückgegebenen Funktion zum Sortieren von Arrays einsetzen. Zu beachten ist, dass diese Funktion an das collator-Objekte gebunden ist, auf dem es aufgerufen wurde, so dass es direkt an {{jsxref("Array.prototype.sort()")}} übergeben werden kann.

+ +
var a = ['Offenbach', 'Österreich', 'Odenwald'];
+var collator = new Intl.Collator('de-u-co-phonebk');
+a.sort(collator.compare);
+console.log(a.join(', '));
+// → "Odenwald, Österreich, Offenbach"
+
+ +

Einsatz von compare zum Suchen in Arrays

+ +

Man kann die vom Getter compare zurückgegebenen Funktion zum suchen von passenden Elementen in einem Array benutzen:

+ +
var a = ['Congrès', 'congres', 'Assemblée', 'poisson'];
+var collator = new Intl.Collator('fr', { usage: 'search', sensitivity: 'base' });
+var s = 'congres';
+var matches = a.filter(v => collator.compare(v, s) === 0);
+console.log(matches.join(', '));
+// → "Congrès, congres"
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-10.3.2', 'Intl.Collator.prototype.compare')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-10.3.2', 'Intl.Collator.prototype.compare')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#sec-Intl.Collator.prototype.compare', 'Intl.Collator.prototype.compare')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.Collator.compare")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/collator/index.html b/files/de/web/javascript/reference/global_objects/intl/collator/index.html new file mode 100644 index 0000000000..1ed4bb3f34 --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/collator/index.html @@ -0,0 +1,179 @@ +--- +title: Intl.Collator +slug: Web/JavaScript/Reference/Global_Objects/Intl/Collator +tags: + - Collator + - Internationalization + - JavaScript +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Collator +--- +
{{JSRef}}
+ +

Das Intl.Collator Objekt ist ein Konstruktor für Überprüfer, Objekte die Sprachsensitive Stringvergleiche unterstützen.

+ +
{{EmbedInteractiveExample("pages/js/intl-collator.html")}}
+ + + +

Syntax

+ +
new Intl.Collator([locales[, options]])
+Intl.Collator.call(this[, locales[, options]])
+ +

Parameter

+ +
+
locales
+
+

Optional. Ein String mit einem BCP 47 Sprachtag, oder einem Array von solchen Strings. Für die generelle Interpretation für das locales Argument, siehe auf der {{jsxref("Global_Objects/Intl", "Intl Seite", "#Gebietsidentifikation_und_-verhandlung", 1)}} nach. Die folgenden Unicode-Erweiterunsschlüssel sind erlaubt:

+ +
+
co
+
Abweichender Vergleich für einige Gebiete. Folgende Werte sind möglich: "big5han", "dict", "direct", "ducet", "gb2312", "phonebk", "phonetic", "pinyin", "reformed", "searchjl", "stroke", "trad", "unihan". Die Werte "standard" und "search" werden ignoriert. Sie werden durch die EIgenschaft usage des options Objekt ersetzt (siehe unten).
+
kn
+
Wenn numerische Vergleiche benutzt werden soll, so wie "1" < "2" < "10". Mögliche Werte sind "true" und "false". Diese Option kann über eine options Eigenschaft oder über einen Unicode-Erweiterungsschlüssel gesetzt werden. Wenn beide gesetzt sind, hat die options Eigenschaft Vorrang.
+
kf
+
Wenn Kleinschreibung oder Großschreibung zuerst in der Reihenfolge kommt. Mögliche Wert sind "upper", "lower", or "false" (benutzt den Gebietsstandard). Diese Option kann über eine options Eigenschaft oder über einen Unicode-Erweiterungsschlüssel gesetzt werden. Wenn beide gesetzt sind, hat die options Eigenschaft Vorrang.
+
+
+
options
+
+

Optional. Ein Objekt einigen oder allen der folgenden Eigenschafte:

+ +
+
localeMatcher
+
Der Algorithmus zur Ermittlung des Gebiets. Mögliche Werte sind "lookup" and "best fit"; Der Standard ist "best fit". Für Informationen über diese Option siehe auf der {{jsxref("Global_Objects/Intl", "Intl Seite", "#Gebietsauswahl", 1)}} nach.
+
usage
+
Ob der Vergleich für das Sortieren oder Suchen von Strings ist. Mögliche Werte sind "sort" and "search"; der Standard ist "sort".
+
sensitivity
+
+

Welche Unterschiede in Strings sollen zu Resultaten ungleich 0 führen. Mögliche Werte:

+ +
    +
  • "base": Nur Strings die im Basisbuchstaben ungleiche sind. Beispiele: a ≠ b, a = á, a = A.
  • +
  • "accent": Nur Strings die im Basisbuchstaben oder Akzent und anderen diakritisch Zeichen ungleich sind. Beispiele: a ≠ b, a ≠ á, a = A.
  • +
  • "case": Nur Strings die im Basisbuchstaben oder der Größe ungleich sind. Beispiele: a ≠ b, a = á, a ≠ A.
  • +
  • "variant": Strings, die im Basisbuchstaben, im Akzent und anderen diakritischen Zeichen oder in der Großschreibung ungleich sind. Andere Unterschiede können in den Vergleich eingehen. Beispiele: a ≠ b, a ≠ á, a ≠ A.
  • +
+ +

Der Standardwert ist "variant" wenn usage auf "sort" steht. Für usage gleich "search" ist es Gebietsabhängig.

+
+
ignorePunctuation
+
Wenn Interpunktion ignoriert werden soll. Mögliche Werte sind true and false; Der Standard ist false.
+
numeric
+
Wenn numerische Vergleiche benutzt werden soll, so wie "1" < "2" < "10". Mögliche Werte sind "true" und "false". Der Standard ist false. Diese Option kann über eine options Eigenschaft oder über einen Unicode-Erweiterungsschlüssel gesetzt werden. Wenn beide gesetzt sind, hat die options Eigenschaft Vorrang. Implementierungen müssen diese Eigenschaft nicht unterstützen.
+
caseFirst
+
Wenn Kleinschreibung oder Großschreibung zuerst in der Reihenfolge kommt. Mögliche Wert sind "upper", "lower", or "false" (benutzt den Gebietsstandard). Der Standard ist "false". Diese Option kann über eine options Eigenschaft oder über einen Unicode-Erweiterungsschlüssel gesetzt werden. Wenn beide gesetzt sind, hat die options Eigenschaft Vorrang. Implementierungen müssen diese Eigenschaft nicht unterstützen.
+
+
+
+ +

Beschreibung

+ +

Das Intl.Collator Objekt hat die folgenden Eigenschaften und Methoden:

+ +

Eigenschaften

+ +
+
{{jsxref("Collator.prototype", "Intl.Collator.prototype")}}
+
Erlaubt das hinzufügen von Eigenschaften zu allen Objekten.
+
+ +

Methoden

+ +
+
{{jsxref("Collator.supportedLocalesOf", "Intl.Collator.supportedLocalesOf()")}}
+
Gibt ein Array von Gebieten zurück, die unterstützt werden, ohne dass die Backuplösung des Umgebungsstandards eingesetzt wird.
+
+ +

Collator Instanzen

+ +

Eigenschaften

+ +

Collator Instanzen erben die folgenden Eigenschaften von ihrem Prototyp:

+ +
{{page('de/docs/Web/JavaScript/Reference/Global_Objects/Collator/prototype', 'Eigenschaften')}}
+ +

Methoden

+ +

Collator Instanzen erben die folgenden Methoden von ihrem Prototyp:

+ +
{{page('de/docs/Web/JavaScript/Reference/Global_Objects/Collator/prototype', 'Methoden')}}
+ +

Beispiele

+ +

Einsatz von Collator

+ +

Das folgende Beispiel demonstriert die potentiell Unterschiedlichen Ergebnisse für ein String vor, nach, oder an der selben Stelle in ein andere String in der Sortierreihenfolge:

+ +
console.log(new Intl.Collator().compare('a', 'c')); // → ein negativer Wert
+console.log(new Intl.Collator().compare('c', 'a')); // → ein positiver Wert
+console.log(new Intl.Collator().compare('a', 'a')); // → 0
+
+ +

Zu beachten ist, dass sich das im Quelltext gezeigte Ergebnis zwischen Browsern und Browserversionen unterscheiden kann. Das ist, weil die Werte implementierungsabhängig sind. Die Spezifikation definiert nur, dass die Werte vor und nach gleich negativ und positiv sein müssen.

+ +

Einsatz von locales

+ +

Das Ergebnis von {{jsxref("Collator.prototype.compare()")}} variiert zwischen Sprachen. Um die Sortierreihenfolge eine Sprache im Benutzerinterface eine Applikation zu bekommen, sollte man die Sprache mit dem locales Argument spezifizieren (und einige Backupsprachen):

+ +
// in German, ä sorts with a
+console.log(new Intl.Collator('de').compare('ä', 'z'));
+// → a negative value
+
+// in Swedish, ä sorts after z
+console.log(new Intl.Collator('sv').compare('ä', 'z'));
+// → a positive value
+
+ +

Einsatz von options

+ +

Das Ergebnis von {{jsxref("Collator.prototype.compare()")}} kann durch den Einsatz des options Argument verändert werden:

+ +
// in German, ä has a as the base letter
+console.log(new Intl.Collator('de', { sensitivity: 'base' }).compare('ä', 'a'));
+// → 0
+
+// in Swedish, ä and a are separate base letters
+console.log(new Intl.Collator('sv', { sensitivity: 'base' }).compare('ä', 'a'));
+// → a positive value
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-10.1', 'Intl.Collator')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-10.1', 'Intl.Collator')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#collator-objects', 'Intl.Collator')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.Collator")}}

+
+ +

Siehe auch

+ +
{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/Intl', 'Siehe_auch')}}
diff --git a/files/de/web/javascript/reference/global_objects/intl/collator/prototype/index.html b/files/de/web/javascript/reference/global_objects/intl/collator/prototype/index.html new file mode 100644 index 0000000000..2528ecc7ba --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/collator/prototype/index.html @@ -0,0 +1,79 @@ +--- +title: Intl.Collator.prototype +slug: Web/JavaScript/Reference/Global_Objects/Intl/Collator/prototype +tags: + - Collator + - Internationalization + - JavaScript + - Property + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Collator +--- +
{{JSRef}}
+ +

Die Intl.Collator.prototype Eigenschaft repräsentiert das Prototypobjekt für den {{jsxref("Collator", "Intl.Collator")}} Konstruktor.

+ +
{{js_property_attributes(0, 0, 0)}}
+ +

Beschreibung

+ +

Siehe im Beitrag {{jsxref("Collator")}} für eine Beschreibung von Intl.Collator Instanzen.

+ +

{{jsxref("Collator", "Intl.Collator")}} Instanzen erben von Intl.Collator.prototype. Änderungen am Prototypobjekt werden an alle {{jsxref("Collator", "Intl.Collator")}} Instanzen vererbt.

+ +

Eigenschaften

+ +
+
{{jsxref("Collator.compare", "Intl.Collator.prototype.compare")}}
+
Getter; gibt eine Funktion zurück, die zwei Strings abhängig vom der Sortierreihenfolge des {{jsxref("Global_Objects/Collator", "Intl.Collator")}} Objektes vergleicht.
+
Intl.Collator.prototype.constructor
+
Eine Referenz zu {{jsxref("Global_Objects/Collator", "Intl.Collator")}}.
+
+ +

Methoden

+ +
+
{{jsxref("Collator.resolvedOptions", "Intl.Collator.prototype.resolvedOptions()")}}
+
Gibt ein neues Objekt mit Eigenschaften zu Gebiets- und Collation-Optionen, die bei der Initialisierung des Objekte ermittelt wurden.
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-10.2.1', 'Intl.Collator.prototype')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-10.2.1', 'Intl.Collator.prototype')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#sec-Intl.Collator.prototype', 'Intl.Collator.prototype')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.Collator.prototype")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/collator/resolvedoptions/index.html b/files/de/web/javascript/reference/global_objects/intl/collator/resolvedoptions/index.html new file mode 100644 index 0000000000..322621017f --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/collator/resolvedoptions/index.html @@ -0,0 +1,100 @@ +--- +title: Intl.Collator.prototype.resolvedOptions() +slug: Web/JavaScript/Reference/Global_Objects/Intl/Collator/resolvedOptions +tags: + - Collator + - Internationalization + - JavaScript + - Method + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Collator/resolvedOptions +--- +
{{JSRef}}
+ +

Die Intl.Collator.prototype.resolvedOptions() Methode gibt ein neues Objekt mit Eigenschaften zurück, welches die Gebiets- und Vergleichs-Optionen während der Initialisierung des {{jsxref("Collator")}} Objektes wiederspiegelt.

+ +
{{EmbedInteractiveExample("pages/js/intl-collator-prototype-resolvedoptions.html")}}
+ + + +

Syntax

+ +
collator.resolvedOptions()
+ +

Rückgabewert

+ +

Ein neues Objekt mit Eigenschaften, die die Eigenschaften der Gebiets- und Vergleichsoptionen enthält, die während der Initialisierung des gegebenen {{jsxref("Collator")}} Objekt ermittelt wurden.

+ +

Beschreibung

+ +

Das Ergebnisobjekt hat die folgenden Eigenschaften:

+ +
+
locale
+
Der BCP 47 Sprachtag für das aktuell benutzte Gebiet. Wenn Unicode-Erweiterungswerte im BCP 47 Sprachtag in der Gebietsangabe angegeben sind, sind die, die auch unterstützt sind, in locale vorhanden.
+
usage
+
sensitivity
+
ignorePunctuation
+
Die Werte der Unterstützten Eigenschaften des options Argument oder eingesetzte Standardwerte.
+
collation
+
Der überbene Wert des Unicode-Werweiterungsschlüssels "co", wenn dieser für locale unterstützt wird oder "default".
+
numeric
+
caseFirst
+
Die Werte der Unterstützten Eigenschaften des options Argument oder der eingesetzten Unicode-Erweiterungsschlüssel "kn" and "kf" oder den Standardwerten. Wenn die Implimentierung diese Eigenschaften nicht unterstützt, werden diese weggelassen.
+
+ +

Beispiele

+ +

Einsatz der resolvedOptions Methode

+ +
var de = new Intl.Collator('de', { sensitivity: 'base' })
+var usedOptions = de.resolvedOptions();
+
+usedOptions.locale;            // "de"
+usedOptions.usage;             // "sort"
+usedOptions.sensitivity;       // "base"
+usedOptions.ignorePunctuation; // false
+usedOptions.collation;         // "default"
+usedOptions.numeric;           // false
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-10.3.3', 'Intl.Collator.prototype.resolvedOptions')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-10.3.3', 'Intl.Collator.prototype.resolvedOptions')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#sec-Intl.Collator.prototype.resolvedOptions', 'Intl.Collator.prototype.resolvedOptions')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.Collator.resolvedOptions")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/collator/supportedlocalesof/index.html b/files/de/web/javascript/reference/global_objects/intl/collator/supportedlocalesof/index.html new file mode 100644 index 0000000000..8bc9bed6bb --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/collator/supportedlocalesof/index.html @@ -0,0 +1,98 @@ +--- +title: Intl.Collator.supportedLocalesOf() +slug: Web/JavaScript/Reference/Global_Objects/Intl/Collator/supportedLocalesOf +tags: + - Collator + - Internationalization + - JavaScript + - Method +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Collator/supportedLocalesOf +--- +
{{JSRef}}
+ +

Die Intl.Collator.supportedLocalesOf() Methode gibt ein Array zurück, welches die Gebiete enthält, die von Collation unterstützt werden, ohne das die Laufzeitumgebung auf den Systemstandard zurückgreifen muss.

+ +
{{EmbedInteractiveExample("pages/js/intl-collator-prototype-supportedlocalesof.html")}}
+ + + +

Syntax

+ +
Intl.Collator.supportedLocalesOf(locales[, options])
+ +

Parameter

+ +
+
locales
+
Ein String mit einem BCP 47 Sprachtag oder einem Array von solchen. Für die generelle Form des locales Argument siehe die {{jsxref("Global_Objects/Intl", "Intl Seite", "#Gebietsidentifikation_und_-verhandlung", 1)}}.
+
options
+
+

Optional. Ein Objekt welches die folgenden Eigenschaften haben kann:

+ +
+
localeMatcher
+
Der Auswahlalgorithmus für das Gebiet. Mögliche Werte sind "lookup" and "best fit"; Der Standard ist "best fit". Mehr Informationen über diese Algorithmen sind auch der {{jsxref("Global_Objects/Intl", "Intl Seite", "#Gebietsauswahl", 1)}} verfügbar.
+
+
+
+ +

Rückgabewert

+ +

Ein Array von String, welches eine Untermenge von  Gebiete enthält, die von Collation unterstützt werden, ohne das die Laufzeitumgebung auf den Systemstandard zurückgreifen muss.

+ +

Beschreibung

+ +

Gibt ein Array mit einer Untermenge von Sprachtags, die in locales angegeben sind zurück. Die Sprachtags, die zurückgegeben werden, werden von collation unterstützt und vom Auswahlalgorithmus ausgesucht, ohne auf eine Standard-Sprache zurückzugreifen.

+ +

Beispiele

+ +

Einsatz von supportedLocalesOf

+ +

Angenommen wird, dass indonesisch und deutsch in collation unterstützt wird, aber balinesisch nicht. supportedLocalesOf gibt das indonesische und deutsche Sprachtag unverändert zurück, obwohl Pinyin nicht mit Indonesisch verwendet wird und Fachdeutsch wahrscheinlich nicht für Indonesisch verfügbar ist. Zu bemerken ist, dass der "lookup" Algorithmus verwendet wird — der"best-fit" Algorithmus könnte entscheiden, dass Indonesisch eine angemessene Ergänzung für Balinesen ist, da die meisten Balinesen Indonesisch verstehen und daher auch das balinesische Sprachtag zurückgeben.

+ +
var locales = ['ban', 'id-u-co-pinyin', 'de-ID'];
+var options = { localeMatcher: 'lookup' };
+console.log(Intl.Collator.supportedLocalesOf(locales, options).join(', '));
+// → "id-u-co-pinyin, de-ID"
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-10.2.2', 'Intl.Collator.supportedLocalesOf')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-10.2.2', 'Intl.Collator.supportedLocalesOf')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#sec-Intl.Collator.supportedLocalesOf', 'Intl.Collator.supportedLocalesOf')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.Collator.supportedLocalesOf")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/datetimeformat/format/index.html b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/format/index.html new file mode 100644 index 0000000000..38ebaa091f --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/format/index.html @@ -0,0 +1,101 @@ +--- +title: Intl.DateTimeFormat.prototype.format +slug: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/format +tags: + - DateTimeFormat + - Internationalization + - JavaScript + - Property + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/format +--- +
{{JSRef}}
+ +

Die Intl.DateTimeFormat.prototype.format Eigenschaft gibt einen Getter-Funktion zurück, die einen Zeitstempel nach den Gebiets- und Formatierungsoptionen des {{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}} Objekts formatiert.

+ +
{{EmbedInteractiveExample("pages/js/intl-datetimeformat-prototype-format.html")}}
+ + + +

Syntax

+ +
dateTimeFormat.format(date)
+ +

Parameter

+ +
+
date
+
Der Zeitstempel, der formatiert werden soll.
+
+ +

Beschreibung

+ +

Die Funktion, die vom format Getter zurückgegeben wird, formatiert einen Zeitpunkt (date) in einen String. Dabei werden die Gebiets- und Formatierungsoptionen des {{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}} Objekts berücksichtigt.

+ +

Beispiele

+ +

Einsatz von format

+ +

Die vom format Getter zurückgegebene Funktion wird zum Formatieren von Zeitstempeln genutzt, hier für Serbien:

+ +
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
+var dateTimeFormat = new Intl.DateTimeFormat('sr-RS', options);
+console.log(dateTimeFormat.format(new Date()));
+// → "недеља, 7. април 2013."
+
+ +

Einsatz von format mit map

+ +

Die vom format Getter zurückgegebene Funktion kann zum Formatieren von Zeitpunkten in einem Array genutzt werden. Zu berücksichtigen ist, dass die Funktion an das {{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}} Objekt gebunden ist, von welche die Funktion stammt, so dass sie direkt an {{jsxref("Array.prototype.map()")}} übergeben werden kann.

+ +
var a = [new Date(2012, 08), new Date(2012, 11), new Date(2012, 03)];
+var options = { year: 'numeric', month: 'long' };
+var dateTimeFormat = new Intl.DateTimeFormat('pt-BR', options);
+var formatted = a.map(dateTimeFormat.format);
+console.log(formatted.join('; '));
+// → "setembro de 2012; dezembro de 2012; abril de 2012"
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-12.3.2', 'Intl.DateTimeFormat.format')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-12.3.2', 'Intl.DateTimeFormat.format')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#sec-Intl.DateTimeFormat.prototype.format', 'Intl.DateTimeFormat.format')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.DateTimeFormat.format")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/datetimeformat/formattoparts/index.html b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/formattoparts/index.html new file mode 100644 index 0000000000..07919d3fcf --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/formattoparts/index.html @@ -0,0 +1,169 @@ +--- +title: Intl.DateTimeFormat.prototype.formatToParts() +slug: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts +tags: + - DateTimeFormat + - Internationalization + - Intl + - JavaScript + - Method + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts +--- +
{{JSRef}} {{SeeCompatTable}}
+ +

Die Intl.DateTimeFormat.prototype.formatToParts() Methode erlaubt gebietssichere Formatierung von Strings, die von DateTimeFormat Formatierungen erzeugt werden.

+ +

Syntax

+ +
Intl.DateTimeFormat.prototype.formatToParts(date)
+ +

Parameter

+ +
+
date {{optional_inline}}
+
Der Zeitstempel, der formatiert werden soll.
+
+ +

Rückgabewert

+ +

Ein {{jsxref("Array")}} von Objekten, die das Formatierte Datum in Teilen wiederspielgeln.

+ +

Beschreibung

+ +

Die formatToParts() Methode ist nützlich für benutzerdefinierte Formatierung von Zeitpunktsstrings. Sie gibt ein {{jsxref ("Array")}} von Objekten zurück, die die länderspezifischen Token enthalten, aus denen benutzerdefinierte Zeichenfolgen erstellt werden können, während die länderspezifischen Teile beibehalten werden. Die Struktur, die die formatToParts()  Methode zurückgibt, sieht so aus:

+ +
[
+  { type: 'day', value: '17' },
+  { type: 'weekday', value: 'Monday' }
+]
+ +

Mögliche Typen sind die folgenden:

+ +
+
day
+
Der String, der für den Tag benutzt wird. Zum Beispiel "17".
+
dayPeriod
+
Der String, der für die Tagesperiode benutzt wird. Zum Beispiel "AM" oder "PM".
+
era
+
Der String, der für die Ära benutzt wird. Zum Beispiel "BC" oder "AD".
+
hour
+
Der String, der für die Stunde benutzt wird. Zum Beispiel "3" oder "03".
+
literal
+
Der String, der als Trennung für das Datum und die Zeitbenutzt benutzt wird. Zum Beispiel "/", ",", "o'clock", "de", etc.
+
minute
+
Der String, der für die Minute benutzt wird. Zum Beispiel "00".
+
month
+
Der String, der für den Monat benutzt wird. Zum Beispiel "12".
+
second
+
Der String, der für die Sekunde benutzt wird. Zum Beispiel "07" oder "42".
+
timeZoneName
+
Der String, der für den Zeitzonennamen benutzt wird. Zum Beispiel "UTC".
+
weekday
+
Der String, der für den Wochentag benutzt wird. Zum Beispiel "M", "Monday" oder "Montag".
+
year
+
Der String, der für das Jahr benutzt wird. Zum Beispiel "2012" oder "96".
+
+ +

Beispiele

+ +

DateTimeFormat gibt lokalisierte Strings aus, die nicht direkt verändert werden können:

+ +
var date = Date.UTC(2012, 11, 17, 3, 0, 42);
+
+var formatter = new Intl.DateTimeFormat('en-us', {
+  weekday: 'long',
+  year: 'numeric',
+  month: 'numeric',
+  day: 'numeric',
+  hour: 'numeric',
+  minute: 'numeric',
+  second: 'numeric',
+  hour12: true,
+  timeZone: 'UTC'
+});
+
+formatter.format(date);
+// "Monday, 12/17/2012, 3:00:42 AM"
+
+ +

Oftmals ist es in vielen Benutzeroberflächen erwünscht die Formatierung dieser Strings zu verändern. Die formatToParts Methode erlaubt lokalsicheres Formatieren von Strings, die von DateTimeFormat in Teilstrings unterstützt werden:

+ +
formatter.formatToParts(date);
+
+// return value:
+[
+  { type: 'weekday',   value: 'Monday' },
+  { type: 'literal',   value: ', '     },
+  { type: 'month',     value: '12'     },
+  { type: 'literal',   value: '/'      },
+  { type: 'day',       value: '17'     },
+  { type: 'literal',   value: '/'      },
+  { type: 'year',      value: '2012'   },
+  { type: 'literal',   value: ', '     },
+  { type: 'hour',      value: '3'      },
+  { type: 'literal',   value: ':'      },
+  { type: 'minute',    value: '00'     },
+  { type: 'literal',   value: ':'      },
+  { type: 'second',    value: '42'     },
+  { type: 'literal',   value: ' '      },
+  { type: 'dayPeriod', value: 'AM'     }
+]
+
+ +

Jetzt sind die Informationen separiert vorhanden und  man kann Formatierungen und Konkatinationen benutzerdefiniert vornehmen. Zum Beispiel unter Einsatz von {{jsxref("Array.prototype.map()")}}, Arrow Funktionen, einem switch Statement, Templateliteralen und {{jsxref("Array.prototype.reduce()")}}.

+ +
var dateString = formatter.formatToParts(date).map(({type, value}) => {
+  switch (type) {
+    case 'dayPeriod': return `<b>${value}</b>`;
+    default : return value;
+  }
+}).reduce((string, part) => string + part);
+
+ +

Diese Beispiel macht die Tagesperiode fett, wenn die formatToParts() Methode benutzt wird.

+ +
console.log(formatter.format(date));
+// "Monday, 12/17/2012, 3:00:42 AM"
+
+console.log(dateString);
+// "Monday, 12/17/2012, 3:00:42 <b>AM</b>"
+ +

Polyfill

+ +

Ein Polyfill für die Funktionalität ist im proposal repository verfügbar.

+ +

Spezifikationen

+ + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int Draft', '#sec-Intl.DateTimeFormat.prototype.formatToParts', 'Intl.DateTimeFormat.prototype.formatToParts')}}{{Spec2('ES Int Draft')}}Initiale Definition
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.DateTimeFormat.formatToParts")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/datetimeformat/index.html b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/index.html new file mode 100644 index 0000000000..94cfe2d3c7 --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/index.html @@ -0,0 +1,248 @@ +--- +title: Intl.DateTimeFormat +slug: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat +tags: + - DateTimeFormat + - Internationalization + - JavaScript +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat +--- +
{{JSRef}}
+ +

Das Intl.DateTimeFormat Objekt ist ein Konstruktor für Objekte, die sprachsensitive Formatierung von Datums- und Zeitangaben ermöglicht.

+ +
{{EmbedInteractiveExample("pages/js/intl-datetimeformat.html")}}
+ + + +

Syntax

+ +
new Intl.DateTimeFormat([locales[, options]])
+Intl.DateTimeFormat.call(this[, locales[, options]])
+ +

Parameter

+ +
+
locales
+
Optional. Ein String mit einem BCP 47 Sprachcode, oder einem Array von Sprachcodes. Für die generelle Form und Interpretation des locales Arguments siehe auf der {{jsxref("Global_Objects/Intl", "Intl Seite", "#Locale_identification_and_negotiation", 1)}}. Die folgenden  Unicode Erweiterungen sind erlaubt:
+
+
+
nu
+
Zahlensysteme. Mögliche Werte sind: "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "khmr", "knda", "laoo", "latn", "limb", "mlym", "mong", "mymr", "orya", "tamldec", "telu", "thai", "tibt".
+
ca
+
Kalender. Mögliche Werte sind: "buddhist", "chinese", "coptic", "ethioaa", "ethiopic", "gregory", "hebrew", "indian", "islamic", "islamicc", "iso8601", "japanese", "persian", "roc".
+
hc
+
Stundenzyklus. Mögliche Werte sind: "h11", "h12", "h23", "h24".
+
+
+
options
+
+

Optional. Ein Objekt mit einigen oder allen folgenden Eigenschaften:

+ +
+
localeMatcher
+
Der Sprachfindungsalgorithmus, der eingesetzt wird. Mögliche Werte sind "lookup" und "best fit". Als Standard ist "best fit" vorgegeben. Für Informationen über diese Option siehe auf der {{jsxref("Global_Objects/Intl", "Intl Seite", "#Locale_negotiation", 1)}} nach.
+
timeZone
+
Die eingesetzte Zeitzone. Der einzige Wert, den alle Implementierungen verstehen ist "UTC". Der Standardwert ist die Standard-Laufzeitzeitzone. Manche Implementierungen erkennen auch die Namen der IANA Zeitzonendatenbank, wie zum Beispiel "Asia/Shanghai", "Asia/Kolkata" und "America/New_York".
+
hour12
+
Wird eingesetzt, wenn 12-Stunden Zeitangaben eingesetzt werden (im gegensatz zu 24-Stunden Zeitangaben). Mögliche Werte sind true und false. Diese Option überschreibt den  hc Sprachen-Tag und/oder hourCycle wenn beide vorhanden sind.
+
hourCycle
+
Der eingesetzte Stundenzyklus. Mögliche Werte sind "h11", "h12", "h23" oder "h24". Diese Option überschreibt den  hc Sprachen-Tag, wenn beide präsent sind und die hour12 Option hat Vorrang, wenn beide Optionen spezifiziert sind.
+
formatMatcher
+
Der eingesetzte Formaterkennungsalgorithmus. Mögliche Werte sind "basic" und "best fit". Der Standard ist "best fit". Siehe folgenden Absatz, um den Einsatz dieses Parameters zu verstehen.
+
+ +

Die folgenden Eigenschaften beschreiben die Datums-Zeit-Komponenten, die für die formatierten Ausgabe eingesetzt werden und deren Repräsentation. Implementierungen müssen folgende Kombinationen der Eigenschaften unterstützen:

+ +
    +
  • Wochentag, Jahr, Monat, Tag, Stunde, Minute, Sekunde
  • +
  • Wochentag, Jahr, Monat, Tag
  • +
  • Jahr, Monat, Tag
  • +
  • Jahr, Monat
  • +
  • Monat, Tag
  • +
  • Stunde, Minute, Sekunde
  • +
  • Stunde, Minute
  • +
+ +

Manche Implementierungen unterstützen weitere Kombinationen der Parameter. Es wird immer auf alle möglichen Kombinationen geprüft, um den besten Treffer zu landen. Zwei Algorithmen sind für die Auswahl der Kombination vorhanden: Ein voll spezifizierter "basic" Algorithmus und ein implementierungsabhängiger "best fit" Algorithmus.

+ +
+
weekday
+
Die Repräsentation der Wochentage. Mögliche Werte sind "narrow", "short" und "long".
+
era
+
Die Repräsentation der Epoche. Mögliche Werte sind "narrow", "short" und "long".
+
year
+
Die Repräsentation des Jahres. Mögliche Werte sind "numeric" und "2-digit".
+
month
+
Die Repräsentation des Monats. Mögliche Werte sind "numeric", "2-digit", "narrow", "short" und "long".
+
day
+
Die Repräsentation des Tages. Mögliche Werte sind "numeric" und "2-digit".
+
hour
+
Die Repräsentation der Stunden. Mögliche Werte sind "numeric" und "2-digit".
+
minute
+
Die Repräsentation der Minuten. Mögliche Werte sind "numeric" und "2-digit".
+
second
+
Die Repräsentation der Sekunden. Mögliche Werte sind "numeric" und "2-digit".
+
timeZoneName
+
Die Repräsentation des Zeitzonennamens. Mögliche Werte sind "short" und "long".
+
+ +

Die Standardwerte für jede Datums-Zeit-Komponente ist {{jsxref("undefined")}}, wenn jedoch alle Komponenten {{jsxref("undefined")}} sind, wird year, month, and day als "numeric" angenommen.

+
+
+ +

Beschreibung

+ +

Eigenschaften

+ +
+
{{jsxref("DateTimeFormat.prototype", "Intl.DateTimeFormat.prototype")}}
+
Ermögliche es Eigenschaften und Methoden für alle Objekte zu definieren.
+
+ +

Methoden

+ +
+
{{jsxref("DateTimeFormat.supportedLocalesOf", "Intl.DateTimeFormat.supportedLocalesOf()")}}
+
Gibt ein Array an Sprachen zurück, die unterstützt werden, ohne dass auf den Laufzeitumgebungsstandard zurückgegriffen wird.
+
+ +

DateTimeFormat Instanzen

+ +

Eigenschaften

+ +

DateTimeFormat Instanzen erben die folgenden Eigenschaften von ihrem Prototypen:

+ +
{{page("/de/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/prototype", "Eigenschaften")}}
+ +

Methoden

+ +

DateTimeFormat Instanzen erben die folgenden Methoden von ihrem Prototypen:

+ +
{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/prototype', 'Methoden')}}
+ +

Beispiele

+ +

Einsatz von DateTimeFormat

+ +

Der Basiseinsatz ohne extra Sprach- und Formatierungsoptionen, sondern den Standardeinstellungen.

+ +
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
+
+// toLocaleString ohne Argumente ist von der implementierunge,
+// der Standardsprache und der Standardzeitzone abhängig.
+console.log(new Intl.DateTimeFormat().format(date));
+// → "12/19/2012" wenn das Gebiet en-US mit der Zeitzone America/Los_Angeles (UTC-0800) der Standard ist.
+
+ +

Einsatz von locales

+ +

Das folgende Beispiel zeigt verschiedene Formatierungsoptionen von Datums- und Zeitformaten. Um sicherzustellen, dass das Format der Sprache eingesetzt wird, die in der Benutzerschnittstelle benutzt wird, muss diese (und mögliche Rückfallsprachen) mit dem locales Argument eingestellt werden.

+ +
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
+
+// Die folgenden Formate setzen die Zeitzone America/Los_Angeles
+// für die Sprache US voraus.
+
+// US englisch: Monat-Tag-Jahr
+console.log(new Intl.DateTimeFormat('en-US').format(date));
+// → "12/19/2012"
+
+// Britisch englisch: Tag-Monat-Jahr
+console.log(new Intl.DateTimeFormat('en-GB').format(date));
+// → "20/12/2012"
+
+// Koreanisch: Jahr-Monat-Tag
+console.log(new Intl.DateTimeFormat('ko-KR').format(date));
+// → "2012. 12. 20."
+
+// Arabisch: In den meisten arabischen Ländern werden arabische Ziffern genutzt
+console.log(new Intl.DateTimeFormat('ar-EG').format(date));
+// → "٢٠‏/١٢‏/٢٠١٢"
+
+// Japanisch: In Japan wird der japanische Kalender eingesetzt:
+// 2012 ist in diesem das Jahr 24 der Heisei Ära.
+console.log(new Intl.DateTimeFormat('ja-JP-u-ca-japanese').format(date));
+// → "24/12/20"
+
+// Einsatz von Sprachen, die vielleicht nicht unterstützt werden:
+// Balinesisch, und Indonesisch als Rückfallsprache.
+console.log(new Intl.DateTimeFormat(['ban', 'id']).format(date));
+// → "20/12/2012"
+
+ +

Einsatz von options

+ +

Das Datums- und Zeitformat kann mit dem Einsatz des options Arguments vom Benutzer definiert werden.

+ +
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
+
+// Langer Wochentag mit langem Datum
+var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
+console.log(new Intl.DateTimeFormat('de-DE', options).format(date));
+// → "Donnerstag, 20. Dezember 2012"
+
+// sichtbares UTC
+options.timeZone = 'UTC';
+options.timeZoneName = 'short';
+console.log(new Intl.DateTimeFormat('en-US', options).format(date));
+// → "Thursday, December 20, 2012, GMT"
+
+// Präzisere Angaben der Zeit
+options = {
+  hour: 'numeric', minute: 'numeric', second: 'numeric',
+  timeZone: 'Australia/Sydney',
+  timeZoneName: 'short'
+};
+console.log(new Intl.DateTimeFormat('en-AU', options).format(date));
+// → "2:00:00 pm AEDT"
+
+// 24-Stunden Angabe in US Zeiten
+options = {
+  year: 'numeric', month: 'numeric', day: 'numeric',
+  hour: 'numeric', minute: 'numeric', second: 'numeric',
+  hour12: false,
+  timeZone: 'America/Los_Angeles'
+};
+console.log(new Intl.DateTimeFormat('en-US', options).format(date));
+// → "12/19/2012, 19:00:00"
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-12.1', 'Intl.DateTimeFormat')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-12.1', 'Intl.DateTimeFormat')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#datetimeformat-objects', 'Intl.DateTimeFormat')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.DateTimeFormat")}}

+
+ +

Siehe auch

+ +
{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/Intl', 'See_also')}}
diff --git a/files/de/web/javascript/reference/global_objects/intl/datetimeformat/prototype/index.html b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/prototype/index.html new file mode 100644 index 0000000000..98f5e8f57b --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/prototype/index.html @@ -0,0 +1,83 @@ +--- +title: Intl.DateTimeFormat.prototype +slug: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/prototype +tags: + - DateTimeFormat + - Internationalization + - JavaScript + - Property + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat +--- +
{{JSRef}}
+ +
Die Intl.DateTimeFormat.prototype Eigenschaft ist ein Prototyp Objekt für den {{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}} Konstruktor.
+ +
 
+ +
{{js_property_attributes(0, 0, 0)}}
+ +

Beschreibung

+ +

Für eine Beschreibung von Intl.DateTimeFormat Instanzen siehe im Artikel {{jsxref("DateTimeFormat")}} nach.

+ +

{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}} Instanzen erben von Intl.DateTimeFormat.prototype. Änderungen in der Eigenschaft prototype wirken sich auf alle Instanzen von {{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}} aus.

+ +

Eigenschaften

+ +
+
Intl.DateTimeFormat.prototype.constructor
+
Eine Referenz zu {{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}.
+
{{jsxref("DateTimeFormat.format", "Intl.DateTimeFormat.prototype.format")}}
+
Getter, der eine Funktion, die für das Formatieren von Datums- und Zeitangaben nach den Optionen des {{jsxref("DateTimeFormat", "DateTimeFormat")}} ermöglicht, wird zurückgegeben.
+
+ +

Methoden

+ +
+
{{jsxref("DateTimeFormat.formatToParts", "Intl.DateTimeFormat.prototype.formatToParts()")}}
+
Gibt ein {{jsxref("Array")}} von Objekten zurück, die den formatierten String in Teilen repräsentiert. Das kann eingesetzt werden, um ein benutzerdefiniertes Format zu erstellen.
+
{{jsxref("DateTimeFormat.resolvedOptions", "Intl.DateTimeFormat.prototype.resolvedOptions()")}}
+
Gibt ein neues Objekt mit den Eigenschaften der Sprache und des Formates zum Erstellungszeitpunkt des Objektes zurück.
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-12.2.1', 'Intl.DateTimeFormat.prototype')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-12.2.1', 'Intl.DateTimeFormat.prototype')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#sec-Intl.DateTimeFormat.prototype', 'Intl.DateTimeFormat.prototype')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.DateTimeFormat.prototype")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/datetimeformat/resolvedoptions/index.html b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/resolvedoptions/index.html new file mode 100644 index 0000000000..a1403f9a7b --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/resolvedoptions/index.html @@ -0,0 +1,107 @@ +--- +title: Intl.DateTimeFormat.prototype.resolvedOptions() +slug: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions +tags: + - DateTimeFormat + - Internationalization + - JavaScript + - Method + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions +--- +
{{JSRef}}
+ +

Die Intl.DateTimeFormat.prototype.resolvedOptions() Methode gibt ein Objekt mit den Eigenschaften zum Gebiet und der Datums- und Zeitformatierung zurück, die beim der Initialisierung eines {{jsxref("DateTimeFormat", "DateTimeFormat")}} Objektes berechnet werden.

+ +
{{EmbedInteractiveExample("pages/js/intl-datetimeformat-prototype-resolvedoptions.html")}}
+ + + +

Syntax

+ +
dateTimeFormat.resolvedOptions()
+ +

Rückgabewert

+ +

Ein neues Objekt mit den Eigenschaften zum Gebiet und der Datums- und Zeitformatierung, die beim der Initialisierung eines {{jsxref("DateTimeFormat", "DateTimeFormat")}} Objektes berechnet werden.

+ +

Beschreibung

+ +

Das resultierende Objekt hat die folgenden Eigenschaften:

+ +
+
locale
+
Der BCP 47 Sprach-Tag für die genutzte Sprache. Wenn Unicode-Erweiterungen im BCP 47 Sprach-Tag enthalten waren, die für die Sprache unterstützt werden, sind die Unterstützen Schlüssel-Werte-Paare in locale enthalten.
+
calendar
+
numberingSystem
+
Dieser Wert wird durch die Unicode-Erweiterungsschlüssel "ca" und "nu" oder mit einem Standardwert gefüllt.
+
timeZone
+
Die Wert für die Unterstützen Eigenschaft im options Argument; {{jsxref("undefined")}} (entspricht der Standard-Zeitzone der Laufzeitumgebung), wenn keine verwendet wird. Warnung: Anwendungen sollten nicht auf den Rückgabewert {{jsxref("undefined")}} programmiert sein, weil es in zukünftigen Versionen sein kann, dass ein {{jsxref("String")}} zurückgegeben wird, der die Standard-Zeitzone der Laufzeitumgebung identifiziert.
+
hour12
+
Der Wert der verwendeten Eigenschaft im options Argument oder ein Standard-Wert.
+
weekday
+
era
+
year
+
month
+
day
+
hour
+
minute
+
second
+
timeZoneName
+
Die Werte resultieren von den Eigenschaften in dem options Argument und den möglichen Kombinationen und Repräsentationen der Datums- und Zeitformatierung aus der ausgewählte Sprache. Einige der Eigenschaften können auch fehlen, was bedeutet, dass die Komponenten nicht in der formatierten Ausgabe enthalten sind.
+
+ +

Beispiele

+ +

Einsatz der resolvedOptions Methode

+ +
var germanFakeRegion = new Intl.DateTimeFormat('de-XX', { timeZone: 'UTC' });
+var usedOptions = germanFakeRegion.resolvedOptions();
+
+usedOptions.locale;          // "de"
+usedOptions.calendar;        // "gregory"
+usedOptions.numberingSystem; // "latn"
+usedOptions.timeZone;        // "UTC"
+usedOptions.month;           // "numeric"
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-12.3.3', 'Intl.DateTimeFormat.prototype.resolvedOptions')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-Intl.DateTimeFormat.prototype.resolvedOptions', 'Intl.DateTimeFormat.prototype.resolvedOptions')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#sec-Intl.DateTimeFormat.prototype.resolvedOptions', 'Intl.DateTimeFormat.prototype.resolvedOptions')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.DateTimeFormat.resolvedOptions")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/datetimeformat/supportedlocalesof/index.html b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/supportedlocalesof/index.html new file mode 100644 index 0000000000..722b372745 --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/datetimeformat/supportedlocalesof/index.html @@ -0,0 +1,99 @@ +--- +title: Intl.DateTimeFormat.supportedLocalesOf() +slug: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/supportedLocalesOf +tags: + - DateTimeFormat + - Internationalization + - JavaScript + - Method + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/supportedLocalesOf +--- +
{{JSRef}}
+ +

Die Intl.DateTimeFormat.supportedLocalesOf() Methode gibt ein Array zurück, welches die Gebiete enthält, die die Datums- und Zeitformatierung unterstützen, ohne das auf das Laufzeitstandardgebeit zurückgegriffen werden muss.

+ +
{{EmbedInteractiveExample("pages/js/intl-datetimeformat-prototype-supportedlocalesof.html")}}
+ + + +

Syntax

+ +
Intl.DateTimeFormat.supportedLocalesOf(locales[, options])
+ +

Parameter

+ +
+
locales
+
Ein String mit einem BCP 47 Sprachtag, oder ein Array von solchen Strings. Für die generelle Form des locales Arguments siehe die {{jsxref("Intl", "Intl Seite", "#Gebietsidentifikation_und_-verhandlung", 1)}}.
+
options
+
+

Optional. Ein Objekt, welches die folgende Eigenschaft haben kann:

+ +
+
localeMatcher
+
Der Auswahlalgorithmus des Gebietes. Mögliche Werte sind "lookup" und "best fit"; der Standard ist "best fit". Für mehr Information über diese Option siehe auf der {{jsxref("Intl", "Intl Seite", "#Gebietsauswahl", 1)}}.
+
+
+
+ +

Rückgabewert

+ +

Gibt ein Array zurück, welches eine Untermenge der gegebenen Gebiete enthält, für die die Datums- und Zeitformatierung unterstützen wird, ohne das auf das Laufzeitstandardgebeit zurückgegriffen werden muss.

+ +

Beschreibung

+ +

Gibt ein Array zurück, welches eine Untermenge der gegebenen Gebiete (locales) enthält. Die Sprachtags, die zurückgegeben werden, unterstützen Datums- und Zeitformatierungen für das entsprechende Gebiet, ohne auf den Systemstandard zurückgreifen zu müssen.

+ +

Beispiele

+ +

Einsatz von supportedLocalesOf

+ +

Angenommen wird, dass indonesische und deutsche Datums- und Zeitformatierung unterstützt wird, aber balinesisch nicht. supportedLocalesOf gibt das indonesische und deutsche Sprachtag unverändert zurück, obwohl Pinyin nicht mit Indonesisch verwendet wird und Fachdeutsch wahrscheinlich nicht für Indonesisch verfügbar ist. Zu bemerken ist, dass der "lookup" Algorithmus verwendet wird — der"best-fit" Algorithmus könnte entscheiden, dass Indonesisch eine angemessene Ergänzung für Balinesen ist, da die meisten Balinesen Indonesisch verstehen und daher auch das balinesische Sprachtag zurückgeben.

+ +
var locales = ['ban', 'id-u-co-pinyin', 'de-ID'];
+var options = { localeMatcher: 'lookup' };
+console.log(Intl.DateTimeFormat.supportedLocalesOf(locales, options).join(', '));
+// → "id-u-co-pinyin, de-ID"
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-12.2.2', 'Intl.DateTimeFormat.supportedLocalesOf')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-12.2.2', 'Intl.DateTimeFormat.supportedLocalesOf')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#sec-Intl.DateTimeFormat.supportedLocalesOf', 'Intl.DateTimeFormat.supportedLocalesOf')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.DateTimeFormat.supportedLocalesOf")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/getcanonicallocales/index.html b/files/de/web/javascript/reference/global_objects/intl/getcanonicallocales/index.html new file mode 100644 index 0000000000..0913ad7a6e --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/getcanonicallocales/index.html @@ -0,0 +1,74 @@ +--- +title: Intl.getCanonicalLocales() +slug: Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales +tags: + - Internationalization + - Intl + - JavaScript + - Method +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales +--- +
{{JSRef}}
+ +

Die Intl.getCanonicalLocales() Methode gibt ein Array mit den anerkannten Gebietsnamen zurück. Duplikate werden verhindert und Elemente werden auf valide Sprach-Tag-Struktur geprüft.

+ +
{{EmbedInteractiveExample("pages/js/intl-getcanonicallocales.html")}}
+ + + +

Syntax

+ +
Intl.getCanonicalLocales(locales)
+ +

Parameter

+ +
+
locales
+
Eine List von {{jsxref("String")}} Werten, von welchen die anerkannten Gebietsnamen gesucht werden.
+
+ +

Rückgabewert

+ +

Ein Array mit den anerkannten Gebietsnamen.

+ +

Beispiele

+ +
Intl.getCanonicalLocales('EN-US'); // ["en-US"]
+Intl.getCanonicalLocales(['EN-US', 'Fr']); // ["en-US", "fr"]
+
+Intl.getCanonicalLocales('EN_US');
+// RangeError:'EN_US' is not a structurally valid language tag
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int Draft', '#sec-intl.getcanonicallocales', 'Intl.getCanonicalLocales')}}{{Spec2('ES Int Draft')}}Initiale Definition
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.getCanonicalLocales")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/index.html b/files/de/web/javascript/reference/global_objects/intl/index.html new file mode 100644 index 0000000000..50567a9913 --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/index.html @@ -0,0 +1,129 @@ +--- +title: Intl +slug: Web/JavaScript/Reference/Global_Objects/Intl +tags: + - Internationalization + - JavaScript +translation_of: Web/JavaScript/Reference/Global_Objects/Intl +--- +
{{JSRef}}
+ +

Das Intl Objekt ist der Namensraum für die ECMAScript Internationalisierungs API, welche sprachenabhängige Stringvergleiche, Zahlenformate und Datums bzw. Zeitformate unterstützt. Der Konstruktoren für {{jsxref("Collator")}}, {{jsxref("NumberFormat")}} und {{jsxref("DateTimeFormat")}} Objekte sind Eigenschaften des Intl Objektes. Diese Seite dokumentiert diese Eigenschaften sowie die Funktionalität, die in Internationalisierungskonstruktoren und anderen sprachsensitiven Funktionen gemeinsam sind.

+ +

Eigenschaften

+ +
+
{{jsxref("Global_Objects/Collator", "Intl.Collator")}}
+
Konstruktor für Collatoren, Objekte mit sprachsensitiven Stringvergleichen.
+
{{jsxref("Global_Objects/DateTimeFormat", "Intl.DateTimeFormat")}}
+
Konstruktor für Objekte, die Daten und Zeiten sprachsensitiv formatieren.
+
{{jsxref("Global_Objects/NumberFormat", "Intl.NumberFormat")}}
+
Konstruktor für Objekte, die Zahlen sprachsensitiv formatieren.
+
{{jsxref("Global_Objects/PluralRules", "Intl.PluralRules")}}
+
Konstruktor für Objekte, die mit Pluralsprachregeln pluralsensitiv formatieren kann.
+
+ +

Methoden

+ +
+
{{jsxref("Intl.getCanonicalLocales()")}}
+
Eine Methode, die den kanonischen Gebietsnamen zurückgibt.
+
+ +

Gebietsidentifikation und -verhandlung

+ +

Die Internationalisierungskonstruktoren genauso wie viele sprachsensitive Methoden von anderen Konstruktoren (aufgelistet unter {{anch("Siehe auch", "Siehe auch")}}) benutzten übliche Muster für die Identifizierung von Gebieten und der Feststellung des aktuellen Gebietes: Alle diese akzeptieren locales und options Parameter und verhandeln ein Gebiet aus den gesendeten Gebieten und den Lokal unterstützen Gebieten mithilfe eines Speziellen Algorithmus in der Eigenschaft options.localeMatcher aus.

+ +

locales Argument

+ +

Das locales Argument muss entweder ein String sein, der einen BCP 47 Sprachcode enthält, oder ein Array mit solche Sprachcodes. Wenn dieses Argument nicht unterstützt ist oder undefined ist, wird das lokale Standardgebiet benutzt.

+ +

Ein BCP 47-Sprachcode definiert eine Sprache und enthält minimal einen primären Sprachcode. In seiner gebräuchlichsten Form kann er folgender Reihenfolge enthalten: einen Sprachcode, einen Skriptcode und einen Länder- oder Regionscode, alle getrennt durch Bindestriche. Weil diese Codes unabhängig von Groß- und Kleinschreibung ist, ist es empfohlen bei Skriptcodes den ersten Buchstaben groß zuschreiben, bei Länder- und Regionscodes soll alles groß geschrieben werden und der Rest soll klein geschreiben werden.

+ +

Beispiele:

+ + + +

Die Subcodes zum identifizieren von Sprachen, Skripten, Ländern (Regionen) und (selten genutzen) Varianten in BCP 47 Sprachcodes können im IANA Sprach Subtag Register gefunden werden.

+ +

BCP 47 erlaubt sogar Erweiterungen. JavaScript Internationalisierungsfunktionen benutzen die "u" (Unicode) Erweiterung, welche es ermöglicht benutzerdefinierte Änderungen in {{jsxref("Collator")}}, {{jsxref("NumberFormat")}} oder {{jsxref("DateTimeFormat")}} einzubringen. Beispiele:

+ + + +

Gebietsauswahl

+ +

Das locales Argument wird als priorisierte Angabe für die Applikation interpretiert, nach dem alle Unicode-Erweiterungen durchführt wurden. Zur Laufzeut wird gegeben verfügbare Gebiete verglichen und das am besten passende genommen. Es existieren zwei Algorithmen für die Auswahl: die "lookup" Auswahl, die dem im BCP 47 spezifizierten Algorithmus folgt; die "best fit" Auswahl, bei dem die Laufzeigumgebung mindestens einen gleichgutes Ergebnis wie der Lookup Algorithmus erzielt, wenn nicht sogar einen besseren. Wenn die Applikation kein locales Argument unterstützt oder die Laufzeit kein Gebiet hat, welches passt, dann wird das Standardgebiet der Laufzeitumgebung werdendet. Das Algorithmus zur Auswahl kann über das options Argument ausgewählt werden (siehe unten).

+ +

Wenn der ausgewählte Sprache-Tag eine Unicode Erweiterung hat, wird diese genutzt, um das erstellte Objekte oder das Verhalten der Funktion anzupassen. Jeder Konstruktor oder jede Funktion unterstützt nur eine Untermenge der als Unicode Erweiterungen definierten Schlüssel und die unterstützen Werte sind meistens von Sprach-Tag abhängig. Zum Beispiel ist der "co" Schlüssel (collation) nur in {{jsxref("Collator")}} unterstützt und der "phonebk" Wert ist nur im Deutschen unterstützt.

+ +

options Argument

+ +

Das options Argument muss ein Objekt mit Eigenschaften sein, welche vom Konstruktor und der Funktion abhängen. Wenn das options Argument nicht unterstützt wird oder undefined ist, werden Standardwerte für alle Eigenschaften benutzt.

+ +

Eine Eigenschaft ist in allen sprachensensitiven Konstruktoren und Funktionen forhanden: Die localeMatcher Eigenschaft, die vom Datentyp String ist und den Wert "lookup" oder "best fit" hat, welche den Algorithmus für die Auswahl des Gebietes beschreiben (siehe oben).

+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-8', 'Intl')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-8', 'Intl')}}{{Spec2('ES Int 2.0')}}
{{SpecName('ES Int Draft', '#intl-object', 'Intl')}}{{Spec2('ES Int Draft')}}Intl.getCanonicalLocales in the 4. Auflage hinzugefügt.
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/numberformat/format/index.html b/files/de/web/javascript/reference/global_objects/intl/numberformat/format/index.html new file mode 100644 index 0000000000..4d42272e9c --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/numberformat/format/index.html @@ -0,0 +1,98 @@ +--- +title: Intl.NumberFormat.prototype.format +slug: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/format +tags: + - Internationalization + - JavaScript + - NumberFormat + - Property + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/format +--- +
{{JSRef}}
+ +

Die Intl.NumberFormat.prototype.format Eigenschaft gibt eine Getterfunktion zurück, die eine Zahl nach den Sprach- und Formatierungsoptionen dieses {{jsxref("NumberFormat")}} Objektes formatiert.

+ +
{{EmbedInteractiveExample("pages/js/intl-numberformat-prototype-format.html")}}
+ + + +

Syntax

+ +
numberFormat.format(number)
+ +

Parameter

+ +
+
number
+
Zahl, die formatiert werden soll.
+
+ +

Beschreibung

+ +

Die Funktion, die von format Getter zurückgegeben wird, formatiert eine Zahl in einen String nach den angegebenen Sprach- und Formatierungsoptionen des {{jsxref("NumberFormat")}} Objektes.

+ +

Beispiele

+ +

Einsatz von format

+ +

Einsatz der vom format Getter zurückgegebenen Funktion zum Formatieren eines Währungswertes, hier für Russland:

+ +
var options = { style: 'currency', currency: 'RUB' };
+var numberFormat = new Intl.NumberFormat('ru-RU', options);
+console.log(numberFormat.format(654321.987));
+// → "654 321,99 руб."
+
+ +

Einsatz format mit map

+ +

Einsatz der vom format Getter zurückgegebenen Funktion zum Formatieren von allen Zahlen in einem Array. Zu bemerken ist, dass die Funktion an das {{jsxref("NumberFormat")}} Objekt gebunden ist, von dem sie stammt, so dass es direkt in {{jsxref("Array.prototype.map")}} verwendet werden kann.

+ +
var a = [123456.789, 987654.321, 456789.123];
+var numberFormat = new Intl.NumberFormat('es-ES');
+var formatted = a.map(numberFormat.format);
+console.log(formatted.join('; '));
+// → "123.456,789; 987.654,321; 456.789,123"
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKomment
{{SpecName('ES Int 1.0', '#sec-11.3.2', 'Intl.NumberFormat.prototype.format')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-11.3.2', 'Intl.NumberFormat.prototype.format')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#sec-Intl.NumberFormat.prototype.format', 'Intl.NumberFormat.prototype.format')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.NumberFormat.format")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/numberformat/index.html b/files/de/web/javascript/reference/global_objects/intl/numberformat/index.html new file mode 100644 index 0000000000..b2881e081d --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/numberformat/index.html @@ -0,0 +1,195 @@ +--- +title: Intl.NumberFormat +slug: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat +tags: + - Internationalization + - JavaScript + - NumberFormat +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat +--- +
{{JSRef}}
+ +

Das Intl.NumberFormat Objekt ist ein Konstruktor für Objekte, die sprachabhängige Zahlenformatierungen nutzen.

+ +
{{EmbedInteractiveExample("pages/js/intl-numberformat.html")}}
+ + + +

Syntax

+ +
new Intl.NumberFormat([locales[, options]])
+Intl.NumberFormat.call(this[, locales[, options]])
+
+ +

Parameter

+ +
+
locales
+
Optional. Ein String mit einem BCP 47 Sprachcode, oder ein Array mit solchen Strings. Für die generelle Form und Interpretation des locales Arguments siehe im {{jsxref("Intl", "Intl Artikel", "#Locale_identification_and_negotiation", 1)}}. Die folgenden Unicode Erweiterungsschlüssel sind erlaubt:
+
+
+
nu
+
Das einzusetzende Nummerierungssystem. Mögliche Wert sind: "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "khmr", "knda", "laoo", "latn", "limb", "mlym", "mong", "mymr", "orya", "tamldec", "telu", "thai", "tibt".
+
+
+
options
+
+

Optional. Ein Objekt mit einigen oder allen der folgenden Eigenschaften:

+ +
+
localeMatcher
+
Der Spracherkennungsalgorithmus. Mögliche Werte sind "lookup" und "best fit". Der Standardwert ist "best fit". Für mehr Informationen siehe in den {{jsxref("Intl", "Intl Artikel", "#Locale_negotiation", 1)}}.
+
style
+
Der einzusetzende Formatierungsstil. Mögliche Werte sind "decimal" für einfache Zahlenformate, "currency" für Währungen, "percent" für Prozentzahlen. Der Standardwert ist "decimal".
+
currency
+
Die bei der Währungsformatierung einzusetzende Währung. Mögliche Werte sind die ISO 4217 Währungscodes wie zum Beispiel "USD" für US Dollar, "EUR" für Euro und "CNY" für Chinesischen RMB (siehe Current currency & funds code list). Es gibt keinen Standardwert. Wenn style auf "currency" gesetzt ist, muss die currency Eigenschaft gesetzt werden.
+
currencyDisplay
+
Währungsanzeige im String. Mögliche Werte sind "symbol" für lokalisierte Währungssymbole wie zum Beispiel €, "code" für ISO Währungscodes, "name" für den Namen der Währung wie zum Beispiel "dollar". Der Standardwert ist "symbol".
+
useGrouping
+
Gruppierung der Zahl. Wird für das Ein- und Ausschalten der Tausendertrenner oder thousand/lakh/crore-Trenner eingesetzt. Mögliche Werte sind true und false. Der Standardwert ist true.
+
+ +

Die folgenden Eingeschaften fallen in zwei Gruppen: minimumIntegerDigits, minimumFractionDigits, und maximumFractionDigits in einer Gruppe, minimumSignificantDigits und maximumSignificantDigits in der anderen. Wenn nur eine Eigenschaft der zweiten Gruppe genutzt wird, wird die erste Gruppe ignoriert.

+ +
+
minimumIntegerDigits
+
Die minimale Anzahl von Ganzzahl Ziffern. Mögliche Werte sind zwischen 1 und 21. Der Standardwert ist 1.
+
minimumFractionDigits
+
Die minimale Anzahl von Nachkommastellen. Mögliche Werte sind zwischen 0 und 20. Der Standardwert für Zahlen und Prozentzahlen ist 0. Der Standard für Währungen ist die Anzahl der Stellen für die Untereinheit der Währung, die eingesetzt wird (ISO 4217 currency code list) oder 2, wenn die Währung nicht unterstützt wird.
+
maximumFractionDigits
+
Die Maximale Anzahl von Nachkommastellen. Mögliche Werte sind zwischen 0 und 20. Der Standardwert für einfache Zahlen ist die größere Zahl von minimumFractionDigits und 3. Der Standardwert für Währungen ist der größere von minimumFractionDigits und der Anzahl der Stellen für die Untereinheit der Währung oder 2 wenn die Währung nicht unterstützt wird. Der Standardwert für Prozentzahlen ist die größere Zahl von minimumFractionDigits und 0.
+
minimumSignificantDigits
+
Die minimale Anzahl von signifikanten Stellen. Mögliche Werte sind zwischen 1 und 21. Der Standardwert ist 1.
+
maximumSignificantDigits
+
Die maximale Anzahl von signifikanten Stellen. Mögliche Werte sind zwischen 1 und 21. Der Standardwert ist minimumSignificantDigits.
+
+
+
+ +

Beschreibung

+ +

Eigenschaften

+ +
+
{{jsxref("NumberFormat.prototype", "Intl.NumberFormat.prototype")}}
+
Erlaubt das Hinzufügen von Eigenschaften zu allen Objekten.
+
+ +

Methoden

+ +
+
{{jsxref("NumberFormat.supportedLocalesOf", "Intl.NumberFormat.supportedLocalesOf()")}}
+
Gibt ein Array zurück, welches alle Sprachen enthält, die unterstützt werden, ohne auf den Laufzeitstandard zurückzufallen (ohne fallback).
+
+ +

NumberFormat Instanzen

+ +

Eigenschaften

+ +

NumberFormat Instanzen erben die folgenden Eigenschaften von ihrem Prototyp:

+ +
{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat/prototype', 'Eigenschaften')}}
+ +

Methoden

+ +

NumberFormat Instanzen erben die folgenden Methoden von ihrem Prototyp:

+ +
{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat/prototype', 'Methoden')}}
+ +

Beispiele

+ +

Standardeinsatz

+ +

Beim Einsatz ohne spezifizierte Sprache wird ein formatierter String in der Standardsprache und mit Standardoptionen zurückgegeben:

+ +
var number = 3500;
+
+console.log(new Intl.NumberFormat().format(number));
+// → '3.500' wenn in Deutscher Sprache
+
+ +

Einsatz von locales

+ +

Diese Beispiel zeigt einige der Variationen lokalisierter Zahlenformate. Um das Format der Sprache zu erhalten, welches in der Anwendung benutzt wird, spezifiziere die Sprache (und mögliche Rückfallsprachen (fallback)) mit dem locales Argument.

+ +
var number = 123456.789;
+
+// Englische Benutzer sehen ein Punkt anstatt eines Kommas als Dezimaltrenner
+console.log(new Intl.NumberFormat('en-GB').format(number));
+// → 123.456,789
+
+// Arabisch ist in den meisten arabisch sprachigen Ländern eingesetzt
+console.log(new Intl.NumberFormat('ar-EG').format(number));
+// → ١٢٣٤٥٦٫٧٨٩
+
+// Indien benutzt Tausendertrennzeichen bei Tausend und allen weiteren zwei Stellen
+console.log(new Intl.NumberFormat('en-IN').format(number));
+// → 1,23,456.789
+
+// Chinesisches Zahlensystem
+console.log(new Intl.NumberFormat('zh-Hans-CN-u-nu-hanidec').format(number));
+// → 一二三,四五六.七八九
+
+// Wenn eine Sprache übergeben werden soll, die vielleicht nicht
+// unterstützt wird (Balinesisch), nutze eine fallback Sprache (Indonesisch)
+console.log(new Intl.NumberFormat(['ban', 'id']).format(number));
+// → 123.456,789
+
+ +

Einsatz von options

+ +

Das Ergebnis von toLocaleString kann durch das options Argument angepasst werden.

+ +
var number = 123456.789;
+
+//  Währungsformat
+console.log(new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(number));
+// → 123.456,79 €
+
+//  Der Japanische Yen hat keine Unterwährung (z. B. Cent)
+console.log(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(number));
+// → ¥123,457
+
+//  Limitiert auf drei signifikante Stellen
+console.log(new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 3 }).format(number));
+// → 1,23,000
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-11.1', 'Intl.NumberFormat')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-11.1', 'Intl.NumberFormat')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#numberformat-objects', 'Intl.NumberFormat')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.NumberFormat")}}

+
+ +

Siehe auch

+ +

{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/Intl', 'Siehe auch')}}

diff --git a/files/de/web/javascript/reference/global_objects/intl/numberformat/prototype/index.html b/files/de/web/javascript/reference/global_objects/intl/numberformat/prototype/index.html new file mode 100644 index 0000000000..aa10caf254 --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/numberformat/prototype/index.html @@ -0,0 +1,81 @@ +--- +title: Intl.NumberFormat.prototype +slug: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/prototype +tags: + - Internationalization + - JavaScript + - NumberFormat + - Property + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat +--- +
{{JSRef}}
+ +

Die Intl.NumberFormat.prototype Eigenschaft repräsentiert das Prototypobjekt für einen {{jsxref("NumberFormat", "Intl.NumberFormat")}} Konstruktor.

+ +
{{js_property_attributes(0, 0, 0)}}
+ +

Beschreibung

+ +

Siehe {{jsxref("NumberFormat")}} für eine Beschreibung von Intl.NumberFormat Instanzen.

+ +

{{jsxref("NumberFormat", "Intl.NumberFormat")}} Instanzen erben von Intl.NumberFormat.prototype. Veränderungen am Prototypobjekt werden an alle {{jsxref("NumberFormat", "Intl.NumberFormat")}} Instanzen vererbt.

+ +

Eigenschaften

+ +
+
Intl.NumberFormat.prototype.constructor
+
Eine Referenz zu Intl.NumberFormat.
+
{{jsxref("NumberFormat.format", "Intl.NumberFormat.prototype.format")}}
+
Getter; gibt eine Funktion zurück, die eine Zahl nach den Sprach- und Formatierungsoptionen dieses {{jsxref("NumberFormat")}} Objektes formatiert.
+
+ +

Methoden

+ +
+
{{jsxref("NumberFormat.formatToParts", "Intl.NumberFormat.prototype.formatToParts()")}}
+
Gibt ein {{jsxref("Array")}} mit Objekten zurück, welche die Repräsentation des Zahlenstrings in Teilen enthalten, die für sprachsicheres Formatieren genutzt werden können.
+
{{jsxref("NumberFormat.resolvedOptions", "Intl.NumberFormat.prototype.resolvedOptions()")}}
+
Gibt ein neues Objekt mit eigenschaften zurück, die Sprach- und Formatierungsoptionen enthält, die bei der Initialisierung des Objektes errechnet wurden.
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKomment
{{SpecName('ES Int 1.0', '#sec-11.2.1', 'Intl.NumberFormat.prototype')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-11.2.1', 'Intl.NumberFormat.prototype')}}{{Spec2('ES Int 2.0')}} 
{{SpecName('ES Int Draft', '#sec-Intl.NumberFormat.prototype', 'Intl.NumberFormat.prototype')}}{{Spec2('ES Int Draft')}} 
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.NumberFormat.prototype")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/numberformat/supportedlocalesof/index.html b/files/de/web/javascript/reference/global_objects/intl/numberformat/supportedlocalesof/index.html new file mode 100644 index 0000000000..2521267a18 --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/numberformat/supportedlocalesof/index.html @@ -0,0 +1,98 @@ +--- +title: Intl.NumberFormat.supportedLocalesOf() +slug: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/supportedLocalesOf +tags: + - Internationalization + - JavaScript + - Method + - NumberFormat +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/supportedLocalesOf +--- +
{{JSRef}}
+ +

Die Intl.NumberFormat.supportedLocalesOf() Methode gibt ein Array zurück, welches die Gebiete enthält, die die Zahlenformatierung unterstützen, ohne das auf das Laufzeitstandardgebiet zurückgegriffen werden muss.

+ +
{{EmbedInteractiveExample("pages/js/intl-numberformat-prototype-supportedlocalesof.html")}}
+ + + +

Syntax

+ +
Intl.NumberFormat.supportedLocalesOf(locales[, options])
+ +

Parameter

+ +
+
locales
+
Ein String mit einem BCP 47 Sprachtag, oder ein Array von solchen Strings. Für die generelle Form des locales Arguments siehe die {{jsxref("Intl", "Intl Seite", "#Gebietsidentifikation_und_-verhandlung", 1)}}.
+
options
+
+

Optional. Ein Objekt, welches die folgende Eigenschaft haben kann:

+ +
+
localeMatcher
+
Der Auswahlalgorithmus des Gebietes. Mögliche Werte sind "lookup" und "best fit"; der Standard ist "best fit". Für mehr Information über diese Option siehe auf der {{jsxref("Intl", "Intl Seite", "#Gebietsauswahl", 1)}}.
+
+
+
+ +

Rückgabewert

+ +

Gibt ein Array zurück, welches eine Untermenge der gegebenen Gebiete enthält, für die die Zahlenformatierung unterstützen wird, ohne das auf das Laufzeitstandardgebeit zurückgegriffen werden muss.

+ +

Beschreibung

+ +

Gibt ein Array zurück, welches eine Untermenge der gegebenen Gebiete (locales) enthält. Die Sprachtags, die zurückgegeben werden, unterstützen Zahlenformatierungen für das entsprechende Gebiet, ohne auf den Systemstandard zurückgreifen zu müssen.

+ +

Beispiele

+ +

Einsatz von supportedLocalesOf

+ +

Angenommen wird, dass indonesische und deutsche Zahlenformatierung unterstützt wird, aber balinesisch nicht. supportedLocalesOf gibt das indonesische und deutsche Sprachtag unverändert zurück, obwohl Pinyin nicht mit Indonesisch verwendet wird und Fachdeutsch wahrscheinlich nicht für Indonesisch verfügbar ist. Zu bemerken ist, dass der "lookup" Algorithmus verwendet wird — der"best-fit" Algorithmus könnte entscheiden, dass Indonesisch eine angemessene Ergänzung für Balinesen ist, da die meisten Balinesen Indonesisch verstehen und daher auch das balinesische Sprachtag zurückgeben.

+ +
var locales = ['ban', 'id-u-co-pinyin', 'de-ID'];
+var options = { localeMatcher: 'lookup' };
+console.log(Intl.NumberFormat.supportedLocalesOf(locales, options).join(', '));
+// → "id-u-co-pinyin, de-ID"
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpezifikationStatusKommentar
{{SpecName('ES Int 1.0', '#sec-11.2.2', 'Intl.NumberFormat.supportedLocalesOf')}}{{Spec2('ES Int 1.0')}}Initiale Definition.
{{SpecName('ES Int 2.0', '#sec-11.2.2', 'Intl.NumberFormat.supportedLocalesOf')}}{{Spec2('ES Int 2.0')}}
{{SpecName('ES Int Draft', '#sec-Intl.NumberFormat.supportedLocalesOf', 'Intl.NumberFormat.supportedLocalesOf')}}{{Spec2('ES Int Draft')}}
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.NumberFormat.supportedLocalesOf")}}

+
+ +

Siehe auch

+ + diff --git a/files/de/web/javascript/reference/global_objects/intl/pluralrules/index.html b/files/de/web/javascript/reference/global_objects/intl/pluralrules/index.html new file mode 100644 index 0000000000..fe646e4772 --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/pluralrules/index.html @@ -0,0 +1,161 @@ +--- +title: Intl.PluralRules +slug: Web/JavaScript/Reference/Global_Objects/Intl/PluralRules +tags: + - Internationalization + - Intl + - JavaScript + - NeedsTranslation + - PluralRules + - TopicStub +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/PluralRules +--- +
{{JSRef}}
+ +

The Intl.PluralRules object is a constructor for objects that enable plural sensitive formatting and plural language language rules.

+ +

Syntax

+ +
new Intl.PluralRules([locales[, options]])
+Intl.PluralRules.call(this[, locales[, options]])
+
+ +

Parameters

+ +
+
locales
+
+

Optional. A string with a BCP 47 language tag, or an array of such strings. For the general form and interpretation of the locales argument, see the {{jsxref("Intl", "Intl page", "#Locale_identification_and_negotiation", 1)}}.

+
+
options
+
+

Optional. An object with some or all of the following properties:

+ +
+
localeMatcher
+
The locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the {{jsxref("Global_Objects/Intl", "Intl page", "#Locale_negotiation", 1)}}.
+
type
+
The type to use. Possible values are: +
    +
  • "cardinal" for cardinal numbers (refering to the quantity of things). This is the default value.
  • +
  • "ordinal" for ordinal number (refering to the ordering or ranking of things, e.g. "1st", "2nd", "3rd" in English).
  • +
+
+
+
+
+ +

Description

+ +

Properties

+ +
+
{{jsxref("PluralRules.prototype", "Intl.PluralRules.prototype")}}
+
Allows the addition of properties to all objects.
+
+ +

Methods

+ +
+
{{jsxref("PluralRules.supportedLocalesOf", "Intl.PluralRules.supportedLocalesOf()")}}
+
Returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale.
+
+ +

PluralRules instances

+ +

Properties

+ +

PluralRules instances inherit the following properties from their prototype:

+ +
{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules/prototype', 'Properties')}}
+ +

Methods

+ +

PluralRules instances inherit the following methods from their prototype:

+ +
{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules/prototype', 'Methods')}}
+ +

Examples

+ +

Basic usage

+ +

In basic use without specifying a locale, a formatted string in the default locale and with default options is returned. This is useful to distinguish between singular and plural forms, e.g. "dog" and "dogs".

+ +
var pr = new Intl.PluralRules();
+
+pr.select(0);
+// → 'other' if in US English locale
+
+pr.select(1);
+// → 'one' if in US English locale
+
+pr.select(2);
+// → 'other' if in US English locale
+
+ +

Using locales

+ +

This example shows some of the variations in localized plural rules. In order to get the format of the language used in the user interface of your application, make sure to specify that language (and possibly some fallback languages) using the locales argument:

+ +
// Arabic has different plural rules
+
+new Intl.PluralRules('ar-EG').select(0);
+// → 'zero'
+new Intl.PluralRules('ar-EG').select(1);
+// → 'one'
+new Intl.PluralRules('ar-EG').select(2);
+// → 'two'
+new Intl.PluralRules('ar-EG').select(6);
+// → 'few'
+new Intl.PluralRules('ar-EG').select(18);
+// → 'many'
+
+ +

Using options

+ +

The results can be customized using the options argument, which has one property called type which you can set to ordinal. This is useful to figure out the ordinal indicator, e.g. "1st", "2nd", "3rd", "4th", "42nd" and so forth.

+ +
var pr = new Intl.PluralRules('en-US', { type: 'ordinal' });
+
+pr.select(0);
+// → 'other'
+pr.select(1);
+// → 'one'
+pr.select(2);
+// → 'two'
+pr.select(3);
+// → 'few'
+pr.select(4);
+// → 'other'
+pr.select(42);
+// → 'two'
+
+ +

Specifications

+ + + + + + + + + + + + + + +
SpecificationStatusComment
Intl Plural Rules Draft{{Spec2('ES Int Draft')}}Initial definition
+ +

Browser compatibility

+ +
+ + +

{{Compat("javascript.builtins.Intl.PluralRules")}}

+
+ +

See also

+ +
{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl', 'See_also')}}
diff --git a/files/de/web/javascript/reference/global_objects/intl/pluralrules/supportedlocalesof/index.html b/files/de/web/javascript/reference/global_objects/intl/pluralrules/supportedlocalesof/index.html new file mode 100644 index 0000000000..a33eac3e76 --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/intl/pluralrules/supportedlocalesof/index.html @@ -0,0 +1,85 @@ +--- +title: Intl.PluralRules.supportedLocalesOf() +slug: Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/supportedLocalesOf +tags: + - Internationalization + - Intl + - JavaScript + - Method + - PluralRules +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/supportedLocalesOf +--- +
{{JSRef}}
+ +

Die Intl.PluralRules.supportedLocalesOf() Methode gibt ein Array zurück, welches die Gebiete enthält, die die Pluralformatierung unterstützen, ohne das auf das Laufzeitstandardgebeit zurückgegriffen werden muss.

+ +

Syntax

+ +
Intl.PluralRules.supportedLocalesOf(locales[, options])
+ +

Parameter

+ +
+
locales
+
Ein String mit einem BCP 47 Sprachtag, oder ein Array von solchen Strings. Für die generelle Form des locales Arguments siehe die {{jsxref("Intl", "Intl Seite", "#Gebietsidentifikation_und_-verhandlung", 1)}}.
+
options
+
+

Optional. Ein Objekt, welches die folgende Eigenschaft haben kann:

+ +
+
localeMatcher
+
Der Auswahlalgorithmus des Gebietes. Mögliche Werte sind "lookup" und "best fit"; der Standard ist "best fit". Für mehr Information über diese Option siehe auf der {{jsxref("Intl", "Intl Seite", "#Gebietsauswahl", 1)}}.
+
+
+
+ +

Rückgabewert

+ +

Gibt ein Array zurück, welches eine Untermenge der gegebenen Gebiete enthält, für die die Pluralformatierung unterstützen wird, ohne das auf das Laufzeitstandardgebeit zurückgegriffen werden muss.

+ +

Beschreibung

+ +

Gibt ein Array zurück, welches eine Untermenge der gegebenen Gebiete (locales) enthält. Die Sprachtags, die zurückgegeben werden, unterstützen Zahlenformatierungen für das entsprechende Gebiet, ohne auf den Systemstandard zurückgreifen zu müssen.

+ +

Beispiele

+ +

Einsatz von supportedLocalesOf

+ +

Angenommen wird, dass indonesische und deutsche Pluralformatierung unterstützt wird, aber balinesisch nicht. supportedLocalesOf gibt das indonesische und deutsche Sprachtag unverändert zurück, obwohl Pinyin nicht mit Indonesisch verwendet wird und Fachdeutsch wahrscheinlich nicht für Indonesisch verfügbar ist. Zu bemerken ist, dass der "lookup" Algorithmus verwendet wird — der"best-fit" Algorithmus könnte entscheiden, dass Indonesisch eine angemessene Ergänzung für Balinesen ist, da die meisten Balinesen Indonesisch verstehen und daher auch das balinesische Sprachtag zurückgeben.

+ +
var locales = ['ban', 'id-u-co-pinyin', 'de-ID'];
+var options = { localeMatcher: 'lookup' };
+console.log(Intl.PluralRules.supportedLocalesOf(locales, options).join(', '));
+// → "id-u-co-pinyin, de-ID"
+
+ +

Spezifikationen

+ + + + + + + + + + + + + + +
SpezifikationStatusKommentar
Intl Plural Rules Draft{{Spec2('ES Int Draft')}}Initiale Definition
+ +

Browserkompatibilität

+ +
+ + +

{{Compat("javascript.builtins.Intl.PluralRules.supportedLocalesOf")}}

+
+ +

Siehe auch

+ + -- cgit v1.2.3-54-g00ecf