-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path13-9c128e7e1f8e9241073d.js
1 lines (1 loc) · 3.85 KB
/
13-9c128e7e1f8e9241073d.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{874:function(n,a,t){"use strict";t.r(a),t.d(a,"default",(function(){return P}));var s=t(840),e=t.n(s),o=t(841),c=t.n(o),p=t(521),r=t.n(p),u=t(842),l=t.n(u),i=t(843),d=t.n(i),k=t(844),f=t.n(k),m=t(845),h=t.n(m),v=t(846),y=t.n(v),g=t(0),w=t.n(g),j=t(210);function S(n){var a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(n){return!1}}();return function(){var t,s=f()(n);if(a){var e=f()(this).constructor;t=Reflect.construct(s,arguments,e)}else t=s.apply(this,arguments);return d()(this,t)}}function b(n){return w.a.createElement(n.tag,y()({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function C(n){return w.a.createElement(b,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function E(n){return w.a.createElement(b,{tag:"style",html:n.style})}g.Component;var P=function(n){l()(t,n);var a=S(t);function t(){return e()(this,t),a.apply(this,arguments)}return c()(t,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var a=document.querySelector('a[href="'.concat(n,'"]'));a&&Object(j.a)(document.documentElement,0,function n(a,t){for(;a;)return a.offsetTop&&"static"!==getComputedStyle(a).position&&(t+=a.offsetTop),n(a.parentNode,t);return t}(a,-9))}}},{key:"render",value:function(){return w.a.createElement("div",{className:"zandoc-react-container",key:null},w.a.createElement(E,{style:""}),w.a.createElement(C,{html:'<h2 class="anchor-heading"><a href="#guo-ji-hua">¶</a><a href="javascript:void(0)" id="guo-ji-hua" class="anchor-point"></a>国际化</h2>\n<p>目前 Zent 的默认语言为中文,同时提供英文支持。如需要在国际化场景下使用 Zent 组件,可以参考下面的方法。</p>\n<h4 class="anchor-heading"><a href="#i18nprovider">¶</a><a href="javascript:void(0)" id="i18nprovider" class="anchor-point"></a>I18nProvider</h4>\n<p>Zent 提供一个 Provider 组件用于配置组件内部文案的语言。组件利用 context 实现对组件内部文案的配置,需要在应用最外层包裹使用。</p>\n<pre><code class="language-jsx"><span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">I18nProvider</span> <span class="token keyword module">as</span> <span class="token maybe-class-name">Provider</span> <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword module">import</span> enUS <span class="token keyword module">from</span> <span class="token string">\'zent/es/i18n/en-US\'</span><span class="token punctuation">;</span>\n\n<span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Provider</span></span> <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>enUS<span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">App</span></span> <span class="token punctuation">/></span></span>\n<span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Provider</span></span><span class="token punctuation">></span></span><span class="token punctuation">;</span></code></pre>\n<p>目前仅有中文/英文两种语言包,分别对应 i18n 文件夹下 <code>en-US.js</code>/<code>zh-CN.js</code>两个文件。</p>'}))}}]),t}(g.Component)}}]);