update 0.9.1

This commit is contained in:
yehuozhili
2021-09-27 21:52:16 +08:00
parent b371f494cb
commit 8aabe0d4ed
18 changed files with 429 additions and 529 deletions

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-08-27 10:20:23
* @LastEditors: yehuozhili
* @LastEditTime: 2021-08-27 16:06:49
* @LastEditTime: 2021-09-27 21:11:51
* @FilePath: \dooringx\packages\dooringx-lib\src\locale\en.ts
*/
@@ -37,5 +37,5 @@ export const en: typeof zhCN = {
'right.containerheight': 'Container height',
'right.containerColor': 'Container background color',
'right.bodyColor': 'Body background color',
title: 'title',
title: 'Title',
};

View File

@@ -1,18 +0,0 @@
/*
* @Author: yehuozhili
* @Date: 2021-08-27 10:20:38
* @LastEditors: yehuozhili
* @LastEditTime: 2021-08-27 14:30:05
* @FilePath: \dooringx\packages\dooringx-lib\src\locale\index.ts
*/
import { en } from './en';
import { zhCN } from './zh-CN';
export const localeMap = {
'zh-CN': zhCN,
en,
};
export type localeKey = keyof typeof localeMap;
export { en } from './en';
export { zhCN } from './zh-CN';

View File

@@ -0,0 +1,39 @@
/*
* @Author: yehuozhili
* @Date: 2021-08-27 10:20:38
* @LastEditors: yehuozhili
* @LastEditTime: 2021-09-27 18:08:49
* @FilePath: \dooringx\packages\dooringx-lib\src\locale\index.tsx
*/
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { UserConfig } from '..';
import { en } from './en';
import { zhCN } from './zh-CN';
export const localeMap = {
'zh-CN': zhCN,
en,
};
export type localeKey = keyof typeof localeMap;
export { en } from './en';
export { zhCN } from './zh-CN';
export const replaceLocale = (
id: string,
msg: string,
config: UserConfig,
param?: any,
paramString?: string
) => {
if (config.i18n) {
if (paramString) {
return (
<FormattedMessage id={id} defaultMessage={paramString} values={param}></FormattedMessage>
);
}
return <FormattedMessage id={id} defaultMessage={msg}></FormattedMessage>;
}
return msg;
};

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-08-27 10:20:15
* @LastEditors: yehuozhili
* @LastEditTime: 2021-08-27 16:06:45
* @LastEditTime: 2021-09-27 21:11:43
* @FilePath: \dooringx\packages\dooringx-lib\src\locale\zh-CN.ts
*/
export const zhCN = {
@@ -27,8 +27,8 @@ export const zhCN = {
'modal.popup.name': '请输入弹窗名称',
'modal.name': '弹窗名称',
'modal.control.remove': '取消点击删除弹窗',
yes: '',
no: '',
yes: '确定',
no: '取消',
'right.noprops': '还没有配置属性',
'right.global': '全局设置',
'right.containerheight': '容器高度',