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() handler.clean()
def get_report_subject(self): 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): def get_report_template(self):
return "accounts/check_account_report.html" return "accounts/check_account_report.html"

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

View File

@ -23,9 +23,18 @@ class ServerPerformanceMessage(SystemMessage):
self.terms_with_errors = terms_with_errors self.terms_with_errors = terms_with_errors
def get_html_msg(self) -> dict: def get_html_msg(self) -> dict:
terms_with_errors = []
subject = gettext("Component health check warning") 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 = { context = {
'terms_with_errors': self.terms_with_errors 'terms_with_errors': terms_with_errors
} }
message = render_to_string('ops/_msg_terminal_performance.html', context) message = render_to_string('ops/_msg_terminal_performance.html', context)
return { return {
@ -108,10 +117,10 @@ class ServerPerformanceCheckUtil(object):
def check_terminal(self, term): def check_terminal(self, term):
errors = [] errors = []
for item, data in self.items_mapper.items(): for item, data in self.items_mapper.items():
error = self.check_item(term, item, data) result = self.check_item(term, item, data)
if not error: if not result:
continue continue
errors.append(error) errors.append(result)
return errors return errors
@staticmethod @staticmethod
@ -125,8 +134,8 @@ class ServerPerformanceCheckUtil(object):
elif isinstance(value, (int, float)) and value < max_threshold: elif isinstance(value, (int, float)) and value < max_threshold:
return return
msg = data['alarm_msg_format'] msg = data['alarm_msg_format']
error = msg.format(max_threshold=max_threshold, value=value, name=term.name) kwargs = {'name': term.name, 'value': value, 'max_threshold': max_threshold}
return error return msg, kwargs
def publish(self): def publish(self):
if not self.terms_with_errors: if not self.terms_with_errors: