JavaScript

Intl.PluralRules.prototype.select() メソッド


編集:2023.01.11 by T.A.

[Edge]。→

Intl.PluralRules を考慮した複数形の書式化をして文字列で返します。

構文
Intl.PluralRules.select(number)
Intl.PluralRules Intl.PluralRules
number 複数のルールを取得するための数値。
戻り値

文字列。→

DA=new Intl.PluralRules('ja');  //日本語。
D=DA.select(0);  //=[string]:other
D=DA.select(1);  //=[string]:other
DA=new Intl.PluralRules('en');  //英語。
D=DA.select(0);  //=[string]:other
D=DA.select(1);  //=[string]:one
D=DA.select(2);  //=[string]:other
DA=new Intl.PluralRules('ar');  //アラビア語。
D=DA.select(0);  //=[string]:zero
D=DA.select(1);  //=[string]:one
D=DA.select(2);  //=[string]:two
D=DA.select(3);  //=[string]:few
D=DA.select(15);  //=[string]:many
D=DA.select(100);  //=[string]:other
DA=new Intl.PluralRules('fr');  //フランス語。
D=DA.select(0);  //=[string]:one
D=DA.select(1);  //=[string]:one
D=DA.select(2);  //=[string]:other

PluralRules()


テスト