feat: i18n support

This commit is contained in:
JustSong 2025-02-01 23:50:32 +08:00
parent ee3ed65356
commit 33102c4586
3 changed files with 52 additions and 58 deletions

View File

@ -330,14 +330,13 @@
"cancel": "Cancel" "cancel": "Cancel"
} }
}, },
"messages": {
"update_success": "User information updated successfully!"
},
"add": { "add": {
"title": "Create New User Account" "title": "Create New User Account"
}, },
"messages": { "messages": {
"create_success": "User account created successfully!" "update_success": "User information updated successfully!",
"create_success": "User account created successfully!",
"operation_success": "Operation completed successfully!"
}, },
"search": "Search users...", "search": "Search users...",
"table": { "table": {
@ -379,9 +378,6 @@
"edit": "Edit", "edit": "Edit",
"promote": "Promote", "promote": "Promote",
"demote": "Demote" "demote": "Demote"
},
"messages": {
"operation_success": "Operation completed successfully!"
} }
} }
} }

View File

@ -330,14 +330,13 @@
"cancel": "取消" "cancel": "取消"
} }
}, },
"messages": {
"update_success": "用户信息更新成功!"
},
"add": { "add": {
"title": "创建新用户账户" "title": "创建新用户账户"
}, },
"messages": { "messages": {
"create_success": "用户账户创建成功!" "update_success": "用户信息更新成功!",
"create_success": "用户账户创建成功!",
"operation_success": "操作成功完成!"
}, },
"search": "搜索用户...", "search": "搜索用户...",
"table": { "table": {
@ -379,9 +378,6 @@
"edit": "编辑", "edit": "编辑",
"promote": "提升", "promote": "提升",
"demote": "降级" "demote": "降级"
},
"messages": {
"operation_success": "操作成功完成!"
} }
} }
} }

View File

@ -1,6 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Button, Form, Header, Segment } from 'semantic-ui-react'; import { Button, Form, Card } from 'semantic-ui-react';
import { API, showError, showSuccess } from '../../helpers'; import { API, showError, showSuccess } from '../../helpers';
const AddUser = () => { const AddUser = () => {
@ -30,9 +30,10 @@ const AddUser = () => {
}; };
return ( return (
<> <div className='dashboard-container'>
<Segment> <Card fluid className='chart-card'>
<Header as='h3'>{t('user.add.title')}</Header> <Card.Content>
<Card.Header className='header'>{t('user.add.title')}</Card.Header>
<Form autoComplete='off'> <Form autoComplete='off'>
<Form.Field> <Form.Field>
<Form.Input <Form.Input
@ -59,7 +60,7 @@ const AddUser = () => {
<Form.Input <Form.Input
label={t('user.edit.password')} label={t('user.edit.password')}
name='password' name='password'
type={'password'} type='password'
placeholder={t('user.edit.password_placeholder')} placeholder={t('user.edit.password_placeholder')}
onChange={handleInputChange} onChange={handleInputChange}
value={password} value={password}
@ -67,12 +68,13 @@ const AddUser = () => {
required required
/> />
</Form.Field> </Form.Field>
<Button positive type={'submit'} onClick={submit}> <Button positive type='submit' onClick={submit}>
{t('user.edit.buttons.submit')} {t('user.edit.buttons.submit')}
</Button> </Button>
</Form> </Form>
</Segment> </Card.Content>
</> </Card>
</div>
); );
}; };