fix: 修改翻译 (#7526)

* fix: 修改翻译

* fix: 修改保存数据库翻译

* fix: 修复翻译为none问题

Co-authored-by: feng626 <1304903146@qq.com>
Co-authored-by: Jiangjie.Bai <32935519+BaiJiangJie@users.noreply.github.com>
pull/7527/head
fit2bot 2022-01-18 19:31:01 +08:00 committed by GitHub
parent 8d6498c8f0
commit 0b16d70c0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 87 additions and 60 deletions

View File

@ -0,0 +1,14 @@
from django.utils.translation import gettext
def translate_value(value):
if not value:
return value
sps = ['. ', ': ']
spb = {str(sp in value): sp for sp in sps}
sp = spb.get('True')
if not sp:
return value
tpl, data = value.split(sp, 1)
return gettext(tpl + sp) + data

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f5da08d38cfcbeb214b02eed26a9bdd0cd3bb3ff00ce0613ad940a2900dc7c95
size 96832
oid sha256:bc12c498651ddc7b1750389f65c4fe6d48d9dbe0fad3f63b7066cb82ef7e223a
size 97032

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: JumpServer 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-18 14:20+0800\n"
"POT-Creation-Date: 2022-01-18 18:31+0800\n"
"PO-Revision-Date: 2021-05-20 10:54+0800\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: JumpServer team<ibuler@qq.com>\n"
@ -57,11 +57,11 @@ msgstr "激活中"
#: assets/models/cluster.py:29 assets/models/cmd_filter.py:44
#: assets/models/cmd_filter.py:87 assets/models/domain.py:25
#: assets/models/domain.py:65 assets/models/group.py:23
#: assets/models/label.py:23 ops/models/adhoc.py:37 orgs/models.py:27
#: assets/models/label.py:23 ops/models/adhoc.py:38 orgs/models.py:27
#: perms/models/base.py:93 settings/models.py:34 terminal/models/storage.py:26
#: terminal/models/terminal.py:114 tickets/models/ticket.py:75
#: users/models/group.py:16 users/models/user.py:585
#: xpack/plugins/change_auth_plan/models/base.py:41
#: xpack/plugins/change_auth_plan/models/base.py:44
#: xpack/plugins/cloud/models.py:35 xpack/plugins/cloud/models.py:113
#: xpack/plugins/gathered_user/models.py:26
msgid "Comment"
@ -162,7 +162,7 @@ msgstr "格式为逗号分隔的字符串, * 表示匹配所有. "
#: authentication/forms.py:15 authentication/forms.py:17
#: authentication/templates/authentication/_msg_different_city.html:9
#: authentication/templates/authentication/_msg_oauth_bind.html:9
#: ops/models/adhoc.py:159 users/forms/profile.py:31 users/models/user.py:547
#: ops/models/adhoc.py:154 users/forms/profile.py:31 users/models/user.py:547
#: users/templates/users/_msg_user_created.html:12
#: users/templates/users/_select_user_modal.html:14
#: xpack/plugins/change_auth_plan/models/asset.py:34
@ -353,7 +353,7 @@ msgstr "类型名称"
#: assets/models/domain.py:27 assets/models/gathered_user.py:19
#: assets/models/group.py:22 assets/models/label.py:25
#: assets/serializers/account.py:17 common/db/models.py:113
#: common/mixins/models.py:50 ops/models/adhoc.py:38 ops/models/command.py:29
#: common/mixins/models.py:50 ops/models/adhoc.py:39 ops/models/command.py:29
#: orgs/models.py:26 orgs/models.py:435 perms/models/base.py:92
#: users/models/group.py:18 users/models/user.py:783
#: xpack/plugins/cloud/models.py:122
@ -362,7 +362,7 @@ msgstr "创建日期"
#: applications/serializers/application.py:104 assets/models/base.py:182
#: assets/models/gathered_user.py:20 assets/serializers/account.py:20
#: common/db/models.py:114 common/mixins/models.py:51 ops/models/adhoc.py:39
#: common/db/models.py:114 common/mixins/models.py:51 ops/models/adhoc.py:40
#: orgs/models.py:436
msgid "Date updated"
msgstr "更新日期"
@ -378,7 +378,7 @@ msgid "Cluster"
msgstr "集群"
#: applications/serializers/attrs/application_category/db.py:11
#: ops/models/adhoc.py:157 settings/serializers/auth/radius.py:14
#: ops/models/adhoc.py:152 settings/serializers/auth/radius.py:14
#: xpack/plugins/cloud/serializers/account_attrs.py:68
msgid "Host"
msgstr "主机"
@ -441,7 +441,7 @@ msgstr "自定义用户名"
#: applications/serializers/attrs/application_type/custom.py:23
#: applications/serializers/attrs/application_type/custom.py:30
#: xpack/plugins/change_auth_plan/models/base.py:24
#: xpack/plugins/change_auth_plan/models/base.py:27
msgid "Custom password"
msgstr "自定义密码"
@ -599,7 +599,7 @@ msgstr "标签管理"
#: common/db/models.py:111 common/mixins/models.py:49 orgs/models.py:25
#: orgs/models.py:437 perms/models/base.py:91 users/models/user.py:593
#: users/serializers/group.py:33
#: xpack/plugins/change_auth_plan/models/base.py:45
#: xpack/plugins/change_auth_plan/models/base.py:48
#: xpack/plugins/cloud/models.py:119 xpack/plugins/gathered_user/models.py:30
msgid "Created by"
msgstr "创建者"
@ -625,12 +625,12 @@ msgid "Account backup plan"
msgstr "账户备份计划"
#: assets/models/backup.py:100
#: xpack/plugins/change_auth_plan/models/base.py:104
#: xpack/plugins/change_auth_plan/models/base.py:107
msgid "Manual trigger"
msgstr "手动触发"
#: assets/models/backup.py:101
#: xpack/plugins/change_auth_plan/models/base.py:105
#: xpack/plugins/change_auth_plan/models/base.py:108
msgid "Timing trigger"
msgstr "定时触发"
@ -638,17 +638,17 @@ msgstr "定时触发"
#: perms/models/base.py:89 terminal/models/session.py:54
#: tickets/serializers/ticket/meta/ticket_type/apply_application.py:55
#: tickets/serializers/ticket/meta/ticket_type/apply_asset.py:57
#: xpack/plugins/change_auth_plan/models/base.py:109
#: xpack/plugins/change_auth_plan/models/base.py:200
#: xpack/plugins/change_auth_plan/models/base.py:112
#: xpack/plugins/change_auth_plan/models/base.py:203
#: xpack/plugins/gathered_user/models.py:76
msgid "Date start"
msgstr "开始日期"
#: assets/models/backup.py:108
#: authentication/templates/authentication/_msg_oauth_bind.html:11
#: notifications/notifications.py:187 ops/models/adhoc.py:257
#: xpack/plugins/change_auth_plan/models/base.py:112
#: xpack/plugins/change_auth_plan/models/base.py:201
#: notifications/notifications.py:187 ops/models/adhoc.py:252
#: xpack/plugins/change_auth_plan/models/base.py:115
#: xpack/plugins/change_auth_plan/models/base.py:204
#: xpack/plugins/gathered_user/models.py:79
msgid "Time"
msgstr "时间"
@ -658,22 +658,22 @@ msgid "Account backup snapshot"
msgstr "账号备份快照"
#: assets/models/backup.py:116 assets/serializers/backup.py:40
#: xpack/plugins/change_auth_plan/models/base.py:122
#: xpack/plugins/change_auth_plan/models/base.py:125
#: xpack/plugins/change_auth_plan/serializers/base.py:73
msgid "Trigger mode"
msgstr "触发模式"
#: assets/models/backup.py:119 audits/models.py:116
#: terminal/models/sharing.py:88
#: xpack/plugins/change_auth_plan/models/base.py:198
#: xpack/plugins/change_auth_plan/models/base.py:201
#: xpack/plugins/cloud/models.py:176
msgid "Reason"
msgstr "原因"
#: assets/models/backup.py:121 audits/serializers.py:79
#: audits/serializers.py:94 ops/models/adhoc.py:259
#: assets/models/backup.py:121 audits/serializers.py:76
#: audits/serializers.py:91 ops/models/adhoc.py:254
#: terminal/serializers/session.py:35
#: xpack/plugins/change_auth_plan/models/base.py:199
#: xpack/plugins/change_auth_plan/models/base.py:202
msgid "Is success"
msgstr "是否成功"
@ -710,9 +710,9 @@ msgstr "校验日期"
#: users/templates/users/_msg_user_created.html:13
#: users/templates/users/user_password_update.html:43
#: users/templates/users/user_password_verify.html:18
#: xpack/plugins/change_auth_plan/models/base.py:39
#: xpack/plugins/change_auth_plan/models/base.py:118
#: xpack/plugins/change_auth_plan/models/base.py:193
#: xpack/plugins/change_auth_plan/models/base.py:42
#: xpack/plugins/change_auth_plan/models/base.py:121
#: xpack/plugins/change_auth_plan/models/base.py:196
#: xpack/plugins/cloud/serializers/account_attrs.py:24
msgid "Password"
msgstr "密码"
@ -2592,60 +2592,60 @@ msgstr ""
msgid "Unit: hour"
msgstr "单位: 时"
#: ops/models/adhoc.py:35
#: ops/models/adhoc.py:36
msgid "Callback"
msgstr "回调"
#: ops/models/adhoc.py:154
#: ops/models/adhoc.py:149
msgid "Tasks"
msgstr "任务"
#: ops/models/adhoc.py:155
#: ops/models/adhoc.py:150
msgid "Pattern"
msgstr "模式"
#: ops/models/adhoc.py:156
#: ops/models/adhoc.py:151
msgid "Options"
msgstr "选项"
#: ops/models/adhoc.py:158
#: ops/models/adhoc.py:153
msgid "Run as admin"
msgstr "再次执行"
#: ops/models/adhoc.py:161
#: ops/models/adhoc.py:156
msgid "Become"
msgstr "Become"
#: ops/models/adhoc.py:162
#: ops/models/adhoc.py:157
msgid "Create by"
msgstr "创建者"
#: ops/models/adhoc.py:251
#: ops/models/adhoc.py:246
msgid "Task display"
msgstr "任务名称"
#: ops/models/adhoc.py:253
#: ops/models/adhoc.py:248
msgid "Host amount"
msgstr "主机数量"
#: ops/models/adhoc.py:255
#: ops/models/adhoc.py:250
msgid "Start time"
msgstr "开始时间"
#: ops/models/adhoc.py:256
#: ops/models/adhoc.py:251
msgid "End time"
msgstr "完成时间"
#: ops/models/adhoc.py:258 ops/models/command.py:28
#: ops/models/adhoc.py:253 ops/models/command.py:28
#: terminal/serializers/session.py:39
msgid "Is finished"
msgstr "是否完成"
#: ops/models/adhoc.py:260
#: ops/models/adhoc.py:255
msgid "Adhoc raw result"
msgstr "结果"
#: ops/models/adhoc.py:261
#: ops/models/adhoc.py:256
msgid "Adhoc result summary"
msgstr "汇总"
@ -4528,7 +4528,7 @@ msgid "Date left"
msgstr "结束日期"
#: terminal/models/sharing.py:91
#: xpack/plugins/change_auth_plan/models/base.py:189
#: xpack/plugins/change_auth_plan/models/base.py:192
msgid "Finished"
msgstr "结束"
@ -5323,7 +5323,7 @@ msgid "Is first login"
msgstr "首次登录"
#: users/serializers/user.py:22
#: xpack/plugins/change_auth_plan/models/base.py:32
#: xpack/plugins/change_auth_plan/models/base.py:35
#: xpack/plugins/change_auth_plan/serializers/base.py:22
msgid "Password strategy"
msgstr "密码策略"
@ -5762,6 +5762,11 @@ msgstr "应用"
msgid "Application change auth plan task"
msgstr "用用改密计划任务"
#: xpack/plugins/change_auth_plan/models/app.py:180
#: xpack/plugins/change_auth_plan/models/asset.py:263
msgid "Password cannot be set to blank, exit. "
msgstr "密码不能设置为空, 退出. "
#: xpack/plugins/change_auth_plan/models/asset.py:29
msgid "Append SSH KEY"
msgstr "追加"
@ -5788,43 +5793,56 @@ msgstr "改密计划执行"
msgid "Change auth plan task"
msgstr "改密计划任务"
#: xpack/plugins/change_auth_plan/models/base.py:25
#: xpack/plugins/change_auth_plan/models/asset.py:252
msgid "This asset does not have a privileged user set: "
msgstr "该资产没有设置特权用户: "
#: xpack/plugins/change_auth_plan/models/asset.py:258
msgid ""
"The password and key of the current asset privileged user cannot be changed: "
msgstr "不能更改当前资产特权用户的密码及密钥: "
#: xpack/plugins/change_auth_plan/models/asset.py:269
msgid "Public key cannot be set to null, exit. "
msgstr "公钥不能设置为空, 退出. "
#: xpack/plugins/change_auth_plan/models/base.py:28
msgid "All assets use the same random password"
msgstr "使用相同的随机密码"
#: xpack/plugins/change_auth_plan/models/base.py:26
#: xpack/plugins/change_auth_plan/models/base.py:29
msgid "All assets use different random password"
msgstr "使用不同的随机密码"
#: xpack/plugins/change_auth_plan/models/base.py:36
#: xpack/plugins/change_auth_plan/models/base.py:39
msgid "Password rules"
msgstr "密码规则"
#: xpack/plugins/change_auth_plan/models/base.py:115
#: xpack/plugins/change_auth_plan/models/base.py:118
msgid "Change auth plan snapshot"
msgstr "改密计划快照"
#: xpack/plugins/change_auth_plan/models/base.py:184
#: xpack/plugins/change_auth_plan/models/base.py:187
msgid "Ready"
msgstr "准备"
#: xpack/plugins/change_auth_plan/models/base.py:185
#: xpack/plugins/change_auth_plan/models/base.py:188
msgid "Preflight check"
msgstr "改密前的校验"
#: xpack/plugins/change_auth_plan/models/base.py:186
#: xpack/plugins/change_auth_plan/models/base.py:189
msgid "Change auth"
msgstr "执行改密"
#: xpack/plugins/change_auth_plan/models/base.py:187
#: xpack/plugins/change_auth_plan/models/base.py:190
msgid "Verify auth"
msgstr "验证密码/密钥"
#: xpack/plugins/change_auth_plan/models/base.py:188
#: xpack/plugins/change_auth_plan/models/base.py:191
msgid "Keep auth"
msgstr "保存密码/密钥"
#: xpack/plugins/change_auth_plan/models/base.py:196
#: xpack/plugins/change_auth_plan/models/base.py:199
msgid "Step"
msgstr "步骤"

View File

@ -12,6 +12,7 @@ from django.utils import timezone
from django.utils.translation import ugettext_lazy as _, gettext
from common.utils import get_logger, lazyproperty
from common.utils.translate import translate_value
from common.fields.model import (
JsonListTextField, JsonDictCharField, EncryptJsonDictCharField,
JsonDictTextField,
@ -60,14 +61,8 @@ class Task(PeriodTaskModelMixin, OrgModelMixin):
@lazyproperty
def display_name(self):
sps = ['. ', ': ']
spb = {str(sp in self.name): sp for sp in sps}
sp = spb.get('True')
if not sp:
return self.name
tpl, data = self.name.split(sp, 1)
return gettext(tpl + sp) + data
value = translate_value(self.name)
return value
@property
def timedelta(self):