Skip to content

Commit de58a21

Browse files
chore(i18n): translate all the pug files from chinese
1 parent 57a6e98 commit de58a21

File tree

7 files changed

+38
-22
lines changed

7 files changed

+38
-22
lines changed

locales/cn.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

locales/en.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"请登录": "Please sign in",
3+
"邮箱地址": "email address",
4+
"用户名": "username",
5+
"密码": "password",
6+
"记住我": "Remember me",
7+
"登录": "Log in",
8+
"热更新服务器": "hot update server",
9+
"修改密码": "Change Password",
10+
"获取": "Obtain",
11+
"原密码": "old password",
12+
"新密码": "new password",
13+
"请重新登录": "please login again"
14+
}

src/routes/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import express from 'express';
22
import { AppError } from '../core/app-error';
3+
import { i18n } from "../core/i81n"
34
import { checkToken, Req } from '../core/middleware';
45
import { clientManager } from '../core/services/client-manager';
56

@@ -10,7 +11,7 @@ indexRouter.get('/', (req, res) => {
1011
});
1112

1213
indexRouter.get('/tokens', (req, res) => {
13-
res.render('tokens', { title: '获取token' });
14+
res.render('tokens', { title: `${i18n.__('获取')} token` });
1415
});
1516

1617
indexRouter.get(

views/auth/login.pug

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ block css
55
block content
66
.container
77
form#form.form-signin(method="post")
8-
h2.form-signin-heading 请登录
9-
label.sr-only(for="inputEmail") 邮箱地址用户名
10-
input#inputEmail.form-control(type="text" name="account" placeholder="邮箱地址用户名" required autofocus)
11-
label.sr-only(for="inputPassword") 密码
12-
input#inputPassword.form-control(type="password" name="password" placeholder="密码" required)
8+
h2.form-signin-heading #{__('请登录')}
9+
label.sr-only(for="inputEmail") #{__('邮箱地址')}#{__('用户名')}
10+
input#inputEmail.form-control(type="text" name="account" placeholder=`${__('邮箱地址')}${__('用户名')}` required autofocus)
11+
label.sr-only(for="inputPassword") #{__('密码')}
12+
input#inputPassword.form-control(type="password" name="password" placeholder=`${__('密码')}` required)
1313
.checkbox
1414
label
1515
input(type="checkbox" value="remember-me")
16-
span 记住我
17-
a#submitBtn.btn.btn-lg.btn-primary.btn-block 登录
16+
span #{__('记住我')}
17+
a#submitBtn.btn.btn-lg.btn-primary.btn-block #{__('登录')}
1818

1919
block js
2020
script().

views/auth/password.pug

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ block content
44
.container(style="margin-top:30px;")
55
form#form.col-md-5.col-md-offset-3(method="post")
66
.form-group
7-
label.sr-only(for="inputEmail") 邮箱地址用户名
8-
input#inputEmail.form-control(type="text" name="account" placeholder="邮箱地址用户名" required autofocus)
7+
label.sr-only(for="inputEmail") #{__('邮箱地址')}#{__('用户名')}
8+
input#inputEmail.form-control(type="text" name="account" placeholder=`${__('邮箱地址')}${__('用户名')}` required autofocus)
99
.form-group
1010
.col-md-10(style="margin-left:-15px;")
1111
label.sr-only(for="inputToken") token
1212
input#inputToken.form-control(type="text" name="token" placeholder="token" required)
1313
.col-md-2
14-
a.form-control.btn.btn-link(style="margin-bottom:15px;" target="_blank" href="/auth/login") 获取token
14+
a.form-control.btn.btn-link(style="margin-bottom:15px;" target="_blank" href="/auth/login") #{__('获取')} token
1515
.form-group
16-
label.sr-only(for="inputPassword") 原密码
17-
input#inputPassword.form-control(type="password" name="oldPassword" placeholder="原密码" required)
16+
label.sr-only(for="inputPassword") #{__('原密码')}
17+
input#inputPassword.form-control(type="password" name="oldPassword" placeholder=`${__('原密码')}` required)
1818
.form-group
19-
label.sr-only(for="inputNewPassword") 新密码
20-
input#inputNewPassword.form-control(type="password" name="newPassword" placeholder="新密码" required)
19+
label.sr-only(for="inputNewPassword") #{__('新密码')}
20+
input#inputNewPassword.form-control(type="password" name="newPassword" placeholder=`${__('新密码')}` required)
2121
.form-group
22-
a#submitBtn.btn.btn-lg.btn-primary.btn-block 修改密码
22+
a#submitBtn.btn.btn-lg.btn-primary.btn-block #{__('修改密码')}
2323

2424
block js
2525
script().
@@ -43,7 +43,7 @@ block js
4343
dataType: 'json',
4444
success: function (data) {
4545
if (data.status == "OK") {
46-
alert("修改成功");
46+
alert(`${__('修改成功')}`);
4747
location.href = '/auth/login';
4848
} else if (data.status == 401) {
4949
alert('token invalid');

views/index.pug

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ block css
33
link(rel='stylesheet', href='/stylesheets/index.css')
44

55
block content
6-
.site-notice react naitve 热更新服务器
6+
.site-notice react native / cordova #{__('热更新服务器')}
77
h1(style="text-align: center;")= title
88
p(style="text-align: center;") Welcome to #{title}
99
.site-notice
10-
a.btn.btn-primary(href="/auth/login" type="button") 登录
11-
a.btn.btn-primary.col-md-offset-1(href="/auth/password" type="button") 修改密码
10+
a.btn.btn-primary(href="/auth/login" type="button") #{__('登录')}
11+
a.btn.btn-primary.col-md-offset-1(href="/auth/password" type="button") #{__('修改密码')}

views/tokens.pug

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ block css
55
block content
66
h1(style="text-align: center;")= title
77
.site-notice
8-
a#submitBtn.btn.btn-lg.btn-primary 获取token
8+
a#submitBtn.btn.btn-lg.btn-primary #{__('获取')} token
99
.form-group
1010
#tipsSuccess(style="display:none")
1111
h2(style="text-align: center;") Authentication succeeded.
@@ -68,7 +68,7 @@ block js
6868
error: function(XMLHttpRequest, textStatus, errorThrown) {
6969
submit = false;
7070
if (errorThrown == 'Unauthorized') {
71-
alert('请重新登录!');
71+
alert(`#{__('请重新登录')}!`);
7272
location.href = '/auth/login'
7373
}else {
7474
alert(errorThrown);

0 commit comments

Comments
 (0)