支持多语言英文

This commit is contained in:
whyour
2023-07-29 18:26:30 +08:00
parent 39bfd39559
commit e7d023a7e0
68 changed files with 2186 additions and 982 deletions
+40 -35
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useState, useEffect, useRef } from 'react';
import {
Button,
@@ -64,7 +65,7 @@ const Subscription = () => {
const columns: any = [
{
title: '名称',
title: intl.get('名称'),
dataIndex: 'name',
key: 'name',
width: 150,
@@ -74,7 +75,7 @@ const Subscription = () => {
},
},
{
title: '链接',
title: intl.get('链接'),
dataIndex: 'url',
key: 'url',
sorter: {
@@ -96,7 +97,7 @@ const Subscription = () => {
},
},
{
title: '类型',
title: intl.get('类型'),
dataIndex: 'type',
key: 'type',
width: 130,
@@ -105,7 +106,7 @@ const Subscription = () => {
},
},
{
title: '分支',
title: intl.get('分支'),
dataIndex: 'branch',
key: 'branch',
width: 130,
@@ -114,7 +115,7 @@ const Subscription = () => {
},
},
{
title: '定时规则',
title: intl.get('定时规则'),
width: 180,
render: (text: string, record: any) => {
if (record.schedule_type === 'interval') {
@@ -125,21 +126,21 @@ const Subscription = () => {
},
},
{
title: '状态',
title: intl.get('状态'),
key: 'status',
dataIndex: 'status',
width: 110,
filters: [
{
text: '运行中',
text: intl.get('运行中'),
value: 0,
},
{
text: '空闲中',
text: intl.get('空闲中'),
value: 1,
},
{
text: '已禁用',
text: intl.get('已禁用'),
value: 2,
},
],
@@ -157,7 +158,7 @@ const Subscription = () => {
<>
{record.status === SubscriptionStatus.idle && (
<Tag icon={<ClockCircleOutlined />} color="default">
{intl.get('空闲中')}
</Tag>
)}
{record.status === SubscriptionStatus.running && (
@@ -165,7 +166,7 @@ const Subscription = () => {
icon={<Loading3QuartersOutlined spin />}
color="processing"
>
{intl.get('运行中')}
</Tag>
)}
</>
@@ -173,14 +174,14 @@ const Subscription = () => {
{record.is_disabled === 1 &&
record.status === SubscriptionStatus.idle && (
<Tag icon={<CloseCircleOutlined />} color="error">
{intl.get('已禁用')}
</Tag>
)}
</>
),
},
{
title: '操作',
title: intl.get('操作'),
key: 'action',
width: 130,
render: (text: string, record: any, index: number) => {
@@ -188,7 +189,7 @@ const Subscription = () => {
return (
<Space size="middle">
{record.status === SubscriptionStatus.idle && (
<Tooltip title={isPc ? '运行' : ''}>
<Tooltip title={isPc ? intl.get('运行') : ''}>
<a
onClick={(e) => {
e.stopPropagation();
@@ -200,7 +201,7 @@ const Subscription = () => {
</Tooltip>
)}
{record.status !== SubscriptionStatus.idle && (
<Tooltip title={isPc ? '停止' : ''}>
<Tooltip title={isPc ? intl.get('停止') : ''}>
<a
onClick={(e) => {
e.stopPropagation();
@@ -211,7 +212,7 @@ const Subscription = () => {
</a>
</Tooltip>
)}
<Tooltip title={isPc ? '日志' : ''}>
<Tooltip title={isPc ? intl.get('日志') : ''}>
<a
onClick={(e) => {
e.stopPropagation();
@@ -242,14 +243,14 @@ const Subscription = () => {
const runSubscription = (record: any, index: number) => {
Modal.confirm({
title: '确认运行',
title: intl.get('确认运行'),
content: (
<>
{' '}
{intl.get('确认运行定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name}
</Text>{' '}
{intl.get('吗')}
</>
),
onOk() {
@@ -277,14 +278,14 @@ const Subscription = () => {
const stopSubsciption = (record: any, index: number) => {
Modal.confirm({
title: '确认停止',
title: intl.get('确认停止'),
content: (
<>
{' '}
{intl.get('确认停止定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name}
</Text>{' '}
{intl.get('吗')}
</>
),
onOk() {
@@ -336,14 +337,14 @@ const Subscription = () => {
const delSubscription = (record: any, index: number) => {
Modal.confirm({
title: '确认删除',
title: intl.get('确认删除'),
content: (
<>
{' '}
{intl.get('确认删除定时订阅')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name}
</Text>{' '}
{intl.get('吗')}
</>
),
onOk() {
@@ -369,15 +370,18 @@ const Subscription = () => {
const enabledOrDisabledSubscription = (record: any, index: number) => {
Modal.confirm({
title: `确认${record.is_disabled === 1 ? '启用' : '禁用'}`,
title: `确认${
record.is_disabled === 1 ? intl.get('启用') : intl.get('禁用')
}`,
content: (
<>
{record.is_disabled === 1 ? '启用' : '禁用'}
{' '}
{intl.get('确认')}
{record.is_disabled === 1 ? intl.get('启用') : intl.get('禁用')}
{intl.get('定时订阅')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name}
</Text>{' '}
{intl.get('吗')}
</>
),
onOk() {
@@ -418,9 +422,10 @@ const Subscription = () => {
trigger={['click']}
menu={{
items: [
{ label: '编辑', key: 'edit', icon: <EditOutlined /> },
{ label: intl.get('编辑'), key: 'edit', icon: <EditOutlined /> },
{
label: record.is_disabled === 1 ? '启用' : '禁用',
label:
record.is_disabled === 1 ? intl.get('启用') : intl.get('禁用'),
key: 'enableOrDisable',
icon:
record.is_disabled === 1 ? (
@@ -429,7 +434,7 @@ const Subscription = () => {
<StopOutlined />
),
},
{ label: '删除', key: 'delete', icon: <DeleteOutlined /> },
{ label: intl.get('删除'), key: 'delete', icon: <DeleteOutlined /> },
],
onClick: ({ key, domEvent }) => {
domEvent.stopPropagation();
@@ -531,10 +536,10 @@ const Subscription = () => {
return (
<PageContainer
className="ql-container-wrapper subscriptiontab-wrapper"
title="订阅管理"
title={intl.get('订阅管理')}
extra={[
<Search
placeholder="请输入名称或者关键词"
placeholder={intl.get('请输入名称或者关键词')}
style={{ width: 'auto' }}
enterButton
allowClear
@@ -542,7 +547,7 @@ const Subscription = () => {
onSearch={onSearch}
/>,
<Button key="2" type="primary" onClick={() => addSubscription()}>
{intl.get('创建订阅')}
</Button>,
]}
header={{