语法高亮,滚动条美化,设置页面调整

This commit is contained in:
fofolee
2019-04-19 02:41:09 +08:00
parent 1e8f76c000
commit 359d29ee0b
1590 changed files with 12328 additions and 11441 deletions

View File

@@ -4,8 +4,8 @@
<div><iframe class="interactive interactive-js" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/intl-collator.html" width="100%"></iframe></div>
<p class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a class="external" href="https://github.com/mdn/interactive-examples" rel="noopener">https://github.com/mdn/interactive-examples</a> and send us a pull request.</p>
<h2 id="语法">语法</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>
<pre><code class="language-javascript"><code>new Intl.Collator([<var>locales</var>[, <var>options</var>]])
Intl.Collator.call(<var>this</var>[, <var>locales</var>[, <var>options</var>]])</code></code></pre>
<h3 id="参数">参数</h3>
<dl>
<dt><code>locales</code></dt>
@@ -80,31 +80,31 @@ Intl.Collator.call(<var>this</var>[, <var>locales</var>[, <var>options</var>]])<
<h2 id="例子">例子</h2>
<h3 id="基本用法">基本用法</h3>
<p>以下示例演示在另一个之前,之后或同级别发生的字符串的不同潜在结果:</p>
<pre class="brush: js">console.log(new Intl.Collator().compare('a', 'c')); // → a negative value
<pre><code class="language-javascript">console.log(new Intl.Collator().compare('a', 'c')); // → a negative value
console.log(new Intl.Collator().compare('c', 'a')); // → a positive value
console.log(new Intl.Collator().compare('a', 'a')); // → 0
</pre>
</code></pre>
<p>请注意,上述代码中显示的结果可能会因浏览器和浏览器版本而异。 这是因为值是实现特定的。 也就是说,规范仅需要前后值为负和正。</p>
<h3 id="使用_locales">使用 <code>locales</code></h3>
<p><a class="new" href="Reference/Global_Objects/Collator/compare" rel="nofollow" title="此页面仍未被本地化, 期待您的翻译!"><code>Collator.prototype.compare()</code></a> 提供的结果在不同语言之间有所不同。为了获得用于您的应用程序的用户界面的语言格式,请确保设定了语言(可能还有一些回退语言)参数:</p>
<pre class="brush: js">// 德语中, ä 使用 a 的排序
<pre><code class="language-javascript">// 德语中, ä 使用 a 的排序
console.log(new Intl.Collator('de').compare('ä', 'z'));
// → 一个负值
// 瑞典语中, ä 在 z 的后面
console.log(new Intl.Collator('sv').compare('ä', 'z'));
// → 一个正值
</pre>
</code></pre>
<h3 id="使用_options">使用 <code>options</code></h3>
<p><a class="new" href="Reference/Global_Objects/Collator/compare" rel="nofollow" title="此页面仍未被本地化, 期待您的翻译!"><code>Collator.prototype.compare()</code></a> 提供的结果可以使用 options 参数自定义:</p>
<pre class="brush: js">// 德语中, ä 使用 a 作为基本字母
<pre><code class="language-javascript">// 德语中, ä 使用 a 作为基本字母
console.log(new Intl.Collator('de', { sensitivity: 'base' }).compare('ä', 'a'));
// → 0
// 瑞典语中, ä 和 a 是单独的基本字母
console.log(new Intl.Collator('sv', { sensitivity: 'base' }).compare('ä', 'a'));
// → 一个正值
</pre>
</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>