style: add translate for integration

pull/90/head
moonrailgun 2 years ago
parent c370347cf4
commit 454522fed8

@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react'; import React, { useState } from 'react';
import { Avatar, Button, Input, UserName } from '@capital/component'; import { Avatar, Button, Input, UserName } from '@capital/component';
import styled from 'styled-components'; import styled from 'styled-components';
import type { OpenAppInfo } from 'types'; import type { OpenAppInfo } from 'types';
@ -9,6 +9,7 @@ import {
useGroupIdContext, useGroupIdContext,
showSuccessToasts, showSuccessToasts,
} from '@capital/common'; } from '@capital/common';
import { Translate } from './translate';
const Tip = styled.div` const Tip = styled.div`
color: #999; color: #999;
@ -51,7 +52,7 @@ const IntegrationPanel: React.FC = React.memo(() => {
}); });
if (!data) { if (!data) {
showErrorToasts('没找到该应用'); showErrorToasts(Translate.notFoundApp);
return; return;
} }
@ -69,11 +70,11 @@ const IntegrationPanel: React.FC = React.memo(() => {
return ( return (
<div> <div>
<Tip>ID</Tip> <Tip>{Translate.onlyAllowManualAddition}</Tip>
<Row> <Row>
<Input <Input
placeholder={'应用ID'} placeholder={Translate.appId}
value={appId} value={appId}
onChange={(e) => setAppId(e.target.value)} onChange={(e) => setAppId(e.target.value)}
/> />
@ -83,7 +84,7 @@ const IntegrationPanel: React.FC = React.memo(() => {
loading={loading} loading={loading}
onClick={handleQueryApp} onClick={handleQueryApp}
> >
{Translate.search}
</Button> </Button>
</Row> </Row>
@ -101,7 +102,7 @@ const IntegrationPanel: React.FC = React.memo(() => {
<div>{openAppInfo.appName}</div> <div>{openAppInfo.appName}</div>
<div>{openAppInfo.appDesc}</div> <div>{openAppInfo.appDesc}</div>
<Row> <Row>
<div>:</div> <div>{Translate.developer}:</div>
<UserName userId={openAppInfo.owner} /> <UserName userId={openAppInfo.owner} />
</Row> </Row>
@ -113,7 +114,7 @@ const IntegrationPanel: React.FC = React.memo(() => {
loading={addBotLoading} loading={addBotLoading}
onClick={handleAddBotIntoGroup} onClick={handleAddBotIntoGroup}
> >
{Translate.addBot}
</Button> </Button>
)} )}
</div> </div>

@ -5,4 +5,28 @@ export const Translate = {
'zh-CN': '集成', 'zh-CN': '集成',
'en-US': 'Integration', 'en-US': 'Integration',
}), }),
notFoundApp: localTrans({
'zh-CN': '没找到该应用',
'en-US': 'Not found application',
}),
onlyAllowManualAddition: localTrans({
'zh-CN': '目前仅支持通过应用ID手动添加',
'en-US': 'Currently only supports manual addition via app ID',
}),
appId: localTrans({
'zh-CN': '应用ID',
'en-US': 'Application ID',
}),
search: localTrans({
'zh-CN': '查询',
'en-US': 'Search',
}),
developer: localTrans({
'zh-CN': '开发者',
'en-US': 'Developer',
}),
addBot: localTrans({
'zh-CN': '添加应用机器人到群组',
'en-US': 'Add app bot to group',
}),
}; };

Loading…
Cancel
Save