fix: The title of the risk detection email and server performance check notification i18n

pull/15605/head
wangruidong 2025-06-19 14:47:17 +08:00 committed by Bryan
parent 60608e92ea
commit 411b485448
3 changed files with 66 additions and 43 deletions

View File

@ -264,7 +264,7 @@ class CheckAccountManager(BaseManager):
handler.clean()
def get_report_subject(self):
return "Check account report of %s" % self.execution.id
return _("Check account report of {}").format(self.execution.id)
def get_report_template(self):
return "accounts/check_account_report.html"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: JumpServer 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-06-18 14:56+0800\n"
"POT-Creation-Date: 2025-06-19 14:43+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"
@ -102,6 +102,10 @@ msgstr "未找到待处理帐户"
msgid "Success: %s, Failed: %s, Total: %s"
msgstr "成功: %s, 失败: %s, 总数: %s"
#: accounts/automations/check_account/manager.py:267
msgid "Check account report of {}"
msgstr "风险检测报告 {}"
#: accounts/automations/check_account/manager.py:273
msgid ""
"---\n"
@ -136,6 +140,8 @@ msgstr ">>> 开始执行测试网关账号可连接性任务"
#: users/templates/users/_msg_user_created.html:13
#: users/templates/users/user_password_verify.html:18
#: xpack/plugins/cloud/serializers/account_attrs.py:43
#: xpack/plugins/cloud/serializers/account_attrs.py:105
#: xpack/plugins/cloud/serializers/account_attrs.py:112
msgid "Password"
msgstr "密码"
@ -869,6 +875,8 @@ msgstr "重复密码"
#: users/serializers/profile.py:190
#: users/templates/users/_msg_user_created.html:12
#: xpack/plugins/cloud/serializers/account_attrs.py:41
#: xpack/plugins/cloud/serializers/account_attrs.py:103
#: xpack/plugins/cloud/serializers/account_attrs.py:110
msgid "Username"
msgstr "用户名"
@ -1933,8 +1941,8 @@ msgid ""
"10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64 (Domain name "
"support)"
msgstr ""
"* 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:"
"db8:2de::e13, 2001:db8:1a:1110::/64 (支持网域)"
"* 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, "
"2001:db8:2de::e13, 2001:db8:1a:1110::/64 (支持网域)"
#: acls/serializers/base.py:41 assets/serializers/asset/host.py:19
msgid "IP/Host"
@ -1962,8 +1970,8 @@ msgid ""
"With * indicating a match all. Such as: 192.168.10.1, 192.168.1.0/24, "
"10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64 "
msgstr ""
"* 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:"
"db8:2de::e13, 2001:db8:1a:1110::/64"
"* 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, "
"2001:db8:2de::e13, 2001:db8:1a:1110::/64"
#: acls/serializers/rules/rules.py:33
#: authentication/templates/authentication/_msg_oauth_bind.html:12
@ -2212,7 +2220,8 @@ msgstr "云服务"
msgid "Web"
msgstr "Web"
#: assets/const/category.py:16 common/sdk/sms/endpoint.py:20
#: assets/const/category.py:16 common/sdk/sms/custom_file.py:47
#: common/sdk/sms/endpoint.py:20
msgid "Custom type"
msgstr "自定义类型"
@ -2914,7 +2923,7 @@ msgstr "端口超出范围 (0-65535)"
msgid "Protocol is required: {}"
msgstr "协议是必填的: {}"
#: assets/serializers/asset/common.py:353
#: assets/serializers/asset/common.py:353 labels/api.py:107
msgid "Invalid data"
msgstr "无效的数据"
@ -3360,7 +3369,7 @@ msgstr "结束"
#: audits/const.py:47 settings/serializers/terminal.py:6
#: terminal/models/applet/host.py:26 terminal/models/component/terminal.py:185
#: terminal/models/virtualapp/provider.py:14 terminal/serializers/session.py:65
#: terminal/serializers/session.py:178
#: terminal/serializers/session.py:180
msgid "Terminal"
msgstr "终端"
@ -4369,8 +4378,8 @@ msgid ""
"Retention Period"
msgstr ""
"系统在连接资产或创建临时密码时,会生成相应的连接 Token 或临时密码记录。为了保"
"障系统安全并控制数据存储量,系统会根据“安全设置 > 密码安全 > Token 保留时"
"长”中的配置,每天凌晨 2 点自动清理所有已过期的 Token 记录"
"障系统安全并控制数据存储量,系统会根据“安全设置 > 密码安全 > Token 保留时长”"
"中的配置,每天凌晨 2 点自动清理所有已过期的 Token 记录"
#: authentication/templates/authentication/_access_key_modal.html:6
msgid "API key list"
@ -5082,6 +5091,10 @@ msgstr "自定义短信文件无效"
msgid "SMS sending failed[%s]: %s"
msgstr "短信发送失败[%s]: %s"
#: common/sdk/sms/custom_file.py:47 common/serializers/common.py:98
msgid "File"
msgstr "文件"
#: common/sdk/sms/endpoint.py:16
msgid "Alibaba cloud"
msgstr "阿里云"
@ -5126,10 +5139,6 @@ msgstr "请在 {} 秒后发送"
msgid "Children"
msgstr "节点"
#: common/serializers/common.py:98
msgid "File"
msgstr "文件"
#: common/serializers/fields.py:139
msgid "Invalid data type"
msgstr "无效的数据"
@ -5252,6 +5261,10 @@ msgstr "你的账号已创建成功"
msgid "JumpServer - An open-source PAM"
msgstr "JumpServer 开源堡垒机"
#: jumpserver/context_processor.py:28
msgid "FIT2CLOUD"
msgstr ""
#: jumpserver/views/celery_flower.py:22
msgid "<h1>Flower service unavailable, check it</h1>"
msgstr "Flower 服务不可用,请检查"
@ -5265,11 +5278,11 @@ msgstr ""
"<div>Luna是单独部署的一个程序你需要部署lunakoko, </div><div>如果你看到了"
"这个页面证明你访问的不是nginx监听的端口祝你好运</div>"
#: jumpserver/views/other.py:76
#: jumpserver/views/other.py:80
msgid "Websocket server run on port: {}, you should proxy it on nginx"
msgstr "Websocket 服务运行在端口: {}, 请检查nginx是否代理是否设置"
#: jumpserver/views/other.py:90
#: jumpserver/views/other.py:94
msgid ""
"<div>Koko is a separately deployed program, you need to deploy Koko, "
"configure nginx for url distribution,</div> </div>If you see this page, "
@ -5743,26 +5756,26 @@ msgstr "变量"
msgid "Server performance"
msgstr "监控告警"
#: ops/notifications.py:26
#: ops/notifications.py:27
msgid "Component health check warning"
msgstr "组件健康状况检查警告"
#: ops/notifications.py:71
#: ops/notifications.py:80
#, python-brace-format
msgid "The component is offline: {name}"
msgstr "组件已离线: {name}"
#: ops/notifications.py:76
#: ops/notifications.py:85
#, python-brace-format
msgid "Disk used more than {max_threshold}%: => {value}"
msgstr "硬盘使用率超过 {max_threshold}%: => {value}"
#: ops/notifications.py:81
#: ops/notifications.py:90
#, python-brace-format
msgid "Memory used more than {max_threshold}%: => {value}"
msgstr "内存使用率超过 {max_threshold}%: => {value}"
#: ops/notifications.py:86
#: ops/notifications.py:95
#, python-brace-format
msgid "CPU load more than {max_threshold}: => {value}"
msgstr "CPU 使用率超过 {max_threshold}: => {value}"
@ -7256,7 +7269,7 @@ msgstr "租户 ID"
#: settings/serializers/feature.py:110 terminal/serializers/storage.py:68
#: xpack/plugins/cloud/manager.py:119 xpack/plugins/cloud/manager.py:124
#: xpack/plugins/cloud/models.py:292
#: xpack/plugins/cloud/manager.py:161 xpack/plugins/cloud/models.py:292
msgid "Region"
msgstr "地域"
@ -8245,7 +8258,7 @@ msgstr "会话不存在: {}"
msgid "Session is finished or the protocol not supported"
msgstr "会话已经完成或协议不支持"
#: terminal/api/session/session.py:345
#: terminal/api/session/session.py:345 tickets/api/ticket.py:140
msgid "User does not have permission"
msgstr "用户没有权限"
@ -8613,7 +8626,7 @@ msgstr "登录来源"
msgid "Replay"
msgstr "回放"
#: terminal/models/session/session.py:50 terminal/serializers/session.py:177
#: terminal/models/session/session.py:50 terminal/serializers/session.py:179
msgid "Command amount"
msgstr "命令数量"
@ -8797,9 +8810,9 @@ msgid ""
"days. <a href=\"https://learn.microsoft.com/en-us/windows-server/remote/"
"remote-desktop-services/rds-client-access-license\">Detail</a>"
msgstr ""
"如果不存在RDS 将处于试用模式,试用期为 120 天。<a href='https://learn."
"microsoft.com/en-us/windows-server/remote/remote-desktop-services/rds-client-"
"access-license'>详情</a>"
"如果不存在RDS 将处于试用模式,试用期为 120 天。<a href='https://"
"learn.microsoft.com/en-us/windows-server/remote/remote-desktop-services/rds-"
"client-access-license'>详情</a>"
#: terminal/serializers/applet_host.py:55
msgid "RDS License Server"
@ -9017,8 +9030,8 @@ msgid ""
"If there are multiple hosts, use a comma (,) to separate them. <br>(For "
"example: http://www.jumpserver.a.com:9100, http://www.jumpserver.b.com:9100)"
msgstr ""
"如果有多个主机,请用逗号 (,) 分隔它们。<br>例如http://www.jumpserver.a."
"com:9100http://www.jumpserver.b.com:9100"
"如果有多个主机,请用逗号 (,) 分隔它们。<br>例如http://"
"www.jumpserver.a.com:9100http://www.jumpserver.b.com:9100"
#: terminal/serializers/storage.py:199
msgid "Index by date"
@ -10620,6 +10633,10 @@ msgstr "同步地区"
msgid "Get instances of region \"%s\" error, error: %s"
msgstr "获取区域 \"%s\" 的实例错误,错误:%s"
#: xpack/plugins/cloud/manager.py:161 xpack/plugins/cloud/models.py:289
msgid "Instance"
msgstr "实例"
#: xpack/plugins/cloud/manager.py:187
#, python-format
msgid "Failed to synchronize the instance \"%s\""
@ -10762,10 +10779,6 @@ msgstr "同步任务"
msgid "Sync instance task history"
msgstr "同步实例任务历史"
#: xpack/plugins/cloud/models.py:289
msgid "Instance"
msgstr "实例"
#: xpack/plugins/cloud/models.py:306
msgid "Sync instance detail"
msgstr "同步实例详情"
@ -11070,6 +11083,10 @@ msgstr "订阅 ID"
msgid "Auto node classification"
msgstr "自动节点分类"
#: xpack/plugins/cloud/serializers/account_attrs.py:108
msgid "domain_name"
msgstr "域名称"
#: xpack/plugins/cloud/serializers/account_attrs.py:114
#: xpack/plugins/cloud/serializers/account_attrs.py:118
#: xpack/plugins/cloud/serializers/account_attrs.py:150
@ -11233,6 +11250,3 @@ msgstr "许可证无效"
#~ "When creating or modifying an account requires account push, this task is "
#~ "executed"
#~ msgstr "当创建账号,修改账号时,需要账号推送时执行该任务"
#~ msgid "domain_name"
#~ msgstr "域名称"

View File

@ -23,9 +23,18 @@ class ServerPerformanceMessage(SystemMessage):
self.terms_with_errors = terms_with_errors
def get_html_msg(self) -> dict:
terms_with_errors = []
subject = gettext("Component health check warning")
for term, errors in self.terms_with_errors:
formatted_errors = []
for error in errors:
item, kwargs = error
# format 不能提前,否则会用系统默认语言翻译
msg = item.format(**kwargs)
formatted_errors.append(msg)
terms_with_errors.append((term, formatted_errors))
context = {
'terms_with_errors': self.terms_with_errors
'terms_with_errors': terms_with_errors
}
message = render_to_string('ops/_msg_terminal_performance.html', context)
return {
@ -108,10 +117,10 @@ class ServerPerformanceCheckUtil(object):
def check_terminal(self, term):
errors = []
for item, data in self.items_mapper.items():
error = self.check_item(term, item, data)
if not error:
result = self.check_item(term, item, data)
if not result:
continue
errors.append(error)
errors.append(result)
return errors
@staticmethod
@ -125,8 +134,8 @@ class ServerPerformanceCheckUtil(object):
elif isinstance(value, (int, float)) and value < max_threshold:
return
msg = data['alarm_msg_format']
error = msg.format(max_threshold=max_threshold, value=value, name=term.name)
return error
kwargs = {'name': term.name, 'value': value, 'max_threshold': max_threshold}
return msg, kwargs
def publish(self):
if not self.terms_with_errors: