mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
site: generate link with locale
This commit is contained in:
parent
a950a1298a
commit
bdd5be88f2
@ -87,7 +87,7 @@
|
||||
"babel-preset-react": "^6.16.0",
|
||||
"babel-preset-stage-0": "^6.16.0",
|
||||
"bisheng": "^0.21.0",
|
||||
"bisheng-plugin-antd": "^0.8.0",
|
||||
"bisheng-plugin-antd": "^0.10.0",
|
||||
"bisheng-plugin-description": "^0.1.1",
|
||||
"bisheng-plugin-react": "^0.4.0",
|
||||
"bisheng-plugin-toc": "^0.4.0",
|
||||
@ -143,7 +143,7 @@
|
||||
"lint:es": "eslint tests site scripts components ./.eslintrc.js ./webpack.config.js --ext '.js,.jsx'",
|
||||
"lint:demo": "cross-env RUN_ENV=DEMO eslint components/*/demo/*.md --ext '.md'",
|
||||
"lint:style": "stylelint \"components/**/*.less\" --syntax less",
|
||||
"lint-fix": "npm run eslint-fix:code && npm run eslint-fix:demo",
|
||||
"lint-fix": "npm run lint-fix:code && npm run lint-fix:demo",
|
||||
"lint-fix:code": "eslint --fix tests site scripts components ./.eslintrc.js ./webpack.config.js --ext '.js,.jsx'",
|
||||
"lint-fix:demo": "eslint-tinker ./components/*/demo/*.md",
|
||||
"dist": "antd-tools run dist",
|
||||
|
@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import collect from 'bisheng/collect';
|
||||
import MainContent from './MainContent';
|
||||
import * as utils from '../utils';
|
||||
@ -14,7 +13,7 @@ export default collect(async (nextProps) => {
|
||||
nextProps.data.changelog.CHANGELOG :
|
||||
nextProps.utils.get(nextProps.data, pageDataPath);
|
||||
if (!pageData) {
|
||||
throw 404;
|
||||
throw 404; // eslint-disable-line no-throw-literal
|
||||
}
|
||||
|
||||
const locale = utils.isZhCN(pathname) ? 'zh-CN' : 'en-US';
|
||||
@ -22,8 +21,8 @@ export default collect(async (nextProps) => {
|
||||
pageData() : (pageData[locale] || pageData.index[locale] || pageData.index)();
|
||||
const demosFetcher = nextProps.utils.get(nextProps.data, [...pageDataPath, 'demo']);
|
||||
if (demosFetcher) {
|
||||
const [ localizedPageData, demos ] = await Promise.all([pageDataPromise, demosFetcher()]);
|
||||
return { localizedPageData, demos }
|
||||
const [localizedPageData, demos] = await Promise.all([pageDataPromise, demosFetcher()]);
|
||||
return { localizedPageData, demos };
|
||||
}
|
||||
return { localizedPageData: await pageDataPromise };
|
||||
})(MainContent);
|
||||
|
Loading…
Reference in New Issue
Block a user