perf: 修改i18n

perf: 优化命令告警,优化翻译
This commit is contained in:
ibuler 2021-06-16 13:20:50 +08:00 committed by Jiangjie.Bai
parent 94fc1fb53b
commit e623f63fcf
4 changed files with 71 additions and 61 deletions

Binary file not shown.

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: JumpServer 0.3.3\n" "Project-Id-Version: JumpServer 0.3.3\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 11:06+0800\n" "POT-Creation-Date: 2021-06-16 13:26+0800\n"
"PO-Revision-Date: 2021-05-20 10:54+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n"
"Last-Translator: ibuler <ibuler@qq.com>\n" "Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: JumpServer team<ibuler@qq.com>\n" "Language-Team: JumpServer team<ibuler@qq.com>\n"
@ -184,7 +184,7 @@ msgstr "格式为逗号分隔的字符串, * 表示匹配所有. "
#: users/templates/users/_select_user_modal.html:14 #: users/templates/users/_select_user_modal.html:14
#: xpack/plugins/change_auth_plan/models.py:47 #: xpack/plugins/change_auth_plan/models.py:47
#: xpack/plugins/change_auth_plan/models.py:278 #: xpack/plugins/change_auth_plan/models.py:278
#: xpack/plugins/cloud/serializers.py:65 #: xpack/plugins/cloud/serializers.py:51
msgid "Username" msgid "Username"
msgstr "用户名" msgstr "用户名"
@ -304,7 +304,7 @@ msgid "Cluster"
msgstr "集群" msgstr "集群"
#: applications/serializers/attrs/application_category/db.py:11 #: applications/serializers/attrs/application_category/db.py:11
#: ops/models/adhoc.py:146 xpack/plugins/cloud/serializers.py:63 #: ops/models/adhoc.py:146 xpack/plugins/cloud/serializers.py:49
msgid "Host" msgid "Host"
msgstr "主机" msgstr "主机"
@ -314,7 +314,7 @@ msgstr "主机"
#: applications/serializers/attrs/application_type/oracle.py:11 #: applications/serializers/attrs/application_type/oracle.py:11
#: applications/serializers/attrs/application_type/pgsql.py:11 #: applications/serializers/attrs/application_type/pgsql.py:11
#: assets/models/asset.py:188 assets/models/domain.py:53 #: assets/models/asset.py:188 assets/models/domain.py:53
#: xpack/plugins/cloud/serializers.py:64 #: xpack/plugins/cloud/serializers.py:50
msgid "Port" msgid "Port"
msgstr "端口" msgstr "端口"
@ -344,7 +344,7 @@ msgstr "目标URL"
#: xpack/plugins/change_auth_plan/models.py:68 #: xpack/plugins/change_auth_plan/models.py:68
#: xpack/plugins/change_auth_plan/models.py:190 #: xpack/plugins/change_auth_plan/models.py:190
#: xpack/plugins/change_auth_plan/models.py:285 #: xpack/plugins/change_auth_plan/models.py:285
#: xpack/plugins/cloud/serializers.py:67 #: xpack/plugins/cloud/serializers.py:53
msgid "Password" msgid "Password"
msgstr "密码" msgstr "密码"
@ -396,7 +396,7 @@ msgstr "系统用户(动态)"
#: assets/backends/db.py:232 assets/models/asset.py:196 #: assets/backends/db.py:232 assets/models/asset.py:196
#: assets/models/cluster.py:19 assets/models/user.py:67 templates/_nav.html:44 #: assets/models/cluster.py:19 assets/models/user.py:67 templates/_nav.html:44
#: xpack/plugins/cloud/models.py:92 xpack/plugins/cloud/serializers.py:160 #: xpack/plugins/cloud/models.py:92 xpack/plugins/cloud/serializers.py:146
msgid "Admin user" msgid "Admin user"
msgstr "管理用户" msgstr "管理用户"
@ -715,7 +715,7 @@ msgstr "ssh私钥"
#: users/templates/users/user_asset_permission.html:41 #: users/templates/users/user_asset_permission.html:41
#: users/templates/users/user_asset_permission.html:73 #: users/templates/users/user_asset_permission.html:73
#: users/templates/users/user_asset_permission.html:158 #: users/templates/users/user_asset_permission.html:158
#: xpack/plugins/cloud/models.py:89 xpack/plugins/cloud/serializers.py:161 #: xpack/plugins/cloud/models.py:89 xpack/plugins/cloud/serializers.py:147
msgid "Node" msgid "Node"
msgstr "节点" msgstr "节点"
@ -1227,17 +1227,29 @@ msgid "SSO"
msgstr "" msgstr ""
#: audits/signals_handler.py:60 #: audits/signals_handler.py:60
#, fuzzy
#| msgid "Private Token"
msgid "Auth Token"
msgstr "SSH密钥"
#: audits/signals_handler.py:61
#: authentication/templates/authentication/login.html:210 #: authentication/templates/authentication/login.html:210
#: notifications/backends/__init__.py:12 #: notifications/backends/__init__.py:12
msgid "WeCom" msgid "WeCom"
msgstr "企业微信" msgstr "企业微信"
#: audits/signals_handler.py:61 #: audits/signals_handler.py:62
#: authentication/templates/authentication/login.html:215 #: authentication/templates/authentication/login.html:215
#: notifications/backends/__init__.py:13 #: notifications/backends/__init__.py:13
msgid "DingTalk" msgid "DingTalk"
msgstr "钉钉" msgstr "钉钉"
#: authentication/api/connection_token.py:249
#, fuzzy
#| msgid "Invalid"
msgid "Invalid token"
msgstr "无效"
#: authentication/api/mfa.py:60 #: authentication/api/mfa.py:60
msgid "Code is invalid" msgid "Code is invalid"
msgstr "Code无效" msgstr "Code无效"
@ -1715,7 +1727,7 @@ msgstr "对象"
msgid "The file content overflowed (The maximum length `{}` bytes)" msgid "The file content overflowed (The maximum length `{}` bytes)"
msgstr "文件内容太大 (最大长度 `{}` 字节)" msgstr "文件内容太大 (最大长度 `{}` 字节)"
#: common/drf/parsers/base.py:148 #: common/drf/parsers/base.py:153
msgid "Parse file error: {}" msgid "Parse file error: {}"
msgstr "解析文件错误: {}" msgstr "解析文件错误: {}"
@ -1846,7 +1858,7 @@ msgstr "邮件"
#: notifications/backends/__init__.py:14 #: notifications/backends/__init__.py:14
msgid "Site message" msgid "Site message"
msgstr "" msgstr "站内信"
#: ops/api/celery.py:61 ops/api/celery.py:76 #: ops/api/celery.py:61 ops/api/celery.py:76
msgid "Waiting task start" msgid "Waiting task start"
@ -1993,7 +2005,7 @@ msgstr "任务结束"
#: ops/notifications.py:13 #: ops/notifications.py:13
msgid "Server performance" msgid "Server performance"
msgstr "" msgstr "监控告警"
#: ops/notifications.py:20 #: ops/notifications.py:20
msgid "Disk used more than 80%: {} => {}" msgid "Disk used more than 80%: {} => {}"
@ -2535,100 +2547,100 @@ msgstr "启用企业微信认证"
msgid "Enable DingTalk Auth" msgid "Enable DingTalk Auth"
msgstr "启用钉钉认证" msgstr "启用钉钉认证"
#: settings/utils/ldap.py:411 #: settings/utils/ldap.py:417
msgid "Host or port is disconnected: {}" msgid "Host or port is disconnected: {}"
msgstr "主机或端口不可连接: {}" msgstr "主机或端口不可连接: {}"
#: settings/utils/ldap.py:413 #: settings/utils/ldap.py:419
msgid "The port is not the port of the LDAP service: {}" msgid "The port is not the port of the LDAP service: {}"
msgstr "端口不是LDAP服务端口: {}" msgstr "端口不是LDAP服务端口: {}"
#: settings/utils/ldap.py:415 #: settings/utils/ldap.py:421
msgid "Please add certificate: {}" msgid "Please add certificate: {}"
msgstr "请添加证书" msgstr "请添加证书"
#: settings/utils/ldap.py:417 settings/utils/ldap.py:444 #: settings/utils/ldap.py:423 settings/utils/ldap.py:450
#: settings/utils/ldap.py:474 settings/utils/ldap.py:502 #: settings/utils/ldap.py:480 settings/utils/ldap.py:508
msgid "Unknown error: {}" msgid "Unknown error: {}"
msgstr "未知错误: {}" msgstr "未知错误: {}"
#: settings/utils/ldap.py:431 #: settings/utils/ldap.py:437
msgid "Bind DN or Password incorrect" msgid "Bind DN or Password incorrect"
msgstr "绑定DN或密码错误" msgstr "绑定DN或密码错误"
#: settings/utils/ldap.py:438 #: settings/utils/ldap.py:444
msgid "Please enter Bind DN: {}" msgid "Please enter Bind DN: {}"
msgstr "请输入绑定DN: {}" msgstr "请输入绑定DN: {}"
#: settings/utils/ldap.py:440 #: settings/utils/ldap.py:446
msgid "Please enter Password: {}" msgid "Please enter Password: {}"
msgstr "请输入密码: {}" msgstr "请输入密码: {}"
#: settings/utils/ldap.py:442 #: settings/utils/ldap.py:448
msgid "Please enter correct Bind DN and Password: {}" msgid "Please enter correct Bind DN and Password: {}"
msgstr "请输入正确的绑定DN和密码: {}" msgstr "请输入正确的绑定DN和密码: {}"
#: settings/utils/ldap.py:460 #: settings/utils/ldap.py:466
msgid "Invalid User OU or User search filter: {}" msgid "Invalid User OU or User search filter: {}"
msgstr "不合法的用户OU或用户过滤器: {}" msgstr "不合法的用户OU或用户过滤器: {}"
#: settings/utils/ldap.py:491 #: settings/utils/ldap.py:497
msgid "LDAP User attr map not include: {}" msgid "LDAP User attr map not include: {}"
msgstr "LDAP属性映射没有包含: {}" msgstr "LDAP属性映射没有包含: {}"
#: settings/utils/ldap.py:498 #: settings/utils/ldap.py:504
msgid "LDAP User attr map is not dict" msgid "LDAP User attr map is not dict"
msgstr "LDAP属性映射不合法" msgstr "LDAP属性映射不合法"
#: settings/utils/ldap.py:517 #: settings/utils/ldap.py:523
msgid "LDAP authentication is not enabled" msgid "LDAP authentication is not enabled"
msgstr "LDAP认证没有启用" msgstr "LDAP认证没有启用"
#: settings/utils/ldap.py:535 #: settings/utils/ldap.py:541
msgid "Error (Invalid LDAP server): {}" msgid "Error (Invalid LDAP server): {}"
msgstr "错误 不合法的LDAP服务器地址: {}" msgstr "错误 不合法的LDAP服务器地址: {}"
#: settings/utils/ldap.py:537 #: settings/utils/ldap.py:543
msgid "Error (Invalid Bind DN): {}" msgid "Error (Invalid Bind DN): {}"
msgstr "错误不合法的绑定DN: {}" msgstr "错误不合法的绑定DN: {}"
#: settings/utils/ldap.py:539 #: settings/utils/ldap.py:545
msgid "Error (Invalid LDAP User attr map): {}" msgid "Error (Invalid LDAP User attr map): {}"
msgstr "错误不合法的LDAP属性映射: {}" msgstr "错误不合法的LDAP属性映射: {}"
#: settings/utils/ldap.py:541 #: settings/utils/ldap.py:547
msgid "Error (Invalid User OU or User search filter): {}" msgid "Error (Invalid User OU or User search filter): {}"
msgstr "错误不合法的用户OU或用户过滤器: {}" msgstr "错误不合法的用户OU或用户过滤器: {}"
#: settings/utils/ldap.py:543 #: settings/utils/ldap.py:549
msgid "Error (Not enabled LDAP authentication): {}" msgid "Error (Not enabled LDAP authentication): {}"
msgstr "错误没有启用LDAP认证: {}" msgstr "错误没有启用LDAP认证: {}"
#: settings/utils/ldap.py:545 #: settings/utils/ldap.py:551
msgid "Error (Unknown): {}" msgid "Error (Unknown): {}"
msgstr "错误(未知): {}" msgstr "错误(未知): {}"
#: settings/utils/ldap.py:548 #: settings/utils/ldap.py:554
msgid "Succeed: Match {} s user" msgid "Succeed: Match {} s user"
msgstr "成功匹配 {} 个用户" msgstr "成功匹配 {} 个用户"
#: settings/utils/ldap.py:581 #: settings/utils/ldap.py:587
msgid "Authentication failed (configuration incorrect): {}" msgid "Authentication failed (configuration incorrect): {}"
msgstr "认证失败(配置错误): {}" msgstr "认证失败(配置错误): {}"
#: settings/utils/ldap.py:583 #: settings/utils/ldap.py:589
msgid "Authentication failed (before login check failed): {}" msgid "Authentication failed (before login check failed): {}"
msgstr "认证失败(登录前检查失败): {}" msgstr "认证失败(登录前检查失败): {}"
#: settings/utils/ldap.py:585 #: settings/utils/ldap.py:591
msgid "Authentication failed (username or password incorrect): {}" msgid "Authentication failed (username or password incorrect): {}"
msgstr "认证失败 (用户名或密码不正确): {}" msgstr "认证失败 (用户名或密码不正确): {}"
#: settings/utils/ldap.py:587 #: settings/utils/ldap.py:593
msgid "Authentication failed (Unknown): {}" msgid "Authentication failed (Unknown): {}"
msgstr "认证失败: (未知): {}" msgstr "认证失败: (未知): {}"
#: settings/utils/ldap.py:590 #: settings/utils/ldap.py:596
msgid "Authentication success: {}" msgid "Authentication success: {}"
msgstr "认证成功: {}" msgstr "认证成功: {}"
@ -2817,7 +2829,7 @@ msgstr "数据库应用"
msgid "Perms" msgid "Perms"
msgstr "权限管理" msgstr "权限管理"
#: templates/_nav.html:97 #: templates/_nav.html:97 terminal/notifications.py:15
msgid "Sessions" msgid "Sessions"
msgstr "会话管理" msgstr "会话管理"
@ -2841,7 +2853,7 @@ msgstr "Web终端"
msgid "File manager" msgid "File manager"
msgstr "文件管理" msgstr "文件管理"
#: templates/_nav.html:110 terminal/apps.py:9 terminal/notifications.py:15 #: templates/_nav.html:110 terminal/apps.py:9
#: terminal/serializers/session.py:40 #: terminal/serializers/session.py:40
msgid "Terminal" msgid "Terminal"
msgstr "终端" msgstr "终端"
@ -3273,8 +3285,8 @@ msgid "Replay storage"
msgstr "录像存储" msgstr "录像存储"
#: terminal/notifications.py:35 #: terminal/notifications.py:35
msgid "Terminal command alert" msgid "Danger command alert"
msgstr "终端命令告警" msgstr "危险命令告警"
#: terminal/notifications.py:44 #: terminal/notifications.py:44
#, python-format #, python-format
@ -3314,8 +3326,8 @@ msgid ""
msgstr "危险命令告警: [%(name)s->%(login_from)s@%(remote_addr)s] $%(command)s" msgstr "危险命令告警: [%(name)s->%(login_from)s@%(remote_addr)s] $%(command)s"
#: terminal/notifications.py:97 #: terminal/notifications.py:97
msgid "Batch command alert" msgid "Batch danger command alert"
msgstr "批量命令告警" msgstr "批量危险命令告警"
#: terminal/notifications.py:108 #: terminal/notifications.py:108
#, python-format #, python-format
@ -4051,7 +4063,7 @@ msgid "Security token validation"
msgstr "安全令牌验证" msgstr "安全令牌验证"
#: users/templates/users/_base_otp.html:14 xpack/plugins/cloud/models.py:78 #: users/templates/users/_base_otp.html:14 xpack/plugins/cloud/models.py:78
#: xpack/plugins/cloud/serializers.py:159 #: xpack/plugins/cloud/serializers.py:145
msgid "Account" msgid "Account"
msgstr "账户" msgstr "账户"
@ -4792,7 +4804,7 @@ msgstr "云服务商"
msgid "Cloud account" msgid "Cloud account"
msgstr "云账号" msgstr "云账号"
#: xpack/plugins/cloud/models.py:81 xpack/plugins/cloud/serializers.py:140 #: xpack/plugins/cloud/models.py:81 xpack/plugins/cloud/serializers.py:126
msgid "Regions" msgid "Regions"
msgstr "地域" msgstr "地域"
@ -4800,7 +4812,7 @@ msgstr "地域"
msgid "Hostname strategy" msgid "Hostname strategy"
msgstr "主机名策略" msgstr "主机名策略"
#: xpack/plugins/cloud/models.py:95 xpack/plugins/cloud/serializers.py:163 #: xpack/plugins/cloud/models.py:95 xpack/plugins/cloud/serializers.py:149
msgid "Always update" msgid "Always update"
msgstr "总是更新" msgstr "总是更新"
@ -4992,24 +5004,20 @@ msgstr ""
msgid "Subscription ID" msgid "Subscription ID"
msgstr "" msgstr ""
#: xpack/plugins/cloud/serializers.py:49 #: xpack/plugins/cloud/serializers.py:124
msgid "This field is required"
msgstr "这个字段是必填项"
#: xpack/plugins/cloud/serializers.py:138
msgid "History count" msgid "History count"
msgstr "执行次数" msgstr "执行次数"
#: xpack/plugins/cloud/serializers.py:139 #: xpack/plugins/cloud/serializers.py:125
msgid "Instance count" msgid "Instance count"
msgstr "实例个数" msgstr "实例个数"
#: xpack/plugins/cloud/serializers.py:162 #: xpack/plugins/cloud/serializers.py:148
#: xpack/plugins/gathered_user/serializers.py:20 #: xpack/plugins/gathered_user/serializers.py:20
msgid "Periodic display" msgid "Periodic display"
msgstr "定时执行" msgstr "定时执行"
#: xpack/plugins/cloud/utils.py:65 #: xpack/plugins/cloud/utils.py:64
msgid "Account unavailable" msgid "Account unavailable"
msgstr "账户无效" msgstr "账户无效"
@ -5096,3 +5104,9 @@ msgstr "旗舰版"
#: xpack/plugins/license/models.py:77 #: xpack/plugins/license/models.py:77
msgid "Community edition" msgid "Community edition"
msgstr "社区版" msgstr "社区版"
#~ msgid "Terminal command alert"
#~ msgstr "终端命令告警"
#~ msgid "This field is required"
#~ msgstr "这个字段是必填项"

View File

@ -108,11 +108,7 @@ class Message(metaclass=MessageType):
} }
def get_site_msg_msg(self) -> dict: def get_site_msg_msg(self) -> dict:
msg = self.get_common_msg() return self.get_email_msg()
return {
'subject': msg,
'message': msg
}
class SystemMessage(Message): class SystemMessage(Message):

View File

@ -12,7 +12,7 @@ logger = get_logger(__name__)
__all__ = ('CommandAlertMessage', 'CommandExecutionAlert') __all__ = ('CommandAlertMessage', 'CommandExecutionAlert')
CATEGORY = 'terminal' CATEGORY = 'terminal'
CATEGORY_LABEL = _('Terminal') CATEGORY_LABEL = _('Sessions')
class CommandAlertMixin: class CommandAlertMixin:
@ -32,7 +32,7 @@ class CommandAlertMixin:
class CommandAlertMessage(CommandAlertMixin, SystemMessage): class CommandAlertMessage(CommandAlertMixin, SystemMessage):
category = CATEGORY category = CATEGORY
category_label = CATEGORY_LABEL category_label = CATEGORY_LABEL
message_type_label = _('Terminal command alert') message_type_label = _('Danger command alert')
def __init__(self, command): def __init__(self, command):
self.command = command self.command = command
@ -94,7 +94,7 @@ class CommandAlertMessage(CommandAlertMixin, SystemMessage):
class CommandExecutionAlert(CommandAlertMixin, SystemMessage): class CommandExecutionAlert(CommandAlertMixin, SystemMessage):
category = CATEGORY category = CATEGORY
category_label = CATEGORY_LABEL category_label = CATEGORY_LABEL
message_type_label = _('Batch command alert') message_type_label = _('Batch danger command alert')
def __init__(self, command): def __init__(self, command):
self.command = command self.command = command