mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
2 lines
9.1 KiB
JavaScript
2 lines
9.1 KiB
JavaScript
/*! For license information please see 4689.b8a23e02.js.LICENSE.txt */
|
|
(self.webpackChunk=self.webpackChunk||[]).push([["4689"],{41025:function(n,t,d){"use strict";d.r(t);var s=d("80681");let a=["innerHTML"];t.default={setup:()=>({html:""}),render:()=>((0,s.wg)(),(0,s.iD)("div",{class:"van-doc-markdown-body",innerHTML:'<h1>\u56FD\u9645\u5316</h1>\n<div class="van-doc-card"><h3 id="jie-shao" tabindex="-1">\u4ECB\u7ECD</h3>\n<p>Vant \u91C7\u7528\u4E2D\u6587\u4F5C\u4E3A\u9ED8\u8BA4\u8BED\u8A00\uFF0C\u540C\u65F6\u652F\u6301\u591A\u8BED\u8A00\u5207\u6362\uFF0C\u8BF7\u6309\u7167\u4E0B\u65B9\u6559\u7A0B\u8FDB\u884C\u56FD\u9645\u5316\u8BBE\u7F6E\u3002</p>\n</div><h2 id="shi-yong-fang-fa" tabindex="-1">\u4F7F\u7528\u65B9\u6CD5</h2>\n<div class="van-doc-card"><h3 id="duo-yu-yan-qie-huan" tabindex="-1">\u591A\u8BED\u8A00\u5207\u6362</h3>\n<p>Vant \u901A\u8FC7 Locale \u7EC4\u4EF6\u5B9E\u73B0\u591A\u8BED\u8A00\u652F\u6301\uFF0C\u4F7F\u7528 <code>Locale.use</code> \u65B9\u6CD5\u53EF\u4EE5\u5207\u6362\u5F53\u524D\u4F7F\u7528\u7684\u8BED\u8A00\u3002</p>\n<pre><code class="language-js"><span class="hljs-keyword">import</span> { <span class="hljs-title class_">Locale</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</span>;\n<span class="hljs-comment">// \u5F15\u5165\u82F1\u6587\u8BED\u8A00\u5305</span>\n<span class="hljs-keyword">import</span> enUS <span class="hljs-keyword">from</span> <span class="hljs-string">'vant/es/locale/lang/en-US'</span>;\n\n<span class="hljs-title class_">Locale</span>.<span class="hljs-title function_">use</span>(<span class="hljs-string">'en-US'</span>, enUS);\n</code></pre>\n</div><div class="van-doc-card"><h3 id="fu-gai-yu-yan-bao" tabindex="-1">\u8986\u76D6\u8BED\u8A00\u5305</h3>\n<p>\u901A\u8FC7 <code>Locale.add</code> \u65B9\u6CD5\u53EF\u4EE5\u5B9E\u73B0\u6587\u6848\u7684\u4FEE\u6539\u548C\u6269\u5C55\uFF0C\u793A\u4F8B\u5982\u4E0B\uFF1A</p>\n<pre><code class="language-js"><span class="hljs-keyword">import</span> { <span class="hljs-title class_">Locale</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</span>;\n\n<span class="hljs-keyword">const</span> messages = {\n <span class="hljs-string">'zh-CN'</span>: {\n <span class="hljs-attr">vanPicker</span>: {\n <span class="hljs-attr">confirm</span>: <span class="hljs-string">'\u5173\u95ED'</span>, <span class="hljs-comment">// \u5C06'\u786E\u8BA4'\u4FEE\u6539\u4E3A'\u5173\u95ED'</span>\n },\n },\n};\n\n<span class="hljs-title class_">Locale</span>.<span class="hljs-title function_">add</span>(messages);\n</code></pre>\n</div><div class="van-doc-card"><h3 id="yu-yan-bao" tabindex="-1">\u8BED\u8A00\u5305</h3>\n<p>\u76EE\u524D\u652F\u6301\u7684\u8BED\u8A00:</p>\n<table>\n<thead>\n<tr>\n<th>\u8BED\u8A00</th>\n<th>\u6587\u4EF6\u540D</th>\n<th>\u7248\u672C</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>\u963F\u62C9\u4F2F\u8BED</td>\n<td>ar-SA</td>\n<td><code>v3.5.0</code></td>\n</tr>\n<tr>\n<td>\u4FDD\u52A0\u5229\u4E9A\u8BED</td>\n<td>bg-BG</td>\n<td><code>v3.5.0</code></td>\n</tr>\n<tr>\n<td>\u5B5F\u52A0\u62C9\u8BED\uFF08\u5B5F\u52A0\u62C9\u56FD\uFF09</td>\n<td>bn-BD</td>\n<td><code>v3.4.5</code></td>\n</tr>\n<tr>\n<td>\u4E39\u9EA6\u8BED</td>\n<td>da-DK</td>\n<td><code>v3.4.8</code></td>\n</tr>\n<tr>\n<td>\u5FB7\u8BED</td>\n<td>de-DE</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u5FB7\u8BED\uFF08\u6B63\u5F0F\uFF09</td>\n<td>de-DE-formal</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u5E0C\u814A\u8BED</td>\n<td>el-GR</td>\n<td><code>v3.5.0</code></td>\n</tr>\n<tr>\n<td>\u82F1\u8BED</td>\n<td>en-US</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u4E16\u754C\u8BED</td>\n<td>eo-EO</td>\n<td><code>v4.0.9</code></td>\n</tr>\n<tr>\n<td>\u897F\u73ED\u7259\u8BED</td>\n<td>es-ES</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u6CE2\u65AF\u8BED</td>\n<td>fa-IR</td>\n<td><code>v3.5.0</code></td>\n</tr>\n<tr>\n<td>\u6CD5\u8BED</td>\n<td>fr-FR</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u5E0C\u4F2F\u6765\u8BED</td>\n<td>he-IL</td>\n<td><code>v3.5.0</code></td>\n</tr>\n<tr>\n<td>\u5370\u5730\u8BED</td>\n<td>hi-IN</td>\n<td><code>v3.4.3</code></td>\n</tr>\n<tr>\n<td>\u5370\u5EA6\u5C3C\u897F\u4E9A\u8BED</td>\n<td>id-ID</td>\n<td><code>v3.4.5</code></td>\n</tr>\n<tr>\n<td>\u51B0\u5C9B\u8BED</td>\n<td>is-IS</td>\n<td><code>v3.4.7</code></td>\n</tr>\n<tr>\n<td>\u610F\u5927\u5229\u8BED</td>\n<td>it-IT</td>\n<td><code>v3.4.5</code></td>\n</tr>\n<tr>\n<td>\u65E5\u8BED</td>\n<td>ja-JP</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u9AD8\u68C9\u8BED</td>\n<td>km-KH</td>\n<td><code>v4.1.2</code></td>\n</tr>\n<tr>\n<td>\u97E9\u8BED/\u671D\u9C9C\u8BED</td>\n<td>ko-KR</td>\n<td><code>v3.4.3</code></td>\n</tr>\n<tr>\n<td>\u8001\u631D\u8BED</td>\n<td>la-LA</td>\n<td><code>v3.4.7</code></td>\n</tr>\n<tr>\n<td>\u8499\u53E4\u8BED</td>\n<td>mm-MN</td>\n<td><code>v4.0.5</code></td>\n</tr>\n<tr>\n<td>\u632A\u5A01\u8BED</td>\n<td>nb-NO</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u8377\u5170\u8BED</td>\n<td>nl-NL</td>\n<td><code>v4.0.5</code></td>\n</tr>\n<tr>\n<td>\u8461\u8404\u7259\u8BED\uFF08\u5DF4\u897F\uFF09</td>\n<td>pt-BR</td>\n<td><code>v3.3.3</code></td>\n</tr>\n<tr>\n<td>\u7F57\u9A6C\u5C3C\u4E9A\u8BED</td>\n<td>ro-RO</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u4FC4\u7F57\u65AF\u8BED</td>\n<td>ru-RU</td>\n<td><code>v3.1.5</code></td>\n</tr>\n<tr>\n<td>\u585E\u5C14\u7EF4\u4E9A\u8BED</td>\n<td>sr-RS</td>\n<td><code>v4.6.4</code></td>\n</tr>\n<tr>\n<td>\u745E\u5178\u8BED</td>\n<td>sv-SE</td>\n<td><code>v3.4.7</code></td>\n</tr>\n<tr>\n<td>\u6CF0\u8BED</td>\n<td>th-TH</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u571F\u8033\u5176\u8BED</td>\n<td>tr-TR</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u4E4C\u514B\u5170\u8BED</td>\n<td>uk-UA</td>\n<td><code>v3.4.5</code></td>\n</tr>\n<tr>\n<td>\u8D8A\u5357\u8BED</td>\n<td>vi-VN</td>\n<td><code>v3.4.5</code></td>\n</tr>\n<tr>\n<td>\u7B80\u4F53\u4E2D\u6587</td>\n<td>zh-CN</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u7E41\u9AD4\u4E2D\u6587\uFF08\u6E2F\uFF09</td>\n<td>zh-HK</td>\n<td>-</td>\n</tr>\n<tr>\n<td>\u7E41\u9AD4\u4E2D\u6587\uFF08\u53F0\uFF09</td>\n<td>zh-TW</td>\n<td>-</td>\n</tr>\n</tbody>\n</table>\n<blockquote>\n<p>\u5728 <a href="https://github.com/vant-ui/vant/tree/main/packages/vant/src/locale/lang" target="_blank">\u8FD9\u91CC</a> \u67E5\u770B\u6240\u6709\u7684\u8BED\u8A00\u5305\u6E90\u6587\u4EF6\u3002</p>\n</blockquote>\n</div><div class="van-doc-card"><h3 id="huo-qu-dang-qian-yu-yan" tabindex="-1">\u83B7\u53D6\u5F53\u524D\u8BED\u8A00</h3>\n<p>\u4F60\u53EF\u4EE5\u901A\u8FC7 <code>useCurrentLang</code> \u65B9\u6CD5\u6765\u83B7\u53D6\u5F53\u524D\u4F7F\u7528\u7684\u8BED\u8A00\u3002</p>\n<ul>\n<li><strong>\u7C7B\u578B\uFF1A</strong></li>\n</ul>\n<pre><code class="language-ts"><span class="hljs-keyword">function</span> <span class="hljs-title function_">useCurrentLang</span>(<span class="hljs-params"></span>): <span class="hljs-title class_">Ref</span><<span class="hljs-built_in">string</span>>;\n</code></pre>\n<ul>\n<li><strong>\u793A\u4F8B\uFF1A</strong></li>\n</ul>\n<pre><code class="language-ts"><span class="hljs-keyword">import</span> { useCurrentLang } <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</span>;\n\n<span class="hljs-keyword">const</span> currentLang = <span class="hljs-title function_">useCurrentLang</span>();\n\n<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(currentLang.<span class="hljs-property">value</span>); <span class="hljs-comment">// --> 'zh-CN'</span>\n</code></pre>\n</div><h2 id="chang-jian-wen-ti" tabindex="-1">\u5E38\u89C1\u95EE\u9898</h2>\n<div class="van-doc-card"><h3 id="zhao-bu-dao-suo-xu-de-yu-yan-bao" tabindex="-1">\u627E\u4E0D\u5230\u6240\u9700\u7684\u8BED\u8A00\u5305\uFF1F</h3>\n<p>\u5982\u679C\u4E0A\u65B9\u5217\u8868\u4E2D\u6CA1\u6709\u4F60\u9700\u8981\u7684\u8BED\u8A00\uFF0C\u6B22\u8FCE\u7ED9\u6211\u4EEC\u63D0 Pull Request \u6765\u589E\u52A0\u65B0\u7684\u8BED\u8A00\u5305\uFF0C\u6539\u52A8\u5185\u5BB9\u53EF\u4EE5\u53C2\u8003<a href="https://github.com/vant-ui/vant/pull/7245" target="_blank">\u589E\u52A0\u5FB7\u8BED\u8BED\u8A00\u5305</a> \u7684 PR\u3002</p>\n</div><div class="van-doc-card"><h3 id="ye-wu-dai-ma-ru-he-shi-xian-guo-ji-hua" tabindex="-1">\u4E1A\u52A1\u4EE3\u7801\u5982\u4F55\u5B9E\u73B0\u56FD\u9645\u5316\uFF1F</h3>\n<p>\u53EF\u4EE5\u4F7F\u7528 <a href="https://github.com/kazupon/vue-i18n" target="_blank">vue-i18n</a> \u6765\u5B9E\u73B0\u3002</p>\n</div><div class="van-doc-card"><h3 id="yi-cdn-xing-shi-yin-ru-shi-ru-he-shi-yong-yu-yan-bao" tabindex="-1">\u4EE5 CDN \u5F62\u5F0F\u5F15\u5165\u65F6\uFF0C\u5982\u4F55\u4F7F\u7528\u8BED\u8A00\u5305\uFF1F</h3>\n<p>\u76EE\u524D\u6CA1\u6709\u63D0\u4F9B CDN \u5F62\u5F0F\u7684\u8BED\u8A00\u5305\uFF0C\u53EF\u4EE5\u624B\u52A8\u62F7\u8D1D\u8BED\u8A00\u5305\u7684\u5185\u5BB9\u6765\u4F7F\u7528\u3002</p>\n</div><div class="van-doc-card"><h3 id="yu-yan-bao-zhong-bu-bao-han-sku-zu-jian" tabindex="-1">\u8BED\u8A00\u5305\u4E2D\u4E0D\u5305\u542B Sku \u7EC4\u4EF6\uFF1F</h3>\n<p>\u8BED\u8A00\u5305\u4E2D\u9ED8\u8BA4\u4E0D\u5305\u542B Sku \u4E1A\u52A1\u7EC4\u4EF6\u7684\u8BED\u8A00\u914D\u7F6E\uFF0C\u56E0\u6B64\u5982\u679C\u6709 Sku \u7EC4\u4EF6\u7684\u56FD\u9645\u5316\u9700\u6C42\uFF0C\u8BF7\u81EA\u884C\u914D\u7F6E\u56FD\u9645\u5316\u6587\u6848\u3002</p>\n</div>'},null,8,a))}}}]); |