From 03083cdda356dda229ee7eabc5c6826eb1557487 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Tue, 20 Apr 2021 21:46:27 +0900 Subject: Intl.Collator を更新 (#455) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2021/03/29 時点の英語版に同期 --- .../global_objects/intl/collator/index.html | 77 +++++++++++----------- 1 file changed, 37 insertions(+), 40 deletions(-) (limited to 'files/ja/web/javascript/reference') diff --git a/files/ja/web/javascript/reference/global_objects/intl/collator/index.html b/files/ja/web/javascript/reference/global_objects/intl/collator/index.html index 24a3e83d2b..e926a56ba5 100644 --- a/files/ja/web/javascript/reference/global_objects/intl/collator/index.html +++ b/files/ja/web/javascript/reference/global_objects/intl/collator/index.html @@ -7,6 +7,8 @@ tags: - Internationalization - Intl - JavaScript + - Localization + - Reference translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Collator ---
{{JSRef}}
@@ -14,35 +16,34 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Collator

Intl.Collator オブジェクトは、言語を考慮した文字列の比較を可能にします。

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

コンストラクター

+

コンストラクター

-
{{jsxref("Intl/Collator/Collator", "Intl.Collator()")}}
-
新しい Collator オブジェクトを生成します。
+
{{jsxref("Intl/Collator/Collator", "Intl.Collator()")}}
+
新しい Collator オブジェクトを生成します。
-

静的メソッド

+

静的メソッド

-
{{jsxref("Collator.supportedLocalesOf", "Intl.Collator.supportedLocalesOf()")}}
-
指定したロケールのうち、ランタイムの既定のロケールに代替されることなく対応されているものを含む配列を返します。
+
{{jsxref("Intl/Collator/supportedLocalesOf", "Intl.Collator.supportedLocalesOf()")}}
+
指定したロケールのうち、ランタイムの既定のロケールに代替されることなく対応されているものを含む配列を返します。
-

インスタンスメソッド

+

インスタンスメソッド

-
{{jsxref("Collator.compare", "Intl.Collator.prototype.compare")}}
-
この {{jsxref("Global_Objects/Collator", "Intl.Collator")}} オブジェクトのソート順に応じて2つの文字列を比較する関数を返します。
-
{{jsxref("Collator.resolvedOptions", "Intl.Collator.prototype.resolvedOptions()")}}
-
ローケルを反映しているプロパティとオブジェクトの初期化中に計算された照合オプションをもった新しいオブジェクトを返します。
+
{{jsxref("Intl/Collator/compare", "Intl.Collator.prototype.compare")}}
+
この {{jsxref("Global_Objects/Intl/Collator", "Intl.Collator")}} オブジェクトのソート順に応じて 2 つの文字列を比較する関数を返します。
+
{{jsxref("Intl/Collator/resolvedOptions", "Intl.Collator.prototype.resolvedOptions()")}}
+
ローケルを反映しているプロパティとオブジェクトの初期化中に計算された照合オプションをもった新しいオブジェクトを返します。
-

+

-

Collator の使用

+

Collator の使用

次の例では、一方の文字列が他方の文字列の前である場合、後である場合、および同じレベルである場合の比較結果を表示します。

@@ -53,11 +54,11 @@ console.log(new Intl.Collator().compare('a', 'a')); // → 0

上記コードの結果は、ブラウザーやブラウザーのバージョンによって異なる可能性がある点に注意してください。というのも前および後を表す数値については、それぞれ負の数および正の数であることだけが仕様によって定めています。具体的な数値は定められていないため、実装ごとに異なる数値になるかもしれません。

-

locales の使用

+

locales の使用

-

{{jsxref("Collator.prototype.compare()")}} の結果は言語によって異なります。アプリケーションのユーザインターフェイスで使用される言語のソート順を取得するには、 locales 引数にその言語 (およびフォールバック用の言語も) を指定してください。

+

{{jsxref("Intl/Collator/compare")}} の結果は言語によって異なります。アプリケーションのユーザーインターフェイスで使用される言語のソート順を取得するには、 locales 引数にその言語を (およびフォールバック用の言語も) 指定してください。

-
// in German, ä sorts with a
+
// in German, ä sorts with a
 console.log(new Intl.Collator('de').compare('ä', 'z'));
 // → 負の値
 
@@ -66,11 +67,11 @@ console.log(new Intl.Collator('sv').compare('ä', 'z'));
 // → 正の値
 
-

options の使用

+

options の使用

-

T{{jsxref("Collator.prototype.compare()")}} の結果は options 引数でカスタマイズできます。

+

T{{jsxref("Intl/Collator/compare")}} の結果は options 引数でカスタマイズできます。

-
// in German, ä has a as the base letter
+
// in German, ä has a as the base letter
 console.log(new Intl.Collator('de', { sensitivity: 'base' }).compare('ä', 'a'));
 // → 0
 
@@ -79,31 +80,27 @@ console.log(new Intl.Collator('sv', { sensitivity: 'base' }).compare('ä', 'a'))
 // → 正の値
 
-

仕様書

+

仕様書

- - - - - - - - - - + + + + + + + + + +
仕様書
{{SpecName('ES Int Draft', '#collator-objects', 'Intl.Collator')}}
仕様書
{{SpecName('ES Int Draft', '#collator-objects', 'Intl.Collator')}}
-

ブラウザーの互換性

- -
- +

ブラウザーの互換性

-

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

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

関連情報

+

関連情報

    -
  • Intl
  • +
  • {{jsxref("Intl")}}
-- cgit v1.2.3-54-g00ecf