diff options
Diffstat (limited to 'files/ja/web/javascript/reference/global_objects/intl/locale/maximize')
| -rw-r--r-- | files/ja/web/javascript/reference/global_objects/intl/locale/maximize/index.html | 77 | ||||
| -rw-r--r-- | files/ja/web/javascript/reference/global_objects/intl/locale/maximize/index.md | 68 |
2 files changed, 68 insertions, 77 deletions
diff --git a/files/ja/web/javascript/reference/global_objects/intl/locale/maximize/index.html b/files/ja/web/javascript/reference/global_objects/intl/locale/maximize/index.html deleted file mode 100644 index 1d7cad466a..0000000000 --- a/files/ja/web/javascript/reference/global_objects/intl/locale/maximize/index.html +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: Intl.Locale.prototype.maximize() -slug: Web/JavaScript/Reference/Global_Objects/Intl/Locale/maximize -tags: - - Internationaliztion - - Intl - - JavaScript - - Method - - Prototype - - Reference - - メソッド - - 国際化 -translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Locale/maximize ---- -<div>{{JSRef}}</div> - -<p><span class="seoSummary"><strong><code>Intl.Locale.prototype.maximize()</code></strong> メソッドは、既存の値に基づいてロケールの言語、表記法、地域の最も可能性の近い値を取得します。</span></p> - -<div>{{EmbedInteractiveExample("pages/js/intl-locale-prototype-maximize.html")}}</div> - -<div class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力していただける場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</div> - -<h2 id="Syntax" name="Syntax">構文</h2> - -<pre class="syntaxbox"><code><em>locale</em>.maximize()</code></pre> - -<h3 id="Return_value" name="Return_value">返値</h3> - -<p>{{jsxref("Locale", "Locale")}} インスタンスで、 <code>baseName</code> プロパティが、 <a href="https://www.unicode.org/reports/tr35/#Likely_Subtags">Add Likely Subtags</a> アルゴリズムが <em>{{jsxref("Locale/baseName", "locale.baseName")}}</em> に対して実行された結果になったものを返します。</p> - -<h2 id="Description" name="Description">解説</h2> - -<p>不完全な言語識別子をもとに、最も可能性の高いロケール言語識別子サブタグを識別できると便利な場合があります。 Add Likely Subtags アルゴリズムはこの機能を提供してくれます。例えば、言語識別子 "en" が与えられた場合、アルゴリズムは "en-Latn-US" を返すことになります。英語はラテン文字でしか書けませんし、世界最大の英語圏の国であるアメリカで使われている可能性が高いからです。この機能は、 <code>maximize()</code> メソッドを介して JavaScript プログラマーに提供されています。 <code>maximize()</code> は、<a href="https://www.unicode.org/reports/tr35/#Language_Locale_Field_Definitions" rel="noopener">言語識別子</a>を構成する主要なサブタグのうち言語サブ、表記法、地域の各サブタグにのみ影響を与えます。ロケール識別子の "-u" の後にあるその他のサブタグは拡張サブタグと呼ばれ、 <code>maximize()</code> メソッドの影響を受けません。これらのサブタグの例としては、 {{jsxref("Locale/hourCycle", "Locale.hourCycle")}}, {{jsxref("Locale/calendar", "Locale.calendar")}}, {{jsxref("Locale/numeric", "Locale.numeric")}} などがあります。</p> - -<h2 id="Examples" name="Examples">例</h2> - -<pre class="brush: js">let myLocale = new Intl.Locale("ja", {hourCycle: "h24", calendar: "gregory"}); -console.log(myLocale.baseName); // "ja" と表示 -console.log(myLocale.toString()); // "ja-u-ca-gregory-hc-h24" と表示 -let myLocMaximized = myLocale.maximize(); - -// "ja-Jpan-JP"。 "Jpan" と "JP" タグが追加されます。 -// これは、日本語が主に漢字かな交じり文 (Jpan) で書かれ、また主に日本 (JP) で話されているためです。 -console.log(myLocMaximized.baseName); - -// "ja-Jpan-JP-u-ca-gregory-hc-h24" と表示します。 -// なお、拡張タグ ("-u" 以降) はそのまま残ります。 -console.log(myLocMaximized.toString()); </pre> - -<h2 id="Specifications" name="Specifications">仕様書</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">仕様書</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('ES Int Draft', '#sec-Intl.Locale.prototype.maximize')}}</td> - </tr> - </tbody> -</table> - -<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> - -<div> -<p>{{Compat("javascript.builtins.Intl.Locale.maximize")}}</p> -</div> - -<h2 id="See_also" name="See_also">関連情報</h2> - -<ul> - <li>{{jsxref("Locale", "Intl.Locale")}}</li> - <li>{{jsxref("Locale/baseName", "Locale.baseName")}}</li> - <li><a href="https://www.unicode.org/reports/tr35/#Likely_Subtags">Unicode's Likely Subtags spec</a></li> -</ul> diff --git a/files/ja/web/javascript/reference/global_objects/intl/locale/maximize/index.md b/files/ja/web/javascript/reference/global_objects/intl/locale/maximize/index.md new file mode 100644 index 0000000000..aae9be3eca --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/intl/locale/maximize/index.md @@ -0,0 +1,68 @@ +--- +title: Intl.Locale.prototype.maximize() +slug: Web/JavaScript/Reference/Global_Objects/Intl/Locale/maximize +tags: + - 国際化 + - Intl + - JavaScript + - Locale + - メソッド + - Prototype + - Reference +browser-compat: javascript.builtins.Intl.Locale.maximize +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Locale/maximize +--- +{{JSRef}} + +**`Intl.Locale.prototype.maximize()`** メソッドは、既存の値に基づいてロケールの言語、表記法、地域の最も可能性の近い値を取得します。 + +{{EmbedInteractiveExample("pages/js/intl-locale-prototype-maximize.html")}} + + +## 構文 + +```js +maximize() +``` + +### 返値 + +{{jsxref("Intl/Locale", "Locale")}} インスタンスのうち、 `baseName` プロパティが [Add Likely Subtags](https://www.unicode.org/reports/tr35/#Likely_Subtags) アルゴリズムを _{{jsxref("Intl/Locale/baseName", "locale.baseName")}}_.に対して実行した結果になっているものを返します。 + +## 解説 + +不完全な言語識別子をもとに、最も可能性の高いロケール言語識別子サブタグを識別できると便利な場合があります。 Add Likely Subtags アルゴリズムはこの機能を提供してくれます。例えば、言語識別子 "en" が与えられた場合、アルゴリズムは "en-Latn-US" を返すことになります。英語はラテン文字でしか書けませんし、世界最大の英語圏の国であるアメリカで使われている可能性が高いからです。この機能は、 `maximize()` メソッドを介して JavaScript プログラマーに提供されています。 `maximize()` は、[言語識別子](https://www.unicode.org/reports/tr35/#Language_Locale_Field_Definitions)を構成する主要なサブタグのうち言語サブ、表記法、地域の各サブタグにのみ影響を与えます。ロケール識別子の "-u" の後にあるその他のサブタグは拡張サブタグと呼ばれ、 `maximize()` メソッドの影響を受けません。これらのサブタグの例としては、{{jsxref("Intl/Locale/hourCycle", "Locale.hourCycle")}}、{{jsxref("Intl/Locale/calendar", "Locale.calendar")}}、{{jsxref("Intl/Locale/numeric", "Locale.numeric")}} などがあります。</p> + +## 例 + +### maximize の使用 + +```js +let myLocale = new Intl.Locale("ja", {hourCycle: "h24", calendar: "gregory"}); +console.log(myLocale.baseName); // "ja" と表示 +console.log(myLocale.toString()); // "ja-u-ca-gregory-hc-h24" と表示 +let myLocMaximized = myLocale.maximize(); + +// "ja-Jpan-JP"。 "Jpan" と "JP" タグが追加されます。 +// これは、日本語が主に漢字かな交じり文 (Jpan) で書かれ、また主に日本 (JP) で話されているためです。 +console.log(myLocMaximized.baseName); + +// "ja-Jpan-JP-u-ca-gregory-hc-h24" と表示します。 +// なお、拡張タグ ("-u" 以降) はそのまま残ります。 +console.log(myLocMaximized.toString()); +``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- {{jsxref("Intl.Locale")}} +- {{jsxref("Intl/Locale/baseName", "Intl.Locale.baseName")}} +- [Unicode's Likely + Subtags spec](https://www.unicode.org/reports/tr35/#Likely_Subtags) |
