refactor and add i18n, to be continue

pull/680/head
Ben Stone 2021-03-30 18:37:24 +08:00
parent 1239620f75
commit 6cf68605bf
4 changed files with 21 additions and 17 deletions

View File

@ -24,6 +24,7 @@ dingtalk_login = DingTalk QrCode login
account_recovery = Account recovery
new_password = New password
confirm_password = Confirm password
new_account = Create New Account
[message]
keyword_placeholder = input keyword please...
@ -32,6 +33,7 @@ click_to_change = Click to change one
logging_in = logging in...
return_account_login = Return account password login
no_account_yet = No account yet?
has_account = Already have an account?
account_empty = Account cannot be empty
email_empty = Email cannot be empty
password_empty = Password cannot be empty

View File

@ -24,6 +24,7 @@ dingtalk_login = 扫码登录
account_recovery = 找回密码
new_password = 新密码
confirm_password = 确认密码
new_account = 用户注册
[message]
keyword_placeholder = 请输入关键词...
@ -32,6 +33,7 @@ click_to_change = 点击换一张
logging_in = 正在登录...
return_account_login = 返回账号密码登录
no_account_yet = 还没有账号?
has_account = 已有账号?
account_empty = 账号不能为空
email_empty = 邮箱不能为空
password_empty = 密码不能为空

View File

@ -78,7 +78,7 @@
{{if .ENABLED_REGISTER}}
{{if ne .ENABLED_REGISTER "false"}}
<div class="form-group">
{{i18n .Lang "message.no_account_yet"}}<a href="{{urlfor "AccountController.Register" }}" title={{i18n .Lang "common.register"}}>{{i18n .Lang "common.register"}}</a>
{{i18n .Lang "message.no_account_yet"}} <a href="{{urlfor "AccountController.Register" }}" title={{i18n .Lang "common.register"}}>{{i18n .Lang "common.register"}}</a>
</div>
{{end}}
{{end}}

View File

@ -6,8 +6,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="SmartWiki" />
<title>用户注册 - Powered by MinDoc</title>
<meta name="author" content="MinDoc" />
<title>{{i18n .Lang "common.new_account"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
@ -35,13 +35,13 @@
<div class="login-body">
<form role="form" method="post" id="registerForm">
{{ .xsrfdata }}
<h3 class="text-center">用户注册</h3>
<h3 class="text-center">{{i18n .Lang "common.new_account"}}</h3>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-user"></i>
</div>
<input type="text" class="form-control" placeholder="用户名" name="account" id="account" autocomplete="off">
<input type="text" class="form-control" placeholder="{{i18n .Lang "common.username"}}" name="account" id="account" autocomplete="off">
</div>
</div>
<div class="form-group">
@ -49,7 +49,7 @@
<div class="input-group-addon">
<i class="fa fa-lock"></i>
</div>
<input type="password" class="form-control" placeholder="密码" name="password1" id="password1" autocomplete="off">
<input type="password" class="form-control" placeholder="{{i18n .Lang "common.password"}}" name="password1" id="password1" autocomplete="off">
</div>
</div>
<div class="form-group">
@ -57,13 +57,13 @@
<div class="input-group-addon">
<i class="fa fa-lock"></i>
</div>
<input type="password" class="form-control" placeholder="确认密码" name="password2" id="password2" autocomplete="off">
<input type="password" class="form-control" placeholder="{{i18n .Lang "common.confirm_password"}}" name="password2" id="password2" autocomplete="off">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon" style="padding: 6px 9px;"><i class="fa fa-envelope"></i></div>
<input type="email" class="form-control" placeholder="用户邮箱" name="email" id="email" autocomplete="off">
<input type="email" class="form-control" placeholder="{{i18n .Lang "common.email"}}" name="email" id="email" autocomplete="off">
</div>
</div>
@ -72,18 +72,18 @@
<div class="input-group-addon">
<i class="fa fa-check-square"></i>
</div>
<input type="text" name="code" id="code" class="form-control" style="width: 150px" maxlength="5" placeholder="验证码" autocomplete="off">&nbsp;
<input type="text" name="code" id="code" class="form-control" style="width: 150px" maxlength="5" placeholder="{{i18n .Lang "common.captcha"}}" autocomplete="off">&nbsp;
</div>
<img id="captcha-img" style="width: 140px;height: 40px;display: inline-block;float: right" src="{{urlfor "AccountController.Captcha"}}" onclick="this.src='{{urlfor "AccountController.Captcha"}}?key=login&t='+(new Date()).getTime();" title="点击换一张">
<img id="captcha-img" style="width: 140px;height: 40px;display: inline-block;float: right" src="{{urlfor "AccountController.Captcha"}}" onclick="this.src='{{urlfor "AccountController.Captcha"}}?key=login&t='+(new Date()).getTime();" title="{{i18n .Lang "message.click_to_change"}}">
<div class="clearfix"></div>
</div>
<div class="form-group">
<button type="submit" id="btnRegister" class="btn btn-success" style="width: 100%" data-loading-text="正在注册..." autocomplete="off">立即注册</button>
<button type="submit" id="btnRegister" class="btn btn-success" style="width: 100%" data-loading-text="{{i18n .Lang "message.processing"}}" autocomplete="off">{{i18n .Lang "common.register"}}</button>
</div>
{{if ne .ENABLED_REGISTER "false"}}
<div class="form-group">
已有账号?<a href="{{urlfor "AccountController.Login" }}" title="立即登录">立即登录</a>
{{i18n .Lang "message.has_account"}} <a href="{{urlfor "AccountController.Login" }}" title="{{i18n .Lang "common.login"}}">{{i18n .Lang "common.login"}}</a>
</div>
{{end}}
</form>
@ -117,28 +117,28 @@
var email = $.trim($("#email").val());
if(account === ""){
$("#account").focus().tooltip({placement:"auto",title : "账号不能为空",trigger : 'manual'})
$("#account").focus().tooltip({placement:"auto",title : "{{i18n .Lang "message.account_empty"}}",trigger : 'manual'})
.tooltip('show')
.parents('.form-group').addClass('has-error');
return false;
}else if(password === ""){
$("#password").focus().tooltip({title : '密码不能为空',trigger : 'manual'})
$("#password").focus().tooltip({title : '{{i18n .Lang "message.password_empty"}}',trigger : 'manual'})
.tooltip('show')
.parents('.form-group').addClass('has-error');
return false;
}else if(confirmPassword !== password){
$("#confirm_password").focus().tooltip({title : '确认密码不正确',trigger : 'manual'})
$("#confirm_password").focus().tooltip({title : '{{i18n .Lang "message.confirm_password_empty"}}',trigger : 'manual'})
.tooltip('show')
.parents('.form-group').addClass('has-error');
return false;
}else if(email === ""){
$("#email").focus().tooltip({title : '邮箱不能为空',trigger : 'manual'})
$("#email").focus().tooltip({title : '{{i18n .Lang "message.email_empty"}}',trigger : 'manual'})
.tooltip('show')
.parents('.form-group').addClass('has-error');
return false;
}else if(code !== undefined && code === ""){
$("#code").focus().tooltip({title : '验证码不能为空',trigger : 'manual'})
$("#code").focus().tooltip({title : '{{i18n .Lang "message.captcha_empty"}}',trigger : 'manual'})
.tooltip('show')
.parents('.form-group').addClass('has-error');
return false;