mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
Merge branch 'master' of github.com:ant-design/ant-design
This commit is contained in:
commit
6cfc4881cc
@ -1,3 +1,8 @@
|
||||
---
|
||||
order: 2
|
||||
title: Installation
|
||||
---
|
||||
|
||||
## Using npm to install
|
||||
|
||||
**We recommend using npm to install**,it not only makes development easier,but you can also take advantage of the whole ecosystem.
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
order: 2
|
||||
english: 安装
|
||||
title: 安装
|
||||
---
|
||||
|
||||
## 使用 npm 安装
|
@ -30,7 +30,6 @@
|
||||
return '<span class="' + className + '">' + letter + '</span>';
|
||||
}).join('');
|
||||
</script>
|
||||
<script src="./zh-Hans-CN.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -88,6 +88,8 @@
|
||||
"eslint-plugin-react": "^5.0.1",
|
||||
"eslint-tinker": "^0.3.1",
|
||||
"history": "^2.0.1",
|
||||
"intl": "^1.2.2",
|
||||
"intl-locales-supported": "^1.0.0",
|
||||
"jest-cli": "^12.0.2",
|
||||
"jsonml-to-react-component": "~0.2.0",
|
||||
"jsonml.js": "^0.1.0",
|
||||
|
@ -60,7 +60,7 @@ export default class Article extends React.Component {
|
||||
return (
|
||||
<article className="markdown">
|
||||
<h1>
|
||||
{meta.english} {meta.chinese}
|
||||
{meta.title || meta.english} {meta.subtitle || meta.chinese}
|
||||
{
|
||||
!meta.subtitle ? null :
|
||||
<span className="subtitle">{meta.subtitle}</span>
|
||||
|
@ -47,7 +47,7 @@ export default class MainContent extends React.Component {
|
||||
generateMenuItem(isTop, item) {
|
||||
const key = this.fileNameToPath(item.fileName);
|
||||
const text = isTop ?
|
||||
item.chinese || item.english : [
|
||||
item.title || item.chinese || item.english : [
|
||||
<span key="english">{item.title || item.english}</span>,
|
||||
<span className="chinese" key="chinese">{item.subtitle || item.chinese}</span>,
|
||||
];
|
||||
|
@ -52,9 +52,32 @@ if (!location.port) {
|
||||
/* eslint-enable */
|
||||
}
|
||||
|
||||
const isZhCN =
|
||||
(typeof localStorage !== 'undefined' && localStorage.getItem('locale') === 'zh-CN') ||
|
||||
(navigator.language === 'zh-CN');
|
||||
// Polyfill
|
||||
const areIntlLocalesSupported = require('intl-locales-supported');
|
||||
const localesMyAppSupports = ['zh-CN', 'en-US'];
|
||||
|
||||
if (global.Intl) {
|
||||
// Determine if the built-in `Intl` has the locale data we need.
|
||||
if (!areIntlLocalesSupported(localesMyAppSupports)) {
|
||||
// `Intl` exists, but it doesn't have the data we need, so load the
|
||||
// polyfill and patch the constructors we need with the polyfill's.
|
||||
/* eslint-disable global-require */
|
||||
const IntlPolyfill = require('intl');
|
||||
/* eslint-enable global-require */
|
||||
Intl.NumberFormat = IntlPolyfill.NumberFormat;
|
||||
Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat;
|
||||
}
|
||||
} else {
|
||||
// No `Intl`, so use and load the polyfill.
|
||||
/* eslint-disable global-require */
|
||||
global.Intl = require('intl');
|
||||
/* eslint-enable global-require */
|
||||
}
|
||||
|
||||
|
||||
const isZhCN = (typeof localStorage !== 'undefined' && localStorage.getItem('locale') !== 'en-US');
|
||||
// (typeof localStorage !== 'undefined' && localStorage.getItem('locale') === 'zh-CN') ||
|
||||
// (navigator.language === 'zh-CN');
|
||||
const appLocale = isZhCN ? cnLocale : enLocale;
|
||||
addLocaleData(appLocale.data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user