i18n translate

This commit is contained in:
jysperm
2014-10-06 03:03:34 +08:00
parent 97efbcf616
commit 2455082ab6
12 changed files with 157 additions and 110 deletions

View File

@@ -18,7 +18,19 @@
"success": "成功",
"save": "保存",
"apply": "使用",
"change": "修改"
"change": "修改",
"charge": "充值",
"enable": "启用",
"disable": "禁用",
"time": "时间",
"amount": "金额",
"actions": "操作",
"details": "详情",
"type": "类型",
"generate": "生成",
"id": "ID",
"close": "关闭",
"create": "创建"
},
"languages": {
"zh_CN": "简体中文",
@@ -58,14 +70,21 @@
"creator": "创建者",
"members": "成员"
},
"ticket_status": {
"closed": "已关闭",
"open": "开放的",
"pending": "等待处理",
"finish": "已完成",
"related": "与我相关"
},
"plan": {
"": "套餐",
"subscribe": "订购",
"unsubscribe": "退订",
"": "付费方案",
"join": "订购方案",
"leave": "退订方案",
"balance": "余额",
"remaining_time": "剩余时长",
"currency": {
"cny": "CNY"
"CNY": "CNY"
}
},
"admin": {
@@ -99,6 +118,27 @@
"update_email": "修改邮箱",
"current_email": "当前邮箱",
"new_email": "新邮箱"
},
"panel": {
"billing": "财务",
"service_switch": "服务开关"
},
"pay": {
"pay_log": "充值记录",
"pay_method": "方式",
"billing_log": "扣费记录"
},
"admin": {
"account_list": "用户列表",
"coupon_code": "兑换代码",
"confirm_payment": "确认充值",
"delete_account": "删除账户",
"expired": "过期时间",
"empty_expired_tips": "留空表示无限制",
"available_times": "可用次数",
"count": "数量",
"meta": "参数",
"order_id": "订单号"
}
},
"plugins": {}

View File

@@ -14,8 +14,8 @@ exports.get '/register', renderAccount, (req, res) ->
exports.get '/login', renderAccount, (req, res) ->
res.render 'account/login'
exports.get '/setting', requireAuthenticate, renderAccount, (req, res) ->
res.render 'account/setting'
exports.get '/preferences', requireAuthenticate, renderAccount, (req, res) ->
res.render 'account/preferences'
exports.post '/register', errorHandling, (req, res) ->
unless utils.rx.username.test req.body.username

View File

@@ -58,8 +58,8 @@ exports.get '/ticket', requireAdminAuthenticate, renderAccount, (req, res) ->
finish: result.finish
closed: result.closed
exports.post '/create_payment', requireAdminAuthenticate, (req, res) ->
mAccount.findId req.body.account_id, (err, account) ->
exports.post '/confirm_payment', requireAdminAuthenticate, (req, res) ->
mAccount.findOne {_id: req.body.account_id}, (err, account) ->
unless account
return res.error 'account_not_exist'

View File

@@ -1,7 +1,7 @@
$ ->
$('.action-create-payment').click ->
$('#account_id').html $(@).parents('tr').data 'id'
$('#create-payment-modal').modal 'show'
$('#tab-account-list .action-confirm-payment').click ->
$('.confirm-payment-modal .input-account-id').html $(@).parents('tr').data 'id'
$('.confirm-payment-modal').modal 'show'
$('.action-delete-account').click (e) ->
e.preventDefault()
@@ -26,18 +26,13 @@ $ ->
.success ->
location.reload()
$('#create-payment-modal .action-create-payment').click ->
$.post '/admin/create_payment/', JSON.stringify
account_id: $('#account_id').html()
$('.confirm-payment-modal .action-confirm-payment').click ->
request '/admin/confirm_payment/',
account_id: $('.input-account-id').test()
type: 'taobao'
amount: $('#amont').val()
order_id: $('#order_id').val()
.fail (jqXHR) ->
if jqXHR.responseJSON?.error
alert jqXHR.responseJSON.error
else
alert jqXHR.statusText
.success ->
amount: $('input-amount').val()
order_id: $('input-order-id').val()
, ->
location.reload()
$('.action-generate-code').click ->

View File

@@ -31,11 +31,14 @@ $ ->
language = $(@).data 'language'
$.cookie 'language', language, expires: 365
$.cookie 'language', language,
expires: 365
path: '/'
$('.label-language').text language
if $('body').data 'username'
request '/account/update_settings/',
request '/account/update_preferences/',
language: language
, ->
location.reload()

View File

@@ -10,9 +10,9 @@ block main
.row
ul.nav.nav-tabs(role='tablist')
li.active
a(href='#tab-account-list', data-toggle='tab') 用户列表
a(href='#tab-account-list', data-toggle='tab')= t('view.admin.account_list')
li
a(href='#tab-coupon-code', data-toggle='tab') 兑换代码
a(href='#tab-coupon-code', data-toggle='tab')= t('view.admin.coupon_code')
.tab-content
#tab-account-list.tab-pane.active
@@ -21,9 +21,9 @@ block main
tr
th= t('account.username')
th= t('account.email')
th 套餐
th 余额
th 操作
th= t('plan.')
th= t('common.amount')
th= t('common.actions')
tbody
for account in accounts
tr(data-id='#{account._id}')
@@ -32,74 +32,74 @@ block main
td= account.billing.plans.join(', ')
td= account.billing.balance.toFixed(2)
td
button.btn.btn-info.btn-sm(type='button') 详情
button.btn.btn-info.btn-sm(type='button')= t('common.details')
.btn-group
button(type='button', data-toggle='dropdown').btn.btn-primary.btn-sm.dropdown-toggle
| 操作  
| #{t('common.actions')}  
span.caret
ul.dropdown-menu
li
a.action-create-payment(href='#') 创建充值记录
a.action-create-payment(href='#')= t('view.admin.confirm_payment')
if account.billing.balance <= 0 && account.billing.plans.length == 0
li
a.action-delete-account(href='#') 删除账户
a.action-delete-account(href='#')= t('view.admin.delete_account')
#tab-coupon-code.tab-pane
form.form-horizontal
.form-group
label.col-sm-2.control-label 过期时间
label.col-sm-2.control-label= t('view.admin.expired')
.col-sm-5
input.input-expired.form-control(type='text', placeholder='Empty for no limit')
input.input-expired.form-control(type='text', placeholder=t('view.admin.empty_expired_tips'))
.form-group
label.col-sm-2.control-label 可用次数
label.col-sm-2.control-label= t('view.admin.available_times')
.col-sm-5
input.input-available_times.form-control(type='text', value='1')
.form-group
label.col-sm-2.control-label 类型
label.col-sm-2.control-label= t('common.type')
.col-sm-5
select.input-type.form-control
for type in coupon_code_types
option= type
.form-group
label.col-sm-2.control-label 数量
label.col-sm-2.control-label= t('view.admin.count')
.col-sm-5
input.input-count.form-control(type='text', value='1')
.form-group
label.col-sm-2.control-label meta
label.col-sm-2.control-label= t('view.admin.meta')
.col-sm-5
input.input-meta.form-control(type='text', value='{"amount": 5, "category": "2014"}')
.form-group
label.col-sm-2.control-label
.col-sm-5
button.action-generate-code.btn.btn-lg.btn-primary(type='button') 生成
button.action-generate-code.btn.btn-lg.btn-primary(type='button')= t('common.generate')
.output-coupon-code
#create-payment-modal.modal.fade
.confirm-payment-modal.modal.fade
.modal-dialog
.modal-content
.modal-header
button.close(type='button', data-dismiss='modal', aria-hidden='true') &times;
h4.modal-title 创建充值记录
h4.modal-title= t('view.admin.confirm_payment')
.modal-body
form.form-horizontal(method='post', role='form')
.form-group
label.col-sm-2.col-md-offset-1.control-label(for='account_id') ID
label.col-sm-2.col-md-offset-1.control-label= t('common.id')
.col-sm-5
p#account_id.form-control-static
p.input-account-id.form-control-static
.form-group
label.col-sm-2.col-md-offset-1.control-label(for='amont') 金额
label.col-sm-2.col-md-offset-1.control-label= t('common.amount')
.col-sm-5
input#amont.form-control(type='text', name='amont', required)
input.input-amont.form-control(type='text')
.form-group
label.col-sm-2.col-md-offset-1.control-label(for='order_id') 订单号
label.col-sm-2.col-md-offset-1.control-label= t('view.admin.order_id')
.col-sm-5
input#order_id.form-control(type='order_id', name='order_id', required)
input.input-order-id.form-control(type='order_id')
.modal-footer
button.btn.btn-danger(type='button', data-dismiss='modal') 关闭
button.btn.btn-success.action-create-payment(type='button') 创建
button.btn.btn-danger(type='button', data-dismiss='modal')= t('common.close')
button.btn.btn-success.action-confirm-payment(type='button')= t('common.create')
prepend sidebar
.row

View File

@@ -31,7 +31,7 @@ html
ul.nav.navbar-nav.navbar-right
if account
li
a(href='/account/setting/')= account.username
a(href='/account/preferences/')= account.username
li
a(href='/panel/')= t('panel.')
if app.models.mAccount.inGroup(account, 'root')

View File

@@ -10,13 +10,13 @@ append header
block main
.row
header 财务
p #{t('plan.balance')}: #{account.billing.balance.toFixed(2)} #{t('plan.currency.cny')}
header= t('view.panel.billing')
p #{t('plan.balance')}: #{account.billing.balance.toFixed(2)} #{t('plan.currency.' + config.billing.currency)}
p
a(href= '/panel/pay/').btn.btn-success 充值
a(href= '/panel/pay/').btn.btn-success= t('common.charge')
.row
header 付费方案
header= t('plan.')
table.table.table-hover.plan-list
tbody
for plan in plans
@@ -26,18 +26,18 @@ block main
td= t(plan.t_description)
td
if plan.is_enable
button.action-leave-plan.btn.btn-danger.btn-sm 退订方案
button.action-leave-plan.btn.btn-danger.btn-sm= t('plan.join')
else
button.action-join-plan.btn.btn-success.btn-sm 订购方案
button.action-join-plan.btn.btn-success.btn-sm= t('plan.leave')
if selectHook('view.panel.switch_buttons').length
#service-switch.row
header 服务开关
header= t('view.panel.service_switch')
for hook in selectHook('view.panel.switch_buttons')
if account.attribute.plugin[hook.name].is_enable
button(data-name=hook.name).btn.btn-danger 关闭 #{t('plugins.' + hook.name + '.name')}
button(data-name=hook.name).btn.btn-danger #{t('common.disable')} #{t('plugins.' + hook.name + '.name')}
else
button(data-name=hook.name).btn.btn-success 开启 #{t('plugins.' + hook.name + '.name')}
button(data-name=hook.name).btn.btn-success #{t('common.enable')} #{t('plugins.' + hook.name + '.name')}
for widget_html in widgets_html
!= widget_html

View File

@@ -1,31 +1,31 @@
extends ../layout
prepend header
title 充值 | #{config.web.name}
title #{t('common.charge')} | #{config.web.name}
append header
link(rel='stylesheet', href='/style/panel/pay.css')
block main
.row
header 充值
header= t('common.charge')
for payment_method in payment_methods
!= payment_method
.row
header 充值记录
header= t('view.pay.pay_log')
table.table.table-hover
thead
tr
th 时间
th 金额
th 方式
th= t('common.time')
th= t('common.amount')
th= t('view.pay.pay_method')
tbody
for item in deposit_log
tr
td= moment(item.created_at).format('YYYY-MM-DD HH:mm:ss')
td #{item.amount.toFixed(2)} CNY
td #{item.amount.toFixed(2)} #{t('plan.currency.' + config.billing.currency)}
if item.attribute.type == 'taobao'
td 淘宝支付 订单号:#{item.attribute.order_id}
else if item.attribute.type == 'bitcoin'
@@ -36,13 +36,12 @@ block main
td #{item.attribute.type} #{item.attribute.order_id}
.row
header 扣费记录
header= t('view.pay.billing_log')
table.table.table-hover
thead
tr
td 时间
td 金额
td 摘要
td= t('common.time')
td= t('common.amount')
tbody
for item in billing_log
tr

View File

@@ -1,30 +1,21 @@
extends ../layout
mixin displayTicketStatus(status)
if status == 'closed'
span.text-muted 已关闭
else if status == 'open'
span.text-primary 开放的
else if status == 'pending'
span.text-warning 等待处理
else if status == 'finish'
span.text-success 已完成
mixin displayTicketStatus(t_status)
- status = t('ticket_status.' + t_status)
if t_status == 'closed'
span.text-muted= status
else if t_status == 'open'
span.text-primary= status
else if t_status == 'pending'
span.text-warning= status
else if t_status == 'finish'
span.text-success= status
else
| #{status}
mixin showTickets(tickets)
for ticket in tickets
tr(data-id= '#{ticket._id}')
td
a(href='/ticket/view/?id=#{ticket._id}')= ticket.title
td
mixin displayTicketStatus(ticket.status)
prepend header
title #{t('ticket.ticket_list')} | #{config.web.name}
block main
header= t('ticket.ticket_list')
mixin displayTicketsTable(t_status, tickets)
h4= t('ticket_status.' + t_status)
table.table.table-hover
thead
@@ -32,24 +23,37 @@ block main
th= t('ticket.title')
th= t('ticket.status')
tbody
if tickets
mixin showTickets(tickets)
for ticket in tickets
tr(data-id='#{ticket._id}')
td
a(href='/ticket/view/?id=#{ticket._id}')= ticket.title
td
mixin displayTicketStatus(ticket.status)
if pending
mixin showTickets(pending)
prepend header
title #{t('ticket.ticket_list')} | #{config.web.name}
if open
mixin showTickets(open)
block main
header= t('ticket.ticket_list')
if finish
mixin showTickets(finish)
if tickets
mixin displayTicketsTable('related', tickets)
if closed
mixin showTickets(closed)
if pending && pending.length
mixin displayTicketsTable('pending', pending)
if open && open.length
mixin displayTicketsTable('open', open)
if finish && finish.length
mixin displayTicketsTable('finish', finish)
if closed && closed.length
mixin displayTicketsTable('closed', closed)
prepend sidebar
.row
if tickets
a.btn.btn-lg.btn-success(href='/ticket/create/')= t('ticket.create_ticket')
else
a.btn.btn-lg.btn-success(href='/admin/ticket/') 工单列表
a.btn.btn-lg.btn-success(href='/admin/ticket/')= t('ticket.ticket_list')

View File

@@ -10,14 +10,17 @@ block main
.row.content(data-id='#{ticket._id}')
header
| #{ticket.title} &nbsp;
- status = t('ticket_status.' + t_status)
if ticket.status == 'closed'
span.small.text-muted 已关闭
span.small.text-muted= status
else if ticket.status == 'open'
span.small.text-primary 开放的
span.small.text-primary= status
else if ticket.status == 'pending'
span.small.text-warning 等待处理
span.small.text-warning= status
else if ticket.status == 'finish'
span.small.text-success 已完成
span.small.text-success= status
p!= ticket.content_html
@@ -45,7 +48,7 @@ block main
textarea.form-control.input-content(rows='5')
.form-group.padding
if ticket.status == 'closed'
button(disabled).btn.btn-lg.btn-primary 已关闭
button(disabled).btn.btn-lg.btn-primary= t('ticket_status.closed')
else
button.btn.btn-lg.btn-primary.action-reply(type='button')= t('ticket.create_reply')
button(type='button', data-status='closed').btn.btn-lg.btn-danger.action-update-status= t('ticket.close_ticket')

View File

@@ -0,0 +1,3 @@
{
"site_name": "RP Virtual Hosting"
}