aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/javascript/reference/global_objects/intl/pluralrules
diff options
context:
space:
mode:
Diffstat (limited to 'files/de/web/javascript/reference/global_objects/intl/pluralrules')
-rw-r--r--files/de/web/javascript/reference/global_objects/intl/pluralrules/index.html161
-rw-r--r--files/de/web/javascript/reference/global_objects/intl/pluralrules/supportedlocalesof/index.html85
2 files changed, 246 insertions, 0 deletions
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>