-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Even when using Ant Design english, the umi-blocks.json that is pulled in is not english:
This is because the way we generate blocks is the following (https://github.com/ant-design/ant-design-blocks/blob/master/src/index.js#L104)
...
spinner.start('generate umi-block.json');
let blockList = [];
for (let index = 0; index < demosWithText.length; index++) {
const demoWithText = demosWithText[index];
const { name, componentName, mdBaseName, text, componentType } = demoWithText;
const description = parseDesc(text);
const demoTitle = parseTitle(text);
if (fs.existsSync(path.join(__dirname, '../', name))) {
const title = `${componentName}-${demoTitle}`;
const img = `https://raw.githubusercontent.com/ant-design/ant-design-blocks/master/${name}/snapshot.png`;
const previewUrl = `https://ant.design/components/${componentName}-cn/#components-${componentName}-demo-${mdBaseName}`;
const url = `https://github.com/ant-design/ant-design-blocks/tree/master/${name}`;
const tags = [componentType];
blockList.push({
title,
value: name,
key: name,
description,
url,
type: 'block',
path: name,
isPage: false,
defaultPath: `/${name}`,
img,
tags,
name: title,
previewUrl,
features: ['antd'],
});
}
}
...There's a few things we could do (this is all very much pseudocode):
let basePreviewUrl = `https://ant.design/components/${componentName}`
if (locale !== 'en-US') {
basePreviewUrl = `${basePreviewUrl}-${locale}
}
const previewUrl = `${basePreviewUrl}/#components-${componentName}-demo-${mdBaseName}`For the title, tags, and description, maybe we can also not just pull from package.json for the component, but instead have some alternative versions of these based on the locale?
Similarly, in FetchAntdDemos (https://github.com/ant-design/ant-design-blocks/blob/master/src/fetchAntDDemos.js#L18), we parse out the index.zh-CN.md, but maybe we could do something like index.${locale}.md or something along those lines.
Timur2915
Metadata
Metadata
Assignees
Labels
No labels
