mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
docs: translate category for specification
This commit is contained in:
parent
4bf80a2e26
commit
b43d40d47b
@ -1,5 +1,5 @@
|
||||
---
|
||||
category: 十大原则
|
||||
category: Principles
|
||||
order: 2
|
||||
title: Alignment
|
||||
---
|
||||
|
@ -1,5 +1,7 @@
|
||||
---
|
||||
category: 设计基础
|
||||
category:
|
||||
zh-CN: 设计基础
|
||||
en-US: Design Fundamental
|
||||
order: 2
|
||||
title:
|
||||
zh-CN: 色彩
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
category: 十大原则
|
||||
category: Principles
|
||||
order: 3
|
||||
title: Contrast
|
||||
---
|
||||
|
@ -1,5 +1,7 @@
|
||||
---
|
||||
category: 十大原则
|
||||
category:
|
||||
zh-CN: 十大原则
|
||||
en-US: Principles
|
||||
order: 5
|
||||
title:
|
||||
zh-CN: 直截了当
|
||||
|
@ -1,5 +1,7 @@
|
||||
---
|
||||
category: 设计基础
|
||||
category:
|
||||
zh-CN: 设计基础
|
||||
en-US: Design Fundamental
|
||||
order: 0
|
||||
title:
|
||||
zh-CN: 字体
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
category: 十大原则
|
||||
category: Principles
|
||||
order: 8
|
||||
title: Provide an Invitation
|
||||
---
|
||||
|
@ -1,6 +1,8 @@
|
||||
---
|
||||
template: component
|
||||
category: 设计基础
|
||||
category:
|
||||
zh-CN: 设计基础
|
||||
en-US: Design Fundamental
|
||||
order: 4
|
||||
cols: 1
|
||||
title:
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
category: 十大原则
|
||||
category: Principles
|
||||
order: 6
|
||||
title: Keep it Lightweight
|
||||
---
|
||||
|
@ -1,5 +1,7 @@
|
||||
---
|
||||
category: 设计基础
|
||||
category:
|
||||
zh-CN: 设计基础
|
||||
en-US: Design Fundamental
|
||||
order: 5
|
||||
title:
|
||||
zh-CN: 组件动画
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
category: 十大原则
|
||||
category: Principles
|
||||
order: 0
|
||||
title: Introduction
|
||||
---
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
category: 十大原则
|
||||
category: Principles
|
||||
order: 1
|
||||
title: Proximity
|
||||
---
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
category: 十大原则
|
||||
category: Principles
|
||||
order: 10
|
||||
title: React Immediately
|
||||
---
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
category: 十大原则
|
||||
category: Principles
|
||||
order: 4
|
||||
title: Repetition
|
||||
---
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
category: 十大原则
|
||||
category: Principles
|
||||
order: 6
|
||||
title: Stay on the Page
|
||||
---
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
category: 十大原则
|
||||
category: Principles
|
||||
order: 9
|
||||
title: Use Transition
|
||||
---
|
||||
|
@ -1,5 +1,7 @@
|
||||
---
|
||||
category: 设计基础
|
||||
category:
|
||||
zh-CN: 设计基础
|
||||
en-US: Design Fundamental
|
||||
order: 1
|
||||
title:
|
||||
zh-CN: 排版
|
||||
|
@ -2,10 +2,10 @@ const contentTmpl = './template/Content/index';
|
||||
|
||||
module.exports = {
|
||||
categoryOrder: {
|
||||
组件: 0,
|
||||
十大原则: 0,
|
||||
Principles: 0,
|
||||
设计基础: 1,
|
||||
动画: 2,
|
||||
'Design Fundamental': 1,
|
||||
},
|
||||
typeOrder: {
|
||||
Basic: 0,
|
||||
|
@ -31,7 +31,9 @@ export default class MainContent extends React.Component {
|
||||
}
|
||||
if (prevModule !== this.currentModule) {
|
||||
const moduleData = this.getModuleData(nextProps);
|
||||
const shouldOpenKeys = Object.keys(utils.getMenuItems(moduleData));
|
||||
const shouldOpenKeys = Object.keys(utils.getMenuItems(
|
||||
moduleData, this.context.intl.locale
|
||||
));
|
||||
this.setState({ openKeys: shouldOpenKeys });
|
||||
}
|
||||
}
|
||||
@ -128,7 +130,9 @@ export default class MainContent extends React.Component {
|
||||
|
||||
getMenuItems() {
|
||||
const moduleData = this.getModuleData(this.props);
|
||||
const menuItems = utils.getMenuItems(moduleData);
|
||||
const menuItems = utils.getMenuItems(
|
||||
moduleData, this.context.intl.locale
|
||||
);
|
||||
const topLevel = this.generateSubMenuItems(menuItems.topLevel);
|
||||
const subMenu = Object.keys(menuItems).filter(this.isNotTopLevel)
|
||||
.sort((a, b) => config.categoryOrder[a] - config.categoryOrder[b])
|
||||
|
@ -1,10 +1,10 @@
|
||||
export function getMenuItems(moduleData) {
|
||||
export function getMenuItems(moduleData, locale) {
|
||||
const menuMeta = moduleData.map(item => item.meta);
|
||||
const menuItems = {};
|
||||
menuMeta.sort(
|
||||
(a, b) => (a.order || 0) - (b.order || 0)
|
||||
).forEach((meta) => {
|
||||
const category = meta.category || 'topLevel';
|
||||
const category = (meta.category && meta.category[locale]) || meta.category || 'topLevel';
|
||||
if (!menuItems[category]) {
|
||||
menuItems[category] = {};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user