diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:41:15 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:41:15 -0500 |
| commit | 4b1a9203c547c019fc5398082ae19a3f3d4c3efe (patch) | |
| tree | d4a40e13ceeb9f85479605110a76e7a4d5f3b56b /files/de/web/javascript/reference/global_objects/intl | |
| parent | 33058f2b292b3a581333bdfb21b8f671898c5060 (diff) | |
| download | translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.gz translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.bz2 translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.zip | |
initial commit
Diffstat (limited to 'files/de/web/javascript/reference/global_objects/intl')
19 files changed, 2285 insertions, 0 deletions
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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.Collator.prototype.compare</code></strong> Eigenschaft gibt eine Funktion zurück, die zwei Strings, abhängig von der Sortierreihenfolge des {{jsxref("Collator")}} Objektes, vergleicht.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-collator-prototype-compare.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code><var>collator</var>.compare(<var>string1</var>, <var>string2</var>)</code></pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>string1</code></dt> + <dt><code>string2</code></dt> + <dd>Die Strings, die miteinander verglichen werden sollen.</dd> +</dl> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Die Funktion, die von dem Getter <code>compare</code> zurückgegeben wird, gibt eine Zahl zurück, die angibt, wie <code>string1</code> und <code>string2</code> in der Sortierreihenfolge des {{jsxref("Collator")}} Objektes zueinander stehen: Ein negativer Wert gibt an, <code>string1</code> vor <code>string2</code> kommt; Ein positiver Wert gibt an, dass <code>string1</code> nach <code>string2</code> kommt; 0 gibt an, dass beide gleich sind.</p> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Einsatz_von_compare_zum_Sortieren_von_Arrays">Einsatz von <code>compare</code> zum Sortieren von Arrays</h3> + +<p>Man kann die vom Getter <code>compare</code> 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.</p> + +<pre class="brush: js">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" +</pre> + +<h3 id="Einsatz_von_compare_zum_Suchen_in_Arrays">Einsatz von <code>compare</code> zum Suchen in Arrays</h3> + +<p>Man kann die vom Getter <code>compare</code> zurückgegebenen Funktion zum suchen von passenden Elementen in einem Array benutzen:</p> + +<pre class="brush: js">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" +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-10.3.2', 'Intl.Collator.prototype.compare')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-10.3.2', 'Intl.Collator.prototype.compare')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.Collator.prototype.compare', 'Intl.Collator.prototype.compare')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.Collator.compare")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("Collator", "Intl.Collator")}}</li> + <li>{{jsxref("String.prototype.localeCompare()")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Das <strong><code>Intl.Collator</code></strong> Objekt ist ein Konstruktor für Überprüfer, Objekte die Sprachsensitive Stringvergleiche unterstützen.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-collator.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code>new Intl.Collator([<var>locales</var>[, <var>options</var>]]) +Intl.Collator.call(<var>this</var>[, <var>locales</var>[, <var>options</var>]])</code></pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>locales</code></dt> + <dd> + <p>Optional. Ein String mit einem BCP 47 Sprachtag, oder einem Array von solchen Strings. Für die generelle Interpretation für das <code>locales</code> Argument, siehe auf der {{jsxref("Global_Objects/Intl", "Intl Seite", "#Gebietsidentifikation_und_-verhandlung", 1)}} nach. Die folgenden Unicode-Erweiterunsschlüssel sind erlaubt:</p> + + <dl> + <dt><code>co</code></dt> + <dd>Abweichender Vergleich für einige Gebiete. Folgende Werte sind möglich: <code>"big5han"</code>, <code>"dict"</code>, <code>"direct"</code>, <code>"ducet"</code>, <code>"gb2312"</code>, <code>"phonebk"</code>, <code>"phonetic"</code>, <code>"pinyin"</code>, <code>"reformed"</code>, <code>"searchjl"</code>, <code>"stroke"</code>, <code>"trad"</code>, <code>"unihan"</code>. Die Werte <code>"standard"</code> und <code>"search"</code> werden ignoriert. Sie werden durch die EIgenschaft <code>usage</code> des <code>options</code> Objekt ersetzt (siehe unten).</dd> + <dt><code>kn</code></dt> + <dd>Wenn numerische Vergleiche benutzt werden soll, so wie "1" < "2" < "10". Mögliche Werte sind <code>"true"</code> und <code>"false"</code>. Diese Option kann über eine <code>options</code> Eigenschaft oder über einen Unicode-Erweiterungsschlüssel gesetzt werden. Wenn beide gesetzt sind, hat die <code>options</code> Eigenschaft Vorrang.</dd> + <dt><code>kf</code></dt> + <dd>Wenn Kleinschreibung oder Großschreibung zuerst in der Reihenfolge kommt. Mögliche Wert sind <code>"upper"</code>, <code>"lower"</code>, or <code>"false"</code> (benutzt den Gebietsstandard). Diese Option kann über eine <code>options</code> Eigenschaft oder über einen Unicode-Erweiterungsschlüssel gesetzt werden. Wenn beide gesetzt sind, hat die <code>options</code> Eigenschaft Vorrang.</dd> + </dl> + </dd> + <dt><code>options</code></dt> + <dd> + <p>Optional. Ein Objekt einigen oder allen der folgenden Eigenschafte:</p> + + <dl> + <dt><code>localeMatcher</code></dt> + <dd>Der Algorithmus zur Ermittlung des Gebiets. Mögliche Werte sind <code>"lookup"</code> and <code>"best fit"</code>; Der Standard ist <code>"best fit"</code>. Für Informationen über diese Option siehe auf der {{jsxref("Global_Objects/Intl", "Intl Seite", "#Gebietsauswahl", 1)}} nach.</dd> + <dt><code>usage</code></dt> + <dd>Ob der Vergleich für das Sortieren oder Suchen von Strings ist. Mögliche Werte sind <code>"sort"</code> and <code>"search"</code>; der Standard ist <code>"sort"</code>.</dd> + <dt><code>sensitivity</code></dt> + <dd> + <p>Welche Unterschiede in Strings sollen zu Resultaten ungleich 0 führen. Mögliche Werte:</p> + + <ul> + <li><code>"base"</code>: Nur Strings die im Basisbuchstaben ungleiche sind. Beispiele: <code>a ≠ b</code>, <code>a = á</code>, <code>a = A</code>.</li> + <li><code>"accent"</code>: Nur Strings die im Basisbuchstaben oder Akzent und anderen diakritisch Zeichen ungleich sind. Beispiele: <code>a ≠ b</code>, <code>a ≠ á</code>, <code>a = A</code>.</li> + <li><code>"case"</code>: Nur Strings die im Basisbuchstaben oder der Größe ungleich sind. Beispiele: <code>a ≠ b</code>, <code>a = á</code>, <code>a ≠ A</code>.</li> + <li><code>"variant"</code>: 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: <code>a ≠ b</code>, <code>a ≠ á</code>, <code>a ≠ A</code>.</li> + </ul> + + <p>Der Standardwert ist <code>"variant"</code> wenn <code>usage</code> auf <code>"sort"</code> steht. Für <code>usage</code> gleich <code>"search"</code> ist es Gebietsabhängig.</p> + </dd> + <dt><code>ignorePunctuation</code></dt> + <dd>Wenn Interpunktion ignoriert werden soll. Mögliche Werte sind <code>true</code> and <code>false</code>; Der Standard ist <code>false</code>.</dd> + <dt><code>numeric</code></dt> + <dd>Wenn numerische Vergleiche benutzt werden soll, so wie "1" < "2" < "10". Mögliche Werte sind <code>"true"</code> und <code>"false"</code>. Der Standard ist <code>false</code>. Diese Option kann über eine <code>options</code> Eigenschaft oder über einen Unicode-Erweiterungsschlüssel gesetzt werden. Wenn beide gesetzt sind, hat die <code>options</code> Eigenschaft Vorrang. Implementierungen müssen diese Eigenschaft nicht unterstützen.</dd> + <dt><code>caseFirst</code></dt> + <dd>Wenn Kleinschreibung oder Großschreibung zuerst in der Reihenfolge kommt. Mögliche Wert sind <code>"upper"</code>, <code>"lower"</code>, or <code>"false"</code> (benutzt den Gebietsstandard). Der Standard ist <code>"false"</code>. Diese Option kann über eine <code>options</code> Eigenschaft oder über einen Unicode-Erweiterungsschlüssel gesetzt werden. Wenn beide gesetzt sind, hat die <code>options</code> Eigenschaft Vorrang. Implementierungen müssen diese Eigenschaft nicht unterstützen.</dd> + </dl> + </dd> +</dl> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Das <code>Intl.Collator</code> Objekt hat die folgenden Eigenschaften und Methoden:</p> + +<h3 id="Eigenschaften">Eigenschaften</h3> + +<dl> + <dt>{{jsxref("Collator.prototype", "Intl.Collator.prototype")}}</dt> + <dd>Erlaubt das hinzufügen von Eigenschaften zu allen Objekten.</dd> +</dl> + +<h3 id="Methoden">Methoden</h3> + +<dl> + <dt>{{jsxref("Collator.supportedLocalesOf", "Intl.Collator.supportedLocalesOf()")}}</dt> + <dd>Gibt ein Array von Gebieten zurück, die unterstützt werden, ohne dass die Backuplösung des Umgebungsstandards eingesetzt wird.</dd> +</dl> + +<h2 id="Collator_Instanzen"><code>Collator</code> Instanzen</h2> + +<h3 id="Eigenschaften_2">Eigenschaften</h3> + +<p><code>Collator</code> Instanzen erben die folgenden Eigenschaften von ihrem Prototyp:</p> + +<div>{{page('de/docs/Web/JavaScript/Reference/Global_Objects/Collator/prototype', 'Eigenschaften')}}</div> + +<h3 id="Methoden_2">Methoden</h3> + +<p><code>Collator</code> Instanzen erben die folgenden Methoden von ihrem Prototyp:</p> + +<div>{{page('de/docs/Web/JavaScript/Reference/Global_Objects/Collator/prototype', 'Methoden')}}</div> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Einsatz_von_Collator">Einsatz von <code>Collator</code></h3> + +<p>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:</p> + +<pre class="brush: js">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 +</pre> + +<p>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.</p> + +<h3 id="Einsatz_von_locales">Einsatz von <code>locales</code></h3> + +<p>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 <code>locales</code> Argument spezifizieren (und einige Backupsprachen):</p> + +<pre class="brush: js">// 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 +</pre> + +<h3 id="Einsatz_von_options">Einsatz von <code>options</code></h3> + +<p>Das Ergebnis von {{jsxref("Collator.prototype.compare()")}} kann durch den Einsatz des <code>options</code> Argument verändert werden:</p> + +<pre class="brush: js">// 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 +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-10.1', 'Intl.Collator')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-10.1', 'Intl.Collator')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#collator-objects', 'Intl.Collator')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.Collator")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<div>{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/Intl', 'Siehe_auch')}}</div> 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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.Collator.prototype</code></strong> Eigenschaft repräsentiert das Prototypobjekt für den {{jsxref("Collator", "Intl.Collator")}} Konstruktor.</p> + +<div>{{js_property_attributes(0, 0, 0)}}</div> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Siehe im Beitrag {{jsxref("Collator")}} für eine Beschreibung von <code>Intl.Collator</code> Instanzen.</p> + +<p>{{jsxref("Collator", "Intl.Collator")}} Instanzen erben von <code>Intl.Collator.prototype</code>. Änderungen am Prototypobjekt werden an alle {{jsxref("Collator", "Intl.Collator")}} Instanzen vererbt.</p> + +<h2 id="Eigenschaften">Eigenschaften</h2> + +<dl> + <dt>{{jsxref("Collator.compare", "Intl.Collator.prototype.compare")}}</dt> + <dd>Getter; gibt eine Funktion zurück, die zwei Strings abhängig vom der Sortierreihenfolge des {{jsxref("Global_Objects/Collator", "Intl.Collator")}} Objektes vergleicht.</dd> + <dt><code>Intl.Collator.prototype.constructor</code></dt> + <dd>Eine Referenz zu {{jsxref("Global_Objects/Collator", "Intl.Collator")}}.</dd> +</dl> + +<h2 id="Methoden">Methoden</h2> + +<dl> + <dt>{{jsxref("Collator.resolvedOptions", "Intl.Collator.prototype.resolvedOptions()")}}</dt> + <dd>Gibt ein neues Objekt mit Eigenschaften zu Gebiets- und Collation-Optionen, die bei der Initialisierung des Objekte ermittelt wurden.</dd> +</dl> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-10.2.1', 'Intl.Collator.prototype')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-10.2.1', 'Intl.Collator.prototype')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.Collator.prototype', 'Intl.Collator.prototype')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.Collator.prototype")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("Collator", "Intl.Collator")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.Collator.prototype.resolvedOptions()</code></strong> Methode gibt ein neues Objekt mit Eigenschaften zurück, welches die Gebiets- und Vergleichs-Optionen während der Initialisierung des {{jsxref("Collator")}} Objektes wiederspiegelt.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-collator-prototype-resolvedoptions.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code><var>collator</var>.resolvedOptions()</code></pre> + +<h3 id="Rückgabewert">Rückgabewert</h3> + +<p>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.</p> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Das Ergebnisobjekt hat die folgenden Eigenschaften:</p> + +<dl> + <dt><code>locale</code></dt> + <dd>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 <code>locale</code> vorhanden.</dd> + <dt><code>usage</code></dt> + <dt><code>sensitivity</code></dt> + <dt><code>ignorePunctuation</code></dt> + <dd>Die Werte der Unterstützten Eigenschaften des <code>options</code> Argument oder eingesetzte Standardwerte.</dd> + <dt><code>collation</code></dt> + <dd>Der überbene Wert des Unicode-Werweiterungsschlüssels <code>"co"</code>, wenn dieser für <code>locale</code> unterstützt wird oder <code>"default"</code>.</dd> + <dt><code>numeric</code></dt> + <dt><code>caseFirst</code></dt> + <dd>Die Werte der Unterstützten Eigenschaften des <code>options</code> Argument oder der eingesetzten Unicode-Erweiterungsschlüssel <code>"kn"</code> and <code>"kf"</code> oder den Standardwerten. Wenn die Implimentierung diese Eigenschaften nicht unterstützt, werden diese weggelassen.</dd> +</dl> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Einsatz_der_resolvedOptions_Methode">Einsatz der <code>resolvedOptions</code> Methode</h3> + +<pre class="brush: js">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 +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-10.3.3', 'Intl.Collator.prototype.resolvedOptions')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-10.3.3', 'Intl.Collator.prototype.resolvedOptions')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.Collator.prototype.resolvedOptions', 'Intl.Collator.prototype.resolvedOptions')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.Collator.resolvedOptions")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("Collator", "Intl.Collator")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.Collator.supportedLocalesOf()</code></strong> Methode gibt ein Array zurück, welches die Gebiete enthält, die von <code>Collation</code> unterstützt werden, ohne das die Laufzeitumgebung auf den Systemstandard zurückgreifen muss.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-collator-prototype-supportedlocalesof.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code>Intl.Collator.supportedLocalesOf(<var>locales</var>[, <var>options</var>])</code></pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>locales</code></dt> + <dd>Ein String mit einem BCP 47 Sprachtag oder einem Array von solchen. Für die generelle Form des <code>locales</code> Argument siehe die {{jsxref("Global_Objects/Intl", "Intl Seite", "#Gebietsidentifikation_und_-verhandlung", 1)}}.</dd> + <dt><code>options</code></dt> + <dd> + <p>Optional. Ein Objekt welches die folgenden Eigenschaften haben kann:</p> + + <dl> + <dt><code>localeMatcher</code></dt> + <dd>Der Auswahlalgorithmus für das Gebiet. Mögliche Werte sind <code>"lookup"</code> and <code>"best fit"</code>; Der Standard ist <code>"best fit"</code>. Mehr Informationen über diese Algorithmen sind auch der {{jsxref("Global_Objects/Intl", "Intl Seite", "#Gebietsauswahl", 1)}} verfügbar.</dd> + </dl> + </dd> +</dl> + +<h3 id="Rückgabewert">Rückgabewert</h3> + +<p>Ein Array von String, welches eine Untermenge von Gebiete enthält, die von <code>Collation</code> unterstützt werden, ohne das die Laufzeitumgebung auf den Systemstandard zurückgreifen muss.</p> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Gibt ein Array mit einer Untermenge von Sprachtags, die in <code>locales</code> angegeben sind zurück. Die Sprachtags, die zurückgegeben werden, werden von <code>collation</code> unterstützt und vom Auswahlalgorithmus ausgesucht, ohne auf eine Standard-Sprache zurückzugreifen.</p> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Einsatz_von_supportedLocalesOf">Einsatz von <code>supportedLocalesOf</code></h3> + +<p>Angenommen wird, dass indonesisch und deutsch in <code>collation</code> unterstützt wird, aber balinesisch nicht. <code>supportedLocalesOf</code> 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 <code>"lookup"</code> Algorithmus verwendet wird — der<code>"best-fit"</code> 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.</p> + +<pre class="brush: js">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" +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-10.2.2', 'Intl.Collator.supportedLocalesOf')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-10.2.2', 'Intl.Collator.supportedLocalesOf')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.Collator.supportedLocalesOf', 'Intl.Collator.supportedLocalesOf')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.Collator.supportedLocalesOf")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("Collator", "Intl.Collator")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.DateTimeFormat.prototype.format</code></strong> Eigenschaft gibt einen Getter-Funktion zurück, die einen Zeitstempel nach den Gebiets- und Formatierungsoptionen des {{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}} Objekts formatiert.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-datetimeformat-prototype-format.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code><var>dateTimeFormat</var>.format(<var>date</var>)</code></pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>date</code></dt> + <dd>Der Zeitstempel, der formatiert werden soll.</dd> +</dl> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Die Funktion, die vom <code>format</code> 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.</p> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Einsatz_von_format">Einsatz von <code>format</code></h3> + +<p>Die vom <code>format</code> Getter zurückgegebene Funktion wird zum Formatieren von Zeitstempeln genutzt, hier für Serbien:</p> + +<pre class="brush: js">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." +</pre> + +<h3 id="Einsatz_von_format_mit_map">Einsatz von <code>format</code> mit <code>map</code></h3> + +<p>Die vom <code>format</code> 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.</p> + +<pre class="brush: js">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" +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-12.3.2', 'Intl.DateTimeFormat.format')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-12.3.2', 'Intl.DateTimeFormat.format')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.DateTimeFormat.prototype.format', 'Intl.DateTimeFormat.format')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.DateTimeFormat.format")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("Global_Objects/DateTimeFormat", "Intl.DateTimeFormat")}}</li> + <li>{{jsxref("Date.prototype.toLocaleString()")}}</li> + <li>{{jsxref("Date.prototype.toLocaleDateString()")}}</li> + <li>{{jsxref("Date.prototype.toLocaleTimeString()")}}</li> +</ul> 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 +--- +<div>{{JSRef}} {{SeeCompatTable}}</div> + +<p>Die <strong><code>Intl.DateTimeFormat.prototype.formatToParts()</code></strong> Methode erlaubt gebietssichere Formatierung von Strings, die von <code>DateTimeFormat</code> Formatierungen erzeugt werden.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox">Intl.DateTimeFormat.prototype.formatToParts(date)</pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>date</code> {{optional_inline}}</dt> + <dd>Der Zeitstempel, der formatiert werden soll.</dd> +</dl> + +<h3 id="Rückgabewert">Rückgabewert</h3> + +<p>Ein {{jsxref("Array")}} von Objekten, die das Formatierte Datum in Teilen wiederspielgeln.</p> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Die <code>formatToParts()</code> Methode ist nützlich für benutzerdefinierte Formatierung von Zeitpunktsstrings. <span id="result_box" lang="de"><span>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.</span> <span>Die Struktur, die die <code>formatToParts()</code> Methode zurückgibt, sieht so aus:</span></span></p> + +<pre class="brush: js">[ + { type: 'day', value: '17' }, + { type: 'weekday', value: 'Monday' } +]</pre> + +<p>Mögliche Typen sind die folgenden:</p> + +<dl> + <dt>day</dt> + <dd>Der String, der für den Tag benutzt wird. Zum Beispiel <code>"17"</code>.</dd> + <dt>dayPeriod</dt> + <dd>Der String, der für die Tagesperiode benutzt wird. Zum Beispiel <code>"AM"</code> oder <code>"PM"</code>.</dd> + <dt>era</dt> + <dd>Der String, der für die Ära benutzt wird. Zum Beispiel <code>"BC"</code> oder <code>"AD"</code>.</dd> + <dt>hour</dt> + <dd>Der String, der für die Stunde benutzt wird. Zum Beispiel <code>"3"</code> oder <code>"03"</code>.</dd> + <dt>literal</dt> + <dd>Der String, der als Trennung für das Datum und die Zeitbenutzt benutzt wird. Zum Beispiel <code>"/"</code>, <code>","</code>, <code>"o'clock"</code>, <code>"de"</code>, etc.</dd> + <dt>minute</dt> + <dd>Der String, der für die Minute benutzt wird. Zum Beispiel <code>"00"</code>.</dd> + <dt>month</dt> + <dd>Der String, der für den Monat benutzt wird. Zum Beispiel <code>"12"</code>.</dd> + <dt>second</dt> + <dd>Der String, der für die Sekunde benutzt wird. Zum Beispiel <code>"07"</code> oder <code>"42"</code>.</dd> + <dt>timeZoneName</dt> + <dd>Der String, der für den Zeitzonennamen benutzt wird. Zum Beispiel <code>"UTC"</code>.</dd> + <dt>weekday</dt> + <dd>Der String, der für den Wochentag benutzt wird. Zum Beispiel <code>"M"</code>, <code>"Monday"</code> oder <code>"Montag"</code>.</dd> + <dt>year</dt> + <dd>Der String, der für das Jahr benutzt wird. Zum Beispiel <code>"2012"</code> oder <code>"96"</code>.</dd> +</dl> + +<h2 id="Beispiele">Beispiele</h2> + +<p><code>DateTimeFormat</code> gibt lokalisierte Strings aus, die nicht direkt verändert werden können:</p> + +<pre class="brush: js">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" +</pre> + +<p>Oftmals ist es in vielen Benutzeroberflächen erwünscht die Formatierung dieser Strings zu verändern. Die <code>formatToParts</code> Methode erlaubt lokalsicheres Formatieren von Strings, die von <code>DateTimeFormat</code> in Teilstrings unterstützt werden:</p> + +<pre class="brush: js">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' } +] +</pre> + +<p>Jetzt sind die Informationen separiert vorhanden und man kann Formatierungen und Konkatinationen benutzerdefiniert vornehmen. Zum Beispiel unter Einsatz von {{jsxref("Array.prototype.map()")}}, <a href="/de/docs/Web/JavaScript/Reference/Functions/Arrow_functions">Arrow Funktionen</a>, einem <a href="/de/docs/Web/JavaScript/Reference/Statements/switch">switch Statement</a>, <a href="/de/docs/Web/JavaScript/Reference/Template_literals">Templateliteralen</a> und {{jsxref("Array.prototype.reduce()")}}.</p> + +<pre class="brush: js">var dateString = formatter.formatToParts(date).map(({type, value}) => { + switch (type) { + case 'dayPeriod': return `<b>${value}</b>`; + default : return value; + } +}).reduce((string, part) => string + part); +</pre> + +<p>Diese Beispiel macht die Tagesperiode fett, wenn die <code>formatToParts()</code> Methode benutzt wird.</p> + +<pre class="brush: js">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>"</pre> + +<h2 id="Polyfill">Polyfill</h2> + +<p>Ein Polyfill für die Funktionalität ist im <a href="https://github.com/zbraniecki/proposal-intl-formatToParts">proposal repository</a> verfügbar.</p> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.DateTimeFormat.prototype.formatToParts', 'Intl.DateTimeFormat.prototype.formatToParts')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td>Initiale Definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.DateTimeFormat.formatToParts")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}</li> + <li>{{jsxref("DateTimeFormat.format", "Intl.DateTimeFormat.prototype.format")}}</li> + <li>{{jsxref("Date.prototype.toLocaleString()")}}</li> + <li>{{jsxref("Date.prototype.toLocaleDateString()")}}</li> + <li>{{jsxref("Date.prototype.toLocaleTimeString()")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Das <strong><code>Intl.DateTimeFormat</code></strong> Objekt ist ein Konstruktor für Objekte, die sprachsensitive Formatierung von Datums- und Zeitangaben ermöglicht.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-datetimeformat.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code>new Intl.DateTimeFormat([<var>locales</var>[, <var>options</var>]]) +Intl.DateTimeFormat.call(<var>this</var>[, <var>locales</var>[, <var>options</var>]])</code></pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>locales</code></dt> + <dd>Optional. Ein String mit einem BCP 47 Sprachcode, oder einem Array von Sprachcodes. Für die generelle Form und Interpretation des <code>locales</code> Arguments siehe auf der {{jsxref("Global_Objects/Intl", "Intl Seite", "#Locale_identification_and_negotiation", 1)}}. Die folgenden Unicode Erweiterungen sind erlaubt:</dd> + <dd> + <dl> + <dt><code>nu</code></dt> + <dd>Zahlensysteme. Mögliche Werte sind: <code>"arab"</code>, <code>"arabext"</code>, <code>"bali"</code>, <code>"beng"</code>, <code>"deva"</code>, <code>"fullwide"</code>, <code>"gujr"</code>, <code>"guru"</code>, <code>"hanidec"</code>, <code>"khmr"</code>, <code>"knda"</code>, <code>"laoo"</code>, <code>"latn"</code>, <code>"limb"</code>, <code>"mlym"</code>, <code>"mong"</code>, <code>"mymr"</code>, <code>"orya"</code>, <code>"tamldec"</code>, <code>"telu"</code>, <code>"thai"</code>, <code>"tibt"</code>.</dd> + <dt><code>ca</code></dt> + <dd>Kalender. Mögliche Werte sind: <code>"buddhist"</code>, <code>"chinese"</code>, <code>"coptic"</code>, <code>"ethioaa"</code>, <code>"ethiopic"</code>, <code>"gregory"</code>, <code>"hebrew"</code>, <code>"indian"</code>, <code>"islamic"</code>, <code>"islamicc"</code>, <code>"iso8601"</code>, <code>"japanese"</code>, <code>"persian"</code>, <code>"roc"</code>.</dd> + <dt><code>hc</code></dt> + <dd>Stundenzyklus. Mögliche Werte sind: <code>"h11"</code>, <code>"h12"</code>, <code>"h23"</code>, <code>"h24"</code>.</dd> + </dl> + </dd> + <dt><code>options</code></dt> + <dd> + <p>Optional. Ein Objekt mit einigen oder allen folgenden Eigenschaften:</p> + + <dl> + <dt><code>localeMatcher</code></dt> + <dd>Der Sprachfindungsalgorithmus, der eingesetzt wird. Mögliche Werte sind <code>"lookup"</code> und <code>"best fit"</code>. Als Standard ist <code>"best fit"</code> vorgegeben. Für Informationen über diese Option siehe auf der {{jsxref("Global_Objects/Intl", "Intl Seite", "#Locale_negotiation", 1)}} nach.</dd> + <dt><code>timeZone</code></dt> + <dd>Die eingesetzte Zeitzone. Der einzige Wert, den alle Implementierungen verstehen ist <code>"UTC"</code>. Der Standardwert ist die Standard-Laufzeitzeitzone. Manche Implementierungen erkennen auch die Namen der <a href="https://www.iana.org/time-zones">IANA Zeitzonendatenbank</a>, wie zum Beispiel <code>"Asia/Shanghai"</code>, <code>"Asia/Kolkata"</code> und <code>"America/New_York"</code>.</dd> + <dt><code>hour12</code></dt> + <dd>Wird eingesetzt, wenn 12-Stunden Zeitangaben eingesetzt werden (im gegensatz zu 24-Stunden Zeitangaben). Mögliche Werte sind <code>true</code> und <code>false</code>. Diese Option überschreibt den <code>hc</code> Sprachen-Tag und/oder <code>hourCycle</code> wenn beide vorhanden sind.</dd> + <dt><code>hourCycle</code></dt> + <dd>Der eingesetzte Stundenzyklus. Mögliche Werte sind <code>"h11"</code>, <code>"h12"</code>, <code>"h23"</code> oder <code>"h24"</code>. Diese Option überschreibt den <code>hc</code> Sprachen-Tag, wenn beide präsent sind und die <code>hour12</code> Option hat Vorrang, wenn beide Optionen spezifiziert sind.</dd> + <dt><code>formatMatcher</code></dt> + <dd>Der eingesetzte Formaterkennungsalgorithmus. Mögliche Werte sind <code>"basic"</code> und <code>"best fit"</code>. Der Standard ist <code>"best fit"</code>. Siehe folgenden Absatz, um den Einsatz dieses Parameters zu verstehen.</dd> + </dl> + + <p>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:</p> + + <ul> + <li><code>Wochentag, Jahr, Monat, Tag, Stunde, Minute, Sekunde</code></li> + <li><code>Wochentag, Jahr, Monat, Tag </code></li> + <li><code>Jahr, Monat, Tag </code></li> + <li><code>Jahr, Monat</code></li> + <li><code>Monat, Tag </code></li> + <li><code>Stunde, Minute, Sekunde </code></li> + <li><code>Stunde, Minute</code></li> + </ul> + + <p>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 <a href="http://www.ecma-international.org/ecma-402/1.0/#BasicFormatMatcher">voll spezifizierter <code>"basic"</code> Algorithmus</a> und ein implementierungsabhängiger <code>"best fit"</code> Algorithmus.</p> + + <dl> + <dt><code>weekday</code></dt> + <dd>Die Repräsentation der Wochentage. Mögliche Werte sind <code>"narrow"</code>, <code>"short"</code> und <code>"long"</code>.</dd> + <dt><code>era</code></dt> + <dd>Die Repräsentation der Epoche. Mögliche Werte sind <code>"narrow"</code>, <code>"short"</code> und <code>"long"</code>.</dd> + <dt><code>year</code></dt> + <dd>Die Repräsentation des Jahres. Mögliche Werte sind <code>"numeric"</code> und <code>"2-digit"</code>.</dd> + <dt><code>month</code></dt> + <dd>Die Repräsentation des Monats. Mögliche Werte sind <code>"numeric"</code>, <code>"2-digit"</code>, <code>"narrow"</code>, <code>"short"</code> und <code>"long"</code>.</dd> + <dt><code>day</code></dt> + <dd>Die Repräsentation des Tages. Mögliche Werte sind <code>"numeric"</code> und <code>"2-digit"</code>.</dd> + <dt><code>hour</code></dt> + <dd>Die Repräsentation der Stunden. Mögliche Werte sind <code>"numeric"</code> und <code>"2-digit"</code>.</dd> + <dt><code>minute</code></dt> + <dd>Die Repräsentation der Minuten. Mögliche Werte sind <code>"numeric"</code> und <code>"2-digit"</code>.</dd> + <dt><code>second</code></dt> + <dd>Die Repräsentation der Sekunden. Mögliche Werte sind <code>"numeric"</code> und <code>"2-digit"</code>.</dd> + <dt><code>timeZoneName</code></dt> + <dd>Die Repräsentation des Zeitzonennamens. Mögliche Werte sind <code>"short"</code> und <code>"long"</code>.</dd> + </dl> + + <p class="noinclude">Die Standardwerte für jede Datums-Zeit-Komponente ist {{jsxref("undefined")}}, wenn jedoch alle Komponenten {{jsxref("undefined")}} sind, wird <code>year</code>, <code>month</code>, and <code>day</code> als <code>"numeric"</code> angenommen.</p> + </dd> +</dl> + +<h2 id="Beschreibung">Beschreibung</h2> + +<h3 id="Eigenschaften">Eigenschaften</h3> + +<dl> + <dt>{{jsxref("DateTimeFormat.prototype", "Intl.DateTimeFormat.prototype")}}</dt> + <dd>Ermögliche es Eigenschaften und Methoden für alle Objekte zu definieren.</dd> +</dl> + +<h3 id="Methoden">Methoden</h3> + +<dl> + <dt>{{jsxref("DateTimeFormat.supportedLocalesOf", "Intl.DateTimeFormat.supportedLocalesOf()")}}</dt> + <dd>Gibt ein Array an Sprachen zurück, die unterstützt werden, ohne dass auf den Laufzeitumgebungsstandard zurückgegriffen wird.</dd> +</dl> + +<h2 id="DateTimeFormat_Instanzen"><code>DateTimeFormat</code> Instanzen</h2> + +<h3 id="Eigenschaften_2">Eigenschaften</h3> + +<p><code>DateTimeFormat</code> Instanzen erben die folgenden Eigenschaften von ihrem Prototypen:</p> + +<div>{{page("/de/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/prototype", "Eigenschaften")}}</div> + +<h3 id="Methoden_2">Methoden</h3> + +<p><code>DateTimeFormat</code> Instanzen erben die folgenden Methoden von ihrem Prototypen:</p> + +<div>{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/prototype', 'Methoden')}}</div> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Einsatz_von_DateTimeFormat">Einsatz von <code>DateTimeFormat</code></h3> + +<p>Der Basiseinsatz ohne extra Sprach- und Formatierungsoptionen, sondern den Standardeinstellungen.</p> + +<pre class="brush: js">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. +</pre> + +<h3 id="Einsatz_von_locales">Einsatz von <code>locales</code></h3> + +<p>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 <code>locales</code> Argument eingestellt werden.</p> + +<pre class="brush: js">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)); +// → "<span dir="rtl">٢٠/١٢/٢٠١٢</span>" + +// 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" +</pre> + +<h3 id="Einsatz_von_options">Einsatz von <code>options</code></h3> + +<p>Das Datums- und Zeitformat kann mit dem Einsatz des <code>options</code> Arguments vom Benutzer definiert werden.</p> + +<pre class="brush: js">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" +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-12.1', 'Intl.DateTimeFormat')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-12.1', 'Intl.DateTimeFormat')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#datetimeformat-objects', 'Intl.DateTimeFormat')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.DateTimeFormat")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<div>{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/Intl', 'See_also')}}</div> 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 +--- +<div>{{JSRef}}</div> + +<div>Die <strong><code>Intl.DateTimeFormat.prototype</code></strong> Eigenschaft ist ein Prototyp Objekt für den {{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}} Konstruktor.</div> + +<div> </div> + +<div>{{js_property_attributes(0, 0, 0)}}</div> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Für eine Beschreibung von <code>Intl.DateTimeFormat</code> Instanzen siehe im Artikel {{jsxref("DateTimeFormat")}} nach.</p> + +<p>{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}} Instanzen erben von <code>Intl.DateTimeFormat.prototype</code>. Änderungen in der Eigenschaft <code>prototype</code> wirken sich auf alle Instanzen von {{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}} aus.</p> + +<h2 id="Eigenschaften">Eigenschaften</h2> + +<dl> + <dt><code>Intl.DateTimeFormat.prototype.constructor</code></dt> + <dd>Eine Referenz zu {{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}.</dd> + <dt>{{jsxref("DateTimeFormat.format", "Intl.DateTimeFormat.prototype.format")}}</dt> + <dd>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.</dd> +</dl> + +<h2 id="Methoden">Methoden</h2> + +<dl> + <dt>{{jsxref("DateTimeFormat.formatToParts", "Intl.DateTimeFormat.prototype.formatToParts()")}}</dt> + <dd>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.</dd> + <dt>{{jsxref("DateTimeFormat.resolvedOptions", "Intl.DateTimeFormat.prototype.resolvedOptions()")}}</dt> + <dd>Gibt ein neues Objekt mit den Eigenschaften der Sprache und des Formates zum Erstellungszeitpunkt des Objektes zurück.</dd> +</dl> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-12.2.1', 'Intl.DateTimeFormat.prototype')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-12.2.1', 'Intl.DateTimeFormat.prototype')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.DateTimeFormat.prototype', 'Intl.DateTimeFormat.prototype')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.DateTimeFormat.prototype")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.DateTimeFormat.prototype.resolvedOptions()</code></strong> 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.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-datetimeformat-prototype-resolvedoptions.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code><var>dateTimeFormat</var>.resolvedOptions()</code></pre> + +<h3 id="Rückgabewert">Rückgabewert</h3> + +<p>Ein neues Objekt mit den Eigenschaften zum Gebiet und der Datums- und Zeitformatierung, die beim der Initialisierung eines {{jsxref("DateTimeFormat", "DateTimeFormat")}} Objektes berechnet werden.</p> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Das resultierende Objekt hat die folgenden Eigenschaften:</p> + +<dl> + <dt><code>locale</code></dt> + <dd>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 <code>locale</code> enthalten.</dd> + <dt><code>calendar</code></dt> + <dt><code>numberingSystem</code></dt> + <dd>Dieser Wert wird durch die Unicode-Erweiterungsschlüssel <code>"ca"</code> und <code>"nu"</code> oder mit einem Standardwert gefüllt.</dd> + <dt><code>timeZone</code></dt> + <dd>Die Wert für die Unterstützen Eigenschaft im <code>options</code> 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.</dd> + <dt><code>hour12</code></dt> + <dd>Der Wert der verwendeten Eigenschaft im <code>options</code> Argument oder ein Standard-Wert.</dd> + <dt><code>weekday</code></dt> + <dt><code>era</code></dt> + <dt><code>year</code></dt> + <dt><code>month</code></dt> + <dt><code>day</code></dt> + <dt><code>hour</code></dt> + <dt><code>minute</code></dt> + <dt><code>second</code></dt> + <dt><code>timeZoneName</code></dt> + <dd>Die Werte resultieren von den Eigenschaften in dem <code>options</code> 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.</dd> +</dl> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Einsatz_der_resolvedOptions_Methode">Einsatz der <code>resolvedOptions</code> Methode</h3> + +<pre class="brush: js">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" +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-12.3.3', 'Intl.DateTimeFormat.prototype.resolvedOptions')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-Intl.DateTimeFormat.prototype.resolvedOptions', 'Intl.DateTimeFormat.prototype.resolvedOptions')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.DateTimeFormat.prototype.resolvedOptions', 'Intl.DateTimeFormat.prototype.resolvedOptions')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.DateTimeFormat.resolvedOptions")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.DateTimeFormat.supportedLocalesOf()</code></strong> 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.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-datetimeformat-prototype-supportedlocalesof.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code>Intl.DateTimeFormat.supportedLocalesOf(<var>locales</var>[, <var>options</var>])</code></pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>locales</code></dt> + <dd>Ein String mit einem BCP 47 Sprachtag, oder ein Array von solchen Strings. Für die generelle Form des <code>locales</code> Arguments siehe die {{jsxref("Intl", "Intl Seite", "#Gebietsidentifikation_und_-verhandlung", 1)}}.</dd> + <dt><code>options</code></dt> + <dd> + <p>Optional. Ein Objekt, welches die folgende Eigenschaft haben kann:</p> + + <dl> + <dt><code>localeMatcher</code></dt> + <dd>Der Auswahlalgorithmus des Gebietes. Mögliche Werte sind <code>"lookup"</code> und <code>"best fit"</code>; der Standard ist <code>"best fit"</code>. Für mehr Information über diese Option siehe auf der {{jsxref("Intl", "Intl Seite", "#Gebietsauswahl", 1)}}.</dd> + </dl> + </dd> +</dl> + +<h3 id="Rückgabewert">Rückgabewert</h3> + +<p>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.</p> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Gibt ein Array zurück, welches eine Untermenge der gegebenen Gebiete (<code>locales</code>) 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.</p> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Einsatz_von_supportedLocalesOf">Einsatz von <code>supportedLocalesOf</code></h3> + +<p>Angenommen wird, dass indonesische und deutsche Datums- und Zeitformatierung unterstützt wird, aber balinesisch nicht. <code>supportedLocalesOf</code> 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 <code>"lookup"</code> Algorithmus verwendet wird — der<code>"best-fit"</code> 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.</p> + +<pre class="brush: js">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" +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-12.2.2', 'Intl.DateTimeFormat.supportedLocalesOf')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-12.2.2', 'Intl.DateTimeFormat.supportedLocalesOf')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.DateTimeFormat.supportedLocalesOf', 'Intl.DateTimeFormat.supportedLocalesOf')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.DateTimeFormat.supportedLocalesOf")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.getCanonicalLocales()</code></strong> Methode gibt ein Array mit den anerkannten Gebietsnamen zurück. Duplikate werden verhindert und Elemente werden auf valide Sprach-Tag-Struktur geprüft.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-getcanonicallocales.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox">Intl.getCanonicalLocales(locales)</pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>locales</code></dt> + <dd>Eine List von {{jsxref("String")}} Werten, von welchen die anerkannten Gebietsnamen gesucht werden.</dd> +</dl> + +<h3 id="Rückgabewert">Rückgabewert</h3> + +<p>Ein Array mit den anerkannten Gebietsnamen.</p> + +<h2 id="Beispiele">Beispiele</h2> + +<pre class="brush: js">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 +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-intl.getcanonicallocales', 'Intl.getCanonicalLocales')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td>Initiale Definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.getCanonicalLocales")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("NumberFormat.supportedLocalesOf", "Intl.NumberFormat.supportedLocalesOf()")}}</li> + <li>{{jsxref("DateTimeFormat.supportedLocalesOf", "Intl.DateTimeFormat.supportedLocalesOf()")}}</li> + <li>{{jsxref("Collator.supportedLocalesOf", "Intl.Collator.supportedLocalesOf()")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Das <strong><code>Intl</code></strong> 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 <code>Intl</code> Objektes. <span id="result_box" lang="de"><span>Diese Seite dokumentiert diese Eigenschaften sowie die Funktionalität, die in Internationalisierungskonstruktoren und anderen sprachsensitiven Funktionen gemeinsam sind.</span></span></p> + +<h2 id="Eigenschaften">Eigenschaften</h2> + +<dl> + <dt>{{jsxref("Global_Objects/Collator", "Intl.Collator")}}</dt> + <dd>Konstruktor für Collatoren, Objekte mit sprachsensitiven Stringvergleichen.</dd> + <dt>{{jsxref("Global_Objects/DateTimeFormat", "Intl.DateTimeFormat")}}</dt> + <dd>Konstruktor für Objekte, die Daten und Zeiten sprachsensitiv formatieren.</dd> + <dt>{{jsxref("Global_Objects/NumberFormat", "Intl.NumberFormat")}}</dt> + <dd>Konstruktor für Objekte, die Zahlen sprachsensitiv formatieren.</dd> + <dt>{{jsxref("Global_Objects/PluralRules", "Intl.PluralRules")}}</dt> + <dd>Konstruktor für Objekte, die mit Pluralsprachregeln pluralsensitiv formatieren kann.</dd> +</dl> + +<h2 id="Methoden">Methoden</h2> + +<dl> + <dt>{{jsxref("Intl.getCanonicalLocales()")}}</dt> + <dd>Eine Methode, die den kanonischen Gebietsnamen zurückgibt.</dd> +</dl> + +<h2 id="Gebietsidentifikation_und_-verhandlung">Gebietsidentifikation und -verhandlung</h2> + +<p>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 <code>locales</code> und <code>options</code> Parameter und verhandeln ein Gebiet aus den gesendeten Gebieten und den Lokal unterstützen Gebieten mithilfe eines Speziellen Algorithmus in der Eigenschaft <code>options.localeMatcher</code> aus.</p> + +<h3 id="locales_Argument"><code>locales</code> Argument</h3> + +<p>Das <code>locales</code> Argument muss entweder ein String sein, der einen <a href="http://tools.ietf.org/html/rfc5646">BCP 47 Sprachcode</a> enthält, oder ein Array mit solche Sprachcodes. Wenn dieses Argument nicht unterstützt ist oder <code>undefined</code> ist, wird das lokale Standardgebiet benutzt.</p> + +<p><span id="result_box" lang="de"><span>Ein BCP 47-Sprachcode definiert eine Sprache und enthält minimal einen primären Sprachcode</span></span>. <span id="result_box" lang="de"><span>In seiner gebräuchlichsten Form kann er folgender Reihenfolge enthalten: einen Sprachcode, einen Skriptcode und einen Länder- oder Regionscode, alle getrennt durch Bindestriche.</span></span> 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.</p> + +<p>Beispiele:</p> + +<ul> + <li><code>"hi"</code>: Hindi (primäre Sprache).</li> + <li><code>"de-AT"</code>: Deutsch wie es in Österreich genutzt wird (primäre Sprache mit Ländercode).</li> + <li><code>"zh-Hans-CN"</code>: Chinesisch geschrieben mit speziellen Zeichen, wie es in China genutzt wird (Primäre Sprache mit Skript- und Ländercode).</li> +</ul> + +<p>Die Subcodes zum identifizieren von Sprachen, Skripten, Ländern (Regionen) und (selten genutzen) Varianten in BCP 47 Sprachcodes können im <a href="http://www.iana.org/assignments/language-subtag-registry">IANA Sprach Subtag Register</a> gefunden werden.</p> + +<p>BCP 47 erlaubt sogar Erweiterungen. JavaScript Internationalisierungsfunktionen benutzen die <code>"u"</code> (Unicode) Erweiterung, welche es ermöglicht benutzerdefinierte Änderungen in {{jsxref("Collator")}}, {{jsxref("NumberFormat")}} oder {{jsxref("DateTimeFormat")}} einzubringen. Beispiele:</p> + +<ul> + <li><code>"de-DE-u-co-phonebk"</code>: Benutzt die Telefonbuch-Variante der deutschen Sortierreihenfolge, welche Umlaute zu Paaren übersetzt: ä → ae, ö → oe, ü → ue.</li> + <li><code>"th-TH-u-nu-thai"</code>: Benutzt Thei-Zeichen(๐, ๑, ๒, ๓, ๔, ๕, ๖, ๗, ๘, ๙) im Nummernformat.</li> + <li><code>"ja-JP-u-ca-japanese"</code>: Benutzt den Japanischen Kalender für Datums- und Zeitformate, so dass 2013 als Jahr 25 der Heisei Periode ist oder 平成25.</li> + <li><code>"en-GB-u-ca-islamic"</code>: Benutzt Britisches Englisch mit dem Islamic (Hijri) Kalender, indem das gregorianische Datum 14. Oktober 2017 das Hijri Datum 24 Muharram, 1439 ist.</li> +</ul> + +<h3 id="Gebietsauswahl">Gebietsauswahl</h3> + +<p>Das <code>locales</code> 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 <code>"lookup"</code> Auswahl, die dem im <a href="http://tools.ietf.org/html/rfc4647#section-3.4">BCP 47</a> spezifizierten Algorithmus folgt; die <code>"best fit"</code> Auswahl, bei dem die Laufzeigumgebung mindestens einen gleichgutes Ergebnis wie der Lookup Algorithmus erzielt, wenn nicht sogar einen besseren. Wenn die Applikation kein <code>locales</code> 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 <code>options</code> Argument ausgewählt werden (siehe unten).</p> + +<p>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 <code>"co"</code> Schlüssel (collation) nur in {{jsxref("Collator")}} unterstützt und der <code>"phonebk"</code> Wert ist nur im Deutschen unterstützt.</p> + +<h3 id="options_Argument"><code>options</code> Argument</h3> + +<p>Das <code>options</code> Argument muss ein Objekt mit Eigenschaften sein, welche vom Konstruktor und der Funktion abhängen. Wenn das <code>options</code> Argument nicht unterstützt wird oder <code>undefined</code> ist, werden Standardwerte für alle Eigenschaften benutzt.</p> + +<p>Eine Eigenschaft ist in allen sprachensensitiven Konstruktoren und Funktionen forhanden: Die <code>localeMatcher</code> Eigenschaft, die vom Datentyp String ist und den Wert <code>"lookup"</code> oder <code>"best fit"</code> hat, welche den Algorithmus für die Auswahl des Gebietes beschreiben (siehe oben).</p> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-8', 'Intl')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-8', 'Intl')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#intl-object', 'Intl')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td>Intl.getCanonicalLocales in the 4. Auflage hinzugefügt.</td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>Einführung: <a href="http://norbertlindenberg.com/2012/12/ecmascript-internationalization-api/index.html">The ECMAScript Internationalization API</a></li> + <li>Konstruktoren + <ul> + <li>{{jsxref("Collator", "Intl.Collator")}}</li> + <li>{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}</li> + <li>{{jsxref("NumberFormat", "Intl.NumberFormat")}}</li> + </ul> + </li> + <li>Methoden + <ul> + <li>{{jsxref("String.prototype.localeCompare()")}}</li> + <li>{{jsxref("Number.prototype.toLocaleString()")}}</li> + <li>{{jsxref("Date.prototype.toLocaleString()")}}</li> + <li>{{jsxref("Date.prototype.toLocaleDateString()")}}</li> + <li>{{jsxref("Date.prototype.toLocaleTimeString()")}}</li> + </ul> + </li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.NumberFormat.prototype.format</code></strong> Eigenschaft gibt eine Getterfunktion zurück, die eine Zahl nach den Sprach- und Formatierungsoptionen dieses {{jsxref("NumberFormat")}} Objektes formatiert.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-numberformat-prototype-format.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code><var>numberFormat</var>.format(<var>number</var>)</code></pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>number</code></dt> + <dd>Zahl, die formatiert werden soll.</dd> +</dl> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Die Funktion, die von <code>format</code> Getter zurückgegeben wird, formatiert eine Zahl in einen String nach den angegebenen Sprach- und Formatierungsoptionen des {{jsxref("NumberFormat")}} Objektes.</p> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Einsatz_von_format">Einsatz von <code>format</code></h3> + +<p>Einsatz der vom <code>format</code> Getter zurückgegebenen Funktion zum Formatieren eines Währungswertes, hier für Russland:</p> + +<pre class="brush: js">var options = { style: 'currency', currency: 'RUB' }; +var numberFormat = new Intl.NumberFormat('ru-RU', options); +console.log(numberFormat.format(654321.987)); +// → "654 321,99 руб." +</pre> + +<h3 id="Einsatz_format_mit_map">Einsatz <code>format</code> mit <code>map</code></h3> + +<p>Einsatz der vom <code>format</code> 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.</p> + +<pre class="brush: js">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" +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Komment</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-11.3.2', 'Intl.NumberFormat.prototype.format')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-11.3.2', 'Intl.NumberFormat.prototype.format')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.NumberFormat.prototype.format', 'Intl.NumberFormat.prototype.format')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.NumberFormat.format")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("NumberFormat", "Intl.NumberFormat")}}</li> + <li>{{jsxref("Number.prototype.toLocaleString()")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Das <strong><code>Intl.NumberFormat</code></strong> Objekt ist ein Konstruktor für Objekte, die sprachabhängige Zahlenformatierungen nutzen.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-numberformat.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code>new Intl.NumberFormat([<var>locales</var>[, <var>options</var>]]) +Intl.NumberFormat.call(<var>this</var>[, <var>locales</var>[, <var>options</var>]]) +</code></pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>locales</code></dt> + <dd>Optional. Ein String mit einem BCP 47 Sprachcode, oder ein Array mit solchen Strings. Für die generelle Form und Interpretation des <code>locales</code> Arguments siehe im {{jsxref("Intl", "Intl Artikel", "#Locale_identification_and_negotiation", 1)}}. Die folgenden Unicode Erweiterungsschlüssel sind erlaubt:</dd> + <dd> + <dl> + <dt><code>nu</code></dt> + <dd>Das einzusetzende Nummerierungssystem. Mögliche Wert sind:<code> "arab"</code>, <code>"arabext"</code>, <code>"bali"</code>, <code>"beng"</code>, <code>"deva"</code>, <code>"fullwide"</code>, <code>"gujr"</code>, <code>"guru"</code>, <code>"hanidec"</code>, <code>"khmr"</code>, <code>"knda"</code>, <code>"laoo"</code>, <code>"latn"</code>, <code>"limb"</code>, <code>"mlym"</code>, <code>"mong"</code>, <code>"mymr"</code>, <code>"orya"</code>, <code>"tamldec"</code>, <code>"telu"</code>, <code>"thai"</code>, <code>"tibt"</code>.</dd> + </dl> + </dd> + <dt><code>options</code></dt> + <dd> + <p>Optional. Ein Objekt mit einigen oder allen der folgenden Eigenschaften:</p> + + <dl> + <dt><code>localeMatcher</code></dt> + <dd>Der Spracherkennungsalgorithmus. Mögliche Werte sind <code>"lookup"</code> und <code>"best fit"</code>. Der Standardwert ist <code>"best fit"</code>. Für mehr Informationen siehe in den {{jsxref("Intl", "Intl Artikel", "#Locale_negotiation", 1)}}.</dd> + <dt><code>style</code></dt> + <dd>Der einzusetzende Formatierungsstil. Mögliche Werte sind <code>"decimal"</code> für einfache Zahlenformate, <code>"currency"</code> für Währungen, <code>"percent"</code> für Prozentzahlen. Der Standardwert ist <code>"decimal"</code>.</dd> + <dt><code>currency</code></dt> + <dd>Die bei der Währungsformatierung einzusetzende Währung. Mögliche Werte sind die ISO 4217 Währungscodes wie zum Beispiel <code>"USD"</code> für US Dollar, <code>"EUR"</code> für Euro und <code>"CNY"</code> für Chinesischen RMB (siehe <a href="http://www.currency-iso.org/en/home/tables/table-a1.html">Current currency & funds code list</a>). Es gibt keinen Standardwert. Wenn <code>style</code> auf <code>"currency"</code> gesetzt ist, muss die <code>currency</code> Eigenschaft gesetzt werden.</dd> + <dt><code>currencyDisplay</code></dt> + <dd>Währungsanzeige im String. Mögliche Werte sind <code>"symbol"</code> für lokalisierte Währungssymbole wie zum Beispiel €, <code>"code"</code> für ISO Währungscodes, <code>"name"</code> für den Namen der Währung wie zum Beispiel <code>"dollar"</code>. Der Standardwert ist <code>"symbol"</code>.</dd> + <dt><code>useGrouping</code></dt> + <dd>Gruppierung der Zahl. Wird für das Ein- und Ausschalten der Tausendertrenner oder thousand/lakh/crore-Trenner eingesetzt. Mögliche Werte sind <code>true</code> und <code>false</code>. Der Standardwert ist <code>true</code>.</dd> + </dl> + + <p>Die folgenden Eingeschaften fallen in zwei Gruppen: <code>minimumIntegerDigits</code>, <code>minimumFractionDigits</code>, und <code>maximumFractionDigits</code> in einer Gruppe, <code>minimumSignificantDigits</code> und <code>maximumSignificantDigits</code> in der anderen. Wenn nur eine Eigenschaft der zweiten Gruppe genutzt wird, wird die erste Gruppe ignoriert.</p> + + <dl> + <dt><code>minimumIntegerDigits</code></dt> + <dd>Die minimale Anzahl von Ganzzahl Ziffern. Mögliche Werte sind zwischen 1 und 21. Der Standardwert ist 1.</dd> + <dt><code>minimumFractionDigits</code></dt> + <dd>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 (<a href="http://www.currency-iso.org/en/home/tables/table-a1.html">ISO 4217 currency code list</a>) oder 2, wenn die Währung nicht unterstützt wird.</dd> + <dt><code>maximumFractionDigits</code></dt> + <dd>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 <code>minimumFractionDigits</code> und <code>3</code>. Der Standardwert für Währungen ist der größere von <code>minimumFractionDigits</code> 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 <code>minimumFractionDigits</code> und <code>0</code>.</dd> + <dt><code>minimumSignificantDigits</code></dt> + <dd>Die minimale Anzahl von signifikanten Stellen. Mögliche Werte sind zwischen 1 und 21. Der Standardwert ist 1.</dd> + <dt><code>maximumSignificantDigits</code></dt> + <dd>Die maximale Anzahl von signifikanten Stellen. Mögliche Werte sind zwischen 1 und 21. Der Standardwert ist <code>minimumSignificantDigits</code>.</dd> + </dl> + </dd> +</dl> + +<h2 id="Beschreibung">Beschreibung</h2> + +<h3 id="Eigenschaften">Eigenschaften</h3> + +<dl> + <dt>{{jsxref("NumberFormat.prototype", "Intl.NumberFormat.prototype")}}</dt> + <dd>Erlaubt das Hinzufügen von Eigenschaften zu allen Objekten.</dd> +</dl> + +<h3 id="Methoden">Methoden</h3> + +<dl> + <dt>{{jsxref("NumberFormat.supportedLocalesOf", "Intl.NumberFormat.supportedLocalesOf()")}}</dt> + <dd>Gibt ein Array zurück, welches alle Sprachen enthält, die unterstützt werden, ohne auf den Laufzeitstandard zurückzufallen (ohne fallback).</dd> +</dl> + +<h2 id="NumberFormat_Instanzen"><code>NumberFormat</code> Instanzen</h2> + +<h3 id="Eigenschaften_2">Eigenschaften</h3> + +<p><code>NumberFormat</code> Instanzen erben die folgenden Eigenschaften von ihrem Prototyp:</p> + +<div>{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat/prototype', 'Eigenschaften')}}</div> + +<h3 id="Methoden_2">Methoden</h3> + +<p><code>NumberFormat</code> Instanzen erben die folgenden Methoden von ihrem Prototyp:</p> + +<div>{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat/prototype', 'Methoden')}}</div> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Standardeinsatz">Standardeinsatz</h3> + +<p>Beim Einsatz ohne spezifizierte Sprache wird ein formatierter String in der Standardsprache und mit Standardoptionen zurückgegeben:</p> + +<pre class="brush: js">var number = 3500; + +console.log(new Intl.NumberFormat().format(number)); +// → '3.500' wenn in Deutscher Sprache +</pre> + +<h3 id="Einsatz_von_locales">Einsatz von <code>locales</code></h3> + +<p>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 <code>locales</code> Argument.</p> + +<pre class="brush: js">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 <strong>zwei Stellen</strong> +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 +</pre> + +<h3 id="Einsatz_von_options">Einsatz von <code>options</code></h3> + +<p>Das Ergebnis von <code>toLocaleString</code> kann durch das <code>options</code> Argument angepasst werden.</p> + +<pre class="brush: js">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 +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-11.1', 'Intl.NumberFormat')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-11.1', 'Intl.NumberFormat')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#numberformat-objects', 'Intl.NumberFormat')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.NumberFormat")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<p>{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/Intl', 'Siehe auch')}}</p> 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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.NumberFormat.prototype</code></strong> Eigenschaft repräsentiert das Prototypobjekt für einen {{jsxref("NumberFormat", "Intl.NumberFormat")}} Konstruktor.</p> + +<div>{{js_property_attributes(0, 0, 0)}}</div> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Siehe {{jsxref("NumberFormat")}} für eine Beschreibung von <code>Intl.NumberFormat</code> Instanzen.</p> + +<p>{{jsxref("NumberFormat", "Intl.NumberFormat")}} Instanzen erben von <code>Intl.NumberFormat.prototype</code>. Veränderungen am Prototypobjekt werden an alle {{jsxref("NumberFormat", "Intl.NumberFormat")}} Instanzen vererbt.</p> + +<h2 id="Eigenschaften">Eigenschaften</h2> + +<dl> + <dt><code>Intl.NumberFormat.prototype.constructor</code></dt> + <dd>Eine Referenz zu <code>Intl.NumberFormat</code>.</dd> + <dt>{{jsxref("NumberFormat.format", "Intl.NumberFormat.prototype.format")}}</dt> + <dd>Getter; gibt eine Funktion zurück, die eine Zahl nach den Sprach- und Formatierungsoptionen dieses {{jsxref("NumberFormat")}} Objektes formatiert.</dd> +</dl> + +<h2 id="Methoden">Methoden</h2> + +<dl> + <dt>{{jsxref("NumberFormat.formatToParts", "Intl.NumberFormat.prototype.formatToParts()")}}</dt> + <dd>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.</dd> + <dt>{{jsxref("NumberFormat.resolvedOptions", "Intl.NumberFormat.prototype.resolvedOptions()")}}</dt> + <dd>Gibt ein neues Objekt mit eigenschaften zurück, die Sprach- und Formatierungsoptionen enthält, die bei der Initialisierung des Objektes errechnet wurden.</dd> +</dl> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Komment</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-11.2.1', 'Intl.NumberFormat.prototype')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-11.2.1', 'Intl.NumberFormat.prototype')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.NumberFormat.prototype', 'Intl.NumberFormat.prototype')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.NumberFormat.prototype")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("NumberFormat", "Intl.NumberFormat")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.NumberFormat.supportedLocalesOf()</code></strong> 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.</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-numberformat-prototype-supportedlocalesof.html")}}</div> + + + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code>Intl.NumberFormat.supportedLocalesOf(<var>locales</var>[, <var>options</var>])</code></pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>locales</code></dt> + <dd>Ein String mit einem BCP 47 Sprachtag, oder ein Array von solchen Strings. Für die generelle Form des <code>locales</code> Arguments siehe die {{jsxref("Intl", "Intl Seite", "#Gebietsidentifikation_und_-verhandlung", 1)}}.</dd> + <dt><code>options</code></dt> + <dd> + <p>Optional. Ein Objekt, welches die folgende Eigenschaft haben kann:</p> + + <dl> + <dt><code>localeMatcher</code></dt> + <dd>Der Auswahlalgorithmus des Gebietes. Mögliche Werte sind <code>"lookup"</code> und <code>"best fit"</code>; der Standard ist <code>"best fit"</code>. Für mehr Information über diese Option siehe auf der {{jsxref("Intl", "Intl Seite", "#Gebietsauswahl", 1)}}.</dd> + </dl> + </dd> +</dl> + +<h3 id="Rückgabewert">Rückgabewert</h3> + +<p>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.</p> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Gibt ein Array zurück, welches eine Untermenge der gegebenen Gebiete (<code>locales</code>) 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.</p> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Einsatz_von_supportedLocalesOf">Einsatz von <code>supportedLocalesOf</code></h3> + +<p>Angenommen wird, dass indonesische und deutsche Zahlenformatierung unterstützt wird, aber balinesisch nicht. <code>supportedLocalesOf</code> 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 <code>"lookup"</code> Algorithmus verwendet wird — der<code>"best-fit"</code> 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.</p> + +<pre class="brush: js">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" +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ES Int 1.0', '#sec-11.2.2', 'Intl.NumberFormat.supportedLocalesOf')}}</td> + <td>{{Spec2('ES Int 1.0')}}</td> + <td>Initiale Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES Int 2.0', '#sec-11.2.2', 'Intl.NumberFormat.supportedLocalesOf')}}</td> + <td>{{Spec2('ES Int 2.0')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('ES Int Draft', '#sec-Intl.NumberFormat.supportedLocalesOf', 'Intl.NumberFormat.supportedLocalesOf')}}</td> + <td>{{Spec2('ES Int Draft')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.NumberFormat.supportedLocalesOf")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("NumberFormat", "Intl.NumberFormat")}}</li> +</ul> 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 +--- +<div>{{JSRef}}</div> + +<p>The <strong><code>Intl.PluralRules</code></strong> object is a constructor for objects that enable plural sensitive formatting and plural language language rules.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code>new Intl.PluralRules([<var>locales</var>[, <var>options</var>]]) +Intl.PluralRules.call(<var>this</var>[, <var>locales</var>[, <var>options</var>]]) +</code></pre> + +<h3 id="Parameters">Parameters</h3> + +<dl> + <dt><code>locales</code></dt> + <dd> + <p>Optional. A string with a BCP 47 language tag, or an array of such strings. For the general form and interpretation of the <code>locales</code> argument, see the {{jsxref("Intl", "Intl page", "#Locale_identification_and_negotiation", 1)}}.</p> + </dd> + <dt><code>options</code></dt> + <dd> + <p>Optional. An object with some or all of the following properties:</p> + + <dl> + <dt><code>localeMatcher</code></dt> + <dd>The locale matching algorithm to use. Possible values are <code>"lookup"</code> and <code>"best fit"</code>; the default is <code>"best fit"</code>. For information about this option, see the {{jsxref("Global_Objects/Intl", "Intl page", "#Locale_negotiation", 1)}}.</dd> + <dt><code>type</code></dt> + <dd>The type to use. Possible values are: + <ul> + <li><code>"cardinal"</code> for cardinal numbers (refering to the quantity of things). This is the default value.</li> + <li><code>"ordinal"</code> for ordinal number (refering to the ordering or ranking of things, e.g. "1st", "2nd", "3rd" in English).</li> + </ul> + </dd> + </dl> + </dd> +</dl> + +<h2 id="Description">Description</h2> + +<h3 id="Properties">Properties</h3> + +<dl> + <dt>{{jsxref("PluralRules.prototype", "Intl.PluralRules.prototype")}}</dt> + <dd>Allows the addition of properties to all objects.</dd> +</dl> + +<h3 id="Methods">Methods</h3> + +<dl> + <dt>{{jsxref("PluralRules.supportedLocalesOf", "Intl.PluralRules.supportedLocalesOf()")}}</dt> + <dd>Returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale.</dd> +</dl> + +<h2 id="PluralRules_instances"><code>PluralRules</code> instances</h2> + +<h3 id="Properties_2">Properties</h3> + +<p><code>PluralRules</code> instances inherit the following properties from their prototype:</p> + +<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules/prototype', 'Properties')}}</div> + +<h3 id="Methods_2">Methods</h3> + +<p><code>PluralRules</code> instances inherit the following methods from their prototype:</p> + +<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules/prototype', 'Methods')}}</div> + +<h2 id="Examples">Examples</h2> + +<h3 id="Basic_usage">Basic usage</h3> + +<p>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".</p> + +<pre class="brush: js">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 +</pre> + +<h3 id="Using_locales">Using <code>locales</code></h3> + +<p>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 <code>locales</code> argument:</p> + +<pre class="brush: js">// 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' +</pre> + +<h3 id="Using_options">Using <code>options</code></h3> + +<p>The results can be customized using the <code>options</code> argument, which has one property called <code>type</code> which you can set to <code>ordinal</code>. This is useful to figure out the ordinal indicator, e.g. "1st", "2nd", "3rd", "4th", "42nd" and so forth.</p> + +<pre class="brush: js">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' +</pre> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td><a href="https://rawgit.com/caridy/intl-plural-rules-spec/master/index.html">Intl Plural Rules Draft</a></td> + <td>{{Spec2('ES Int Draft')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.PluralRules")}}</p> +</div> + +<h2 id="See_also">See also</h2> + +<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl', 'See_also')}}</div> 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 +--- +<div>{{JSRef}}</div> + +<p>Die <strong><code>Intl.PluralRules.supportedLocalesOf()</code></strong> 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.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><code>Intl.PluralRules.supportedLocalesOf(<var>locales</var>[, <var>options</var>])</code></pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>locales</code></dt> + <dd>Ein String mit einem BCP 47 Sprachtag, oder ein Array von solchen Strings. Für die generelle Form des <code>locales</code> Arguments siehe die {{jsxref("Intl", "Intl Seite", "#Gebietsidentifikation_und_-verhandlung", 1)}}.</dd> + <dt><code>options</code></dt> + <dd> + <p>Optional. Ein Objekt, welches die folgende Eigenschaft haben kann:</p> + + <dl> + <dt><code>localeMatcher</code></dt> + <dd>Der Auswahlalgorithmus des Gebietes. Mögliche Werte sind <code>"lookup"</code> und <code>"best fit"</code>; der Standard ist <code>"best fit"</code>. Für mehr Information über diese Option siehe auf der {{jsxref("Intl", "Intl Seite", "#Gebietsauswahl", 1)}}.</dd> + </dl> + </dd> +</dl> + +<h3 id="Rückgabewert">Rückgabewert</h3> + +<p>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.</p> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p>Gibt ein Array zurück, welches eine Untermenge der gegebenen Gebiete (<code>locales</code>) 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.</p> + +<h2 id="Beispiele">Beispiele</h2> + +<h3 id="Einsatz_von_supportedLocalesOf">Einsatz von <code>supportedLocalesOf</code></h3> + +<p>Angenommen wird, dass indonesische und deutsche Pluralformatierung unterstützt wird, aber balinesisch nicht. <code>supportedLocalesOf</code> 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 <code>"lookup"</code> Algorithmus verwendet wird — der<code>"best-fit"</code> 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.</p> + +<pre class="brush: js">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" +</pre> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spezifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td><a href="https://rawgit.com/caridy/intl-plural-rules-spec/master/index.html">Intl Plural Rules Draft</a></td> + <td>{{Spec2('ES Int Draft')}}</td> + <td>Initiale Definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browserkompatibilität">Browserkompatibilität</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Intl.PluralRules.supportedLocalesOf")}}</p> +</div> + +<h2 id="Siehe_auch">Siehe auch</h2> + +<ul> + <li>{{jsxref("PluralRules", "Intl.PluralRules")}}</li> +</ul> |
