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"
}
},
"messages": {
"update_success": "User information updated successfully!"
},
"add": {
"title": "Create New User Account"
},
"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...",
"table": {
@ -379,9 +378,6 @@
"edit": "Edit",
"promote": "Promote",
"demote": "Demote"
},
"messages": {
"operation_success": "Operation completed successfully!"
}
}
}

View File

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

View File

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