master
This commit is contained in:
parent
979c278bbf
commit
7a74b371a1
|
|
@ -57,6 +57,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^17.0.2",
|
"@types/react": "^17.0.2",
|
||||||
"@types/react-dom": "^17.0.2",
|
"@types/react-dom": "^17.0.2",
|
||||||
|
"@types/store": "^2.0.5",
|
||||||
"@umijs/plugin-access": "2.4.2",
|
"@umijs/plugin-access": "2.4.2",
|
||||||
"@umijs/plugin-dva": "^0.13.0",
|
"@umijs/plugin-dva": "^0.13.0",
|
||||||
"@umijs/plugin-initial-state": "^2.4.0",
|
"@umijs/plugin-initial-state": "^2.4.0",
|
||||||
|
|
|
||||||
|
|
@ -1,58 +1,58 @@
|
||||||
export default {
|
export default {
|
||||||
'403': "Sorry, you don't have access to this page.",
|
"403": "Sorry, you don't have access to this page.",
|
||||||
'404': 'Sorry, the page you visited does not exist.',
|
"404": "Sorry, the page you visited does not exist.",
|
||||||
'500': 'Sorry, the server is reporting an error.',
|
"500": "Sorry, the server is reporting an error.",
|
||||||
BackToHome: 'Back to home',
|
BackToHome: "Back to home",
|
||||||
'Add Param': 'Add Param',
|
"Add Param": "Add Param",
|
||||||
Address: 'Address',
|
Address: "Address",
|
||||||
Age: 'Age',
|
Age: "Age",
|
||||||
'Are you sure delete this record?': 'Are you sure delete this record?',
|
"Are you sure delete this record?": "Are you sure delete this record?",
|
||||||
Author: 'Author',
|
Author: "Author",
|
||||||
Avatar: 'Avatar',
|
Avatar: "Avatar",
|
||||||
Categories: 'Categories',
|
Categories: "Categories",
|
||||||
'Clear notifications': 'Clear notifications',
|
"Clear notifications": "Clear notifications",
|
||||||
Comments: 'Comments',
|
Comments: "Comments",
|
||||||
Create: 'Create',
|
Create: "Create",
|
||||||
'Create User': 'Create User',
|
"Create User": "Create User",
|
||||||
CreateTime: 'CreateTime',
|
CreateTime: "CreateTime",
|
||||||
Dark: 'Dark',
|
Dark: "Dark",
|
||||||
Delete: 'Delete',
|
Delete: "Delete",
|
||||||
Email: 'Email',
|
Email: "Email",
|
||||||
Female: 'Female',
|
Female: "Female",
|
||||||
Gender: 'Gender',
|
Gender: "Gender",
|
||||||
'Hi,': 'Hi,',
|
"Hi,": "Hi,",
|
||||||
Image: 'Image',
|
Image: "Image",
|
||||||
Light: 'Light',
|
Light: "Light",
|
||||||
Male: 'Male',
|
Male: "Male",
|
||||||
Name: 'Name',
|
Name: "Name",
|
||||||
NickName: 'NickName',
|
NickName: "NickName",
|
||||||
'Not Found': 'Not Found',
|
"Not Found": "Not Found",
|
||||||
Operation: 'Operation',
|
Operation: "Operation",
|
||||||
Params: 'Params',
|
Params: "Params",
|
||||||
Password: 'Password',
|
Password: "Password",
|
||||||
Phone: 'Phone',
|
Phone: "Phone",
|
||||||
'Pick an address': 'Pick an address',
|
"Pick an address": "Pick an address",
|
||||||
'Please pick an address': 'Please pick an address',
|
"Please pick an address": "Please pick an address",
|
||||||
Publised: 'Publised',
|
Publised: "Publised",
|
||||||
'Publish Date': 'Publish Date',
|
"Publish Date": "Publish Date",
|
||||||
Reset: 'Reset',
|
Reset: "Reset",
|
||||||
Search: 'Search',
|
Search: "Search",
|
||||||
'Search Name': 'Search Name',
|
"Search Name": "Search Name",
|
||||||
Send: 'Send',
|
Send: "Send",
|
||||||
'Sign in': 'Sign in',
|
"Sign in": "Sign in",
|
||||||
'Sign out': 'Sign out',
|
"Sign out": "Sign out",
|
||||||
'Switch Theme': 'Switch Theme',
|
"Switch Theme": "Switch Theme",
|
||||||
Tags: 'Tags',
|
Tags: "Tags",
|
||||||
'The input is not valid E-mail!': 'The input is not valid E-mail!',
|
"The input is not valid E-mail!": "The input is not valid E-mail!",
|
||||||
'The input is not valid phone!': 'The input is not valid phone!',
|
"The input is not valid phone!": "The input is not valid phone!",
|
||||||
Title: 'Title',
|
Title: "Title",
|
||||||
'Total {total} Items': 'Total {total} Items',
|
"Total {total} Items": "Total {total} Items",
|
||||||
Unpublished: 'Unpublished',
|
Unpublished: "Unpublished",
|
||||||
Update: 'Update',
|
Update: "Update",
|
||||||
'Update User': 'Update User',
|
"Update User": "Update User",
|
||||||
Username: 'Username',
|
Username: "Username",
|
||||||
RememberMe: 'Remember me',
|
RememberMe: "Remember me",
|
||||||
Views: 'Views',
|
Views: "Views",
|
||||||
Visibility: 'Visibility',
|
Visibility: "Visibility",
|
||||||
'You have viewed all notifications.': 'You have viewed all notifications.',
|
"You have viewed all notifications.": "You have viewed all notifications."
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,58 +1,58 @@
|
||||||
export default {
|
export default {
|
||||||
'403': '您无权访问此页面。',
|
"403": "您无权访问此页面。",
|
||||||
'404': '您所访问的地址不存在。',
|
"404": "您所访问的地址不存在。",
|
||||||
'500': '发生了服务器错误,请联系管理员处理。',
|
"500": "发生了服务器错误,请联系管理员处理。",
|
||||||
BackToHome: '返回首页',
|
BackToHome: "返回首页",
|
||||||
'Add Param': '添加参数',
|
"Add Param": "添加参数",
|
||||||
Address: '地址',
|
Address: "地址",
|
||||||
Age: '年龄',
|
Age: "年龄",
|
||||||
'Are you sure delete this record?': '您确定要删除这条记录吗?',
|
"Are you sure delete this record?": "您确定要删除这条记录吗?",
|
||||||
Author: '作者',
|
Author: "作者",
|
||||||
Avatar: '头像',
|
Avatar: "头像",
|
||||||
Categories: '类别',
|
Categories: "类别",
|
||||||
'Clear notifications': '清空消息',
|
"Clear notifications": "清空消息",
|
||||||
Comments: '评论数',
|
Comments: "评论数",
|
||||||
Create: '创建',
|
Create: "创建",
|
||||||
'Create User': '创建用户',
|
"Create User": "创建用户",
|
||||||
CreateTime: '创建时间',
|
CreateTime: "创建时间",
|
||||||
Dark: '暗',
|
Dark: "暗",
|
||||||
Delete: '删除',
|
Delete: "删除",
|
||||||
Email: '电子邮件',
|
Email: "电子邮件",
|
||||||
Female: '女',
|
Female: "女",
|
||||||
Gender: '性别',
|
Gender: "性别",
|
||||||
'Hi,': '你好,',
|
"Hi,": "你好,",
|
||||||
Image: '图像',
|
Image: "图像",
|
||||||
Light: '明',
|
Light: "明",
|
||||||
Male: '男性',
|
Male: "男性",
|
||||||
Name: '名字',
|
Name: "名字",
|
||||||
NickName: '昵称',
|
NickName: "昵称",
|
||||||
'Not Found': '未找到',
|
"Not Found": "未找到",
|
||||||
Operation: '操作',
|
Operation: "操作",
|
||||||
Params: '参数',
|
Params: "参数",
|
||||||
Password: '密码',
|
Password: "密码",
|
||||||
Phone: '电话',
|
Phone: "电话",
|
||||||
'Pick an address': '选择地址',
|
"Pick an address": "选择地址",
|
||||||
'Please pick an address': '选择地址',
|
"Please pick an address": "选择地址",
|
||||||
Publised: '已发布',
|
Publised: "已发布",
|
||||||
'Publish Date': '发布日期',
|
"Publish Date": "发布日期",
|
||||||
Reset: '重置',
|
Reset: "重置",
|
||||||
Search: '搜索',
|
Search: "搜索",
|
||||||
'Search Name': '搜索名字',
|
"Search Name": "搜索名字",
|
||||||
Send: '发送',
|
Send: "发送",
|
||||||
'Sign in': '登录',
|
"Sign in": "登录",
|
||||||
'Sign out': '退出登录',
|
"Sign out": "退出登录",
|
||||||
'Switch Theme': '切换主题',
|
"Switch Theme": "切换主题",
|
||||||
Tags: '标签',
|
Tags: "标签",
|
||||||
'The input is not valid E-mail!': '输入的电子邮件无效!',
|
"The input is not valid E-mail!": "输入的电子邮件无效!",
|
||||||
'The input is not valid phone!': '输入无效的手机!',
|
"The input is not valid phone!": "输入无效的手机!",
|
||||||
Title: '标题',
|
Title: "标题",
|
||||||
'Total {total} Items': '总共 {total} 条记录',
|
"Total {total} Items": "总共 {total} 条记录",
|
||||||
Unpublished: '未发布',
|
Unpublished: "未发布",
|
||||||
Update: '更新',
|
Update: "更新",
|
||||||
'Update User': '更新用户',
|
"Update User": "更新用户",
|
||||||
Username: '用户名',
|
Username: "用户名",
|
||||||
RememberMe: '记住我',
|
RememberMe: "记住我",
|
||||||
Views: '浏览数',
|
Views: "浏览数",
|
||||||
Visibility: '可见性',
|
Visibility: "可见性",
|
||||||
'You have viewed all notifications.': '您已查看所有通知',
|
"You have viewed all notifications.": "您已查看所有通知"
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { useIntl, Link } from 'umi';
|
import { useIntl, Link } from 'umi';
|
||||||
import { Result, Button } from 'antd';
|
import { Result, Button } from 'antd';
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { DownloadOutlined, PrinterOutlined } from "@ant-design/icons";
|
||||||
import { useMobStore } from "@/hooks";
|
import { useMobStore } from "@/hooks";
|
||||||
import { toJS } from "mobx";
|
import { toJS } from "mobx";
|
||||||
import styles from "./index.less";
|
import styles from "./index.less";
|
||||||
|
import Trans from "@/utils/locale";
|
||||||
|
|
||||||
interface IProps extends DrawerProps {}
|
interface IProps extends DrawerProps {}
|
||||||
|
|
||||||
|
|
@ -44,7 +45,7 @@ const Index: React.FC<IProps> = observer((props) => {
|
||||||
打印
|
打印
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="ghost" icon={<DownloadOutlined />} onClick={toPdf}>
|
<Button type="ghost" icon={<DownloadOutlined />} onClick={toPdf}>
|
||||||
pdf
|
pdf<Trans>Address</Trans>
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import { useMobStore } from "@/hooks";
|
||||||
import * as hiprintConfig from "./config";
|
import * as hiprintConfig from "./config";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import styles from "./index.less";
|
import styles from "./index.less";
|
||||||
|
import Trans from "@/utils/locale";
|
||||||
const { Header, Sider, Content } = Layout;
|
const { Header, Sider, Content } = Layout;
|
||||||
|
|
||||||
interface OwnProps {}
|
interface OwnProps {}
|
||||||
|
|
@ -88,7 +88,7 @@ const Design: FunctionComponent<Props> = observer((props) => {
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Button type="primary" icon={<EyeOutlined />} onClick={() => setOpen(true)}>
|
<Button type="primary" icon={<EyeOutlined />} onClick={() => setOpen(true)}>
|
||||||
预览
|
预览<Trans>Address</Trans>
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,20 @@
|
||||||
import * as React from 'react';
|
import * as React from "react";
|
||||||
import moment from 'moment';
|
import moment from "moment";
|
||||||
import store from 'store';
|
import store from "store";
|
||||||
import { useIntl } from 'umi';
|
import { useIntl } from "umi";
|
||||||
import { i18n } from './config';
|
import { i18n } from "./config";
|
||||||
|
|
||||||
export const languages = i18n ? i18n.languages.map((item) => item.key) : [];
|
export const languages = i18n ? i18n.languages.map((item) => item.key) : [];
|
||||||
export const defaultLanguage = i18n ? i18n.defaultLanguage : '';
|
export const defaultLanguage = i18n ? i18n.defaultLanguage : "";
|
||||||
|
|
||||||
export function getLocale() {
|
export function getLocale() {
|
||||||
return store.get('locale') || defaultLanguage;
|
return store.get("locale") || defaultLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setLocale(language: string) {
|
export function setLocale(language: string) {
|
||||||
if (getLocale() !== language) {
|
if (getLocale() !== language) {
|
||||||
moment.locale(language === 'zh-CN' ? 'zh-CN' : language);
|
moment.locale(language === "zh-CN" ? "zh-CN" : language);
|
||||||
store.set('locale', language);
|
store.set("locale", language);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -21,7 +22,8 @@ export function setLocale(language: string) {
|
||||||
interface ITransProps {
|
interface ITransProps {
|
||||||
children: string;
|
children: string;
|
||||||
}
|
}
|
||||||
const Trans: React.FC<ITransProps> = ({ children }: any) => {
|
|
||||||
|
export default function Trans({ children }: ITransProps) {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
return intl.formatMessage({ id: children });
|
return <>{intl.formatMessage({ id: children })}</>;
|
||||||
};
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue