Skip to content

Commit

Permalink
refactor: additional text translation of the login page
Browse files Browse the repository at this point in the history
  • Loading branch information
Sloaix committed Aug 9, 2021
1 parent ab6b7a8 commit 64cc3eb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
8 changes: 5 additions & 3 deletions gofi-backend/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg" href="/assets/logo.1ace45ba.svg" />
<title>Gofi</title>
<script type="module" crossorigin src="/assets/index.f38c3684.js"></script>
<link rel="modulepreload" href="/assets/vendor.c6d425b1.js">
<link rel="stylesheet" href="/assets/index.4ff90478.css">
<script type="module" crossorigin src="/assets/index.49e7503e.js"></script>
<link rel="modulepreload" href="/assets/react-syntax-highlighter.d33b6198.js">
<link rel="modulepreload" href="/assets/lodash.1bfdface.js">
<link rel="modulepreload" href="/assets/rxjs.d380d255.js">
<link rel="stylesheet" href="/assets/index.ab82f41b.css">
</head>

<body>
Expand Down
5 changes: 5 additions & 0 deletions gofi-frontend/src/i18n/en/pages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
export default {
'pages.file-viewer.title': 'Files',
'pages.file-detail.title': 'File Details',
'pages.login.label.forget-password': 'Forget password?',
'pages.login.form.button.signin': 'Login',
'pages.login.form.checkbox.rememberme': 'Remember me',
'pages.login.form.input.placeholder.username': 'Username',
'pages.login.form.input.placeholder.password': 'Password',
'pages.admin.setting.title': 'Setting',
'pages.admin.setting.sub-title': 'Gofi Configuration',
'pages.admin.setting.label.storage-path': 'Storage',
Expand Down
5 changes: 5 additions & 0 deletions gofi-frontend/src/i18n/zh/pages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
export default {
'pages.file-viewer.title': '所有文件',
'pages.file-detail.title': '文件详情',
'pages.login.label.forget-password': '忘记密码?',
'pages.login.form.button.signin': '登录',
'pages.login.form.checkbox.rememberme': '记住我',
'pages.login.form.input.placeholder.username': '用户名',
'pages.login.form.input.placeholder.password': '密码',
'pages.admin.setting.title': '设置',
'pages.admin.setting.sub-title': 'Gofi相关配置',
'pages.admin.setting.label.storage-path': '文件仓库',
Expand Down
24 changes: 16 additions & 8 deletions gofi-frontend/src/pages/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const defualtProps: IProps = {}

const Login: React.FC<IProps> = (props) => {
const { userStore } = useStore()
const {t} = useTranslation()
const { t } = useTranslation()
if (userStore.isLogin) {
navigate('/')
}
Expand Down Expand Up @@ -91,15 +91,23 @@ const Login: React.FC<IProps> = (props) => {
{/* <input type='hidden' name='remember' value={true} /> */}
<div className="flex flex-col w-full space-y-4">
<Input
placeholder={EnvUtil.isPreviewMode ? '用户名:admin' : '用户名'}
placeholder={
EnvUtil.isPreviewMode
? `${t('pages.login.form.input.placeholder.username')}: admin`
: t('pages.login.form.input.placeholder.username')
}
fullWidth={true}
value={loginStore.username}
onChange={(e) => {
loginStore.setUsername(e.target.value)
}}
/>
<Input
placeholder={EnvUtil.isPreviewMode ? '密码:password' : '密码'}
placeholder={
EnvUtil.isPreviewMode
? `${t('pages.login.form.input.placeholder.password')}: password`
: t('pages.login.form.input.placeholder.password')
}
fullWidth={true}
type="password"
value={loginStore.password}
Expand All @@ -118,17 +126,17 @@ const Login: React.FC<IProps> = (props) => {
}}
/>
<label htmlFor="remember-me" className="ml-2 block text-sm text-gray-900">
记住我
{t('pages.login.form.checkbox.rememberme')}
</label>
</div>

<div className="text-sm">
{/* <div className="text-sm">
<Tooltip title="请联系管理员">
<a href="#" className="font-medium text-indigo-600 hover:text-indigo-500">
忘记密码?
{t('pages.login.label.forget-password')}
</a>
</Tooltip>
</div>
</div> */}
</div>

<Button
Expand All @@ -139,7 +147,7 @@ const Login: React.FC<IProps> = (props) => {
onClick={loginStore.onSubmit}
disabled={loginStore.isInValid}
>
登录
{t('pages.login.form.button.signin')}
</Button>
</form>
{/* <!-- login form end --> */}
Expand Down

0 comments on commit 64cc3eb

Please sign in to comment.