Skip to content

Commit

Permalink
perf: Translate
Browse files Browse the repository at this point in the history
  • Loading branch information
feng626 authored and ZhaoJiSen committed Dec 19, 2024
1 parent fab156d commit e983ac3
Show file tree
Hide file tree
Showing 6 changed files with 2,071 additions and 1,389 deletions.
5 changes: 3 additions & 2 deletions apps/common/views/msg.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#
from django.http import HttpResponse
from django.utils.decorators import method_decorator
from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import never_cache
from django.views.generic.base import TemplateView

Expand All @@ -14,11 +15,11 @@ class FlashMessageMsgView(TemplateView):
def get(self, request, *args, **kwargs):
code = request.GET.get('code')
if not code:
return HttpResponse('Not found the code')
return HttpResponse(_('Not found the code'))

message_data = FlashMessageUtil.get_message_by_code(code)
if not message_data:
return HttpResponse('Message code error')
return HttpResponse(_('The message code provided is invalid or has expired'))

items = ('title', 'message', 'error', 'redirect_url', 'confirm_button', 'cancel_url')
title, msg, error, redirect_url, confirm_btn, cancel_url = bulk_get(message_data, items)
Expand Down
53 changes: 30 additions & 23 deletions apps/i18n/core/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-18 18:13+0800\n"
"POT-Creation-Date: 2024-12-19 15:10+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -369,7 +369,7 @@ msgstr ""
#: assets/models/asset/common.py:362 assets/models/cmd_filter.py:36
#: audits/models.py:58 authentication/models/connection_token.py:36
#: perms/models/asset_permission.py:69 terminal/backends/command/models.py:17
#: terminal/models/session/session.py:32 terminal/notifications.py:156
#: terminal/models/session/session.py:33 terminal/notifications.py:156
#: terminal/serializers/command.py:17 terminal/serializers/session.py:30
#: terminal/templates/terminal/_msg_command_warning.html:4
#: terminal/templates/terminal/_msg_session_sharing.html:4
Expand Down Expand Up @@ -413,7 +413,7 @@ msgstr ""
#: assets/serializers/gateway.py:33 audits/models.py:59
#: authentication/api/connection_token.py:459 ops/models/base.py:18
#: perms/models/asset_permission.py:75 settings/serializers/msg.py:33
#: terminal/backends/command/models.py:18 terminal/models/session/session.py:34
#: terminal/backends/command/models.py:18 terminal/models/session/session.py:35
#: terminal/serializers/command.py:72
#: terminal/templates/terminal/_msg_command_warning.html:8
#: terminal/templates/terminal/_msg_session_sharing.html:8
Expand Down Expand Up @@ -486,7 +486,7 @@ msgstr ""
#: ops/templates/ops/celery_task_log.html:101
#: perms/models/asset_permission.py:78 settings/serializers/feature.py:26
#: settings/templates/ldap/_msg_import_ldap_user.html:5
#: terminal/models/applet/host.py:141 terminal/models/session/session.py:45
#: terminal/models/applet/host.py:141 terminal/models/session/session.py:46
#: tickets/models/ticket/apply_application.py:30
#: tickets/models/ticket/apply_asset.py:19
msgid "Date start"
Expand Down Expand Up @@ -967,7 +967,7 @@ msgstr ""
#: perms/api/user_permission/mixin.py:55 perms/models/asset_permission.py:63
#: rbac/builtin.py:125 rbac/models/rolebinding.py:49
#: rbac/serializers/rolebinding.py:17 terminal/backends/command/models.py:16
#: terminal/models/session/session.py:30 terminal/models/session/sharing.py:34
#: terminal/models/session/session.py:31 terminal/models/session/sharing.py:34
#: terminal/notifications.py:157 terminal/notifications.py:217
#: terminal/serializers/command.py:16
#: terminal/templates/terminal/_msg_command_warning.html:6
Expand Down Expand Up @@ -1073,7 +1073,7 @@ msgstr ""
#: terminal/models/applet/applet.py:332 terminal/models/applet/host.py:143
#: terminal/models/component/endpoint.py:27
#: terminal/models/component/endpoint.py:122
#: terminal/models/session/session.py:47
#: terminal/models/session/session.py:48
#: terminal/models/virtualapp/virtualapp.py:28 tickets/models/comment.py:32
#: tickets/models/ticket/general.py:298 users/models/user/__init__.py:98
#: xpack/plugins/cloud/models.py:41 xpack/plugins/cloud/models.py:124
Expand Down Expand Up @@ -1393,7 +1393,7 @@ msgstr ""

#: acls/models/command_acl.py:16 assets/models/cmd_filter.py:60
#: audits/serializers.py:38 ops/serializers/job.py:91 terminal/const.py:88
#: terminal/models/session/session.py:43 terminal/serializers/command.py:18
#: terminal/models/session/session.py:44 terminal/serializers/command.py:18
#: terminal/templates/terminal/_msg_command_alert.html:12
#: terminal/templates/terminal/_msg_command_execute_alert.html:10
#: terminal/templates/terminal/_msg_command_warning.html:23
Expand Down Expand Up @@ -2835,7 +2835,7 @@ msgid "Job audit log"
msgstr ""

#: audits/models.py:56 audits/models.py:100 audits/models.py:175
#: terminal/models/session/session.py:39 terminal/models/session/sharing.py:113
#: terminal/models/session/session.py:40 terminal/models/session/sharing.py:113
msgid "Remote addr"
msgstr ""

Expand Down Expand Up @@ -4584,6 +4584,14 @@ msgstr ""
msgid "The mobile phone number format is incorrect"
msgstr ""

#: common/views/msg.py:18
msgid "Not found the code"
msgstr ""

#: common/views/msg.py:22
msgid "The message code provided is invalid or has expired"
msgstr ""

#: jumpserver/conf.py:533
#, python-brace-format
msgid "The verification code is: {code}"
Expand Down Expand Up @@ -5064,15 +5072,15 @@ msgid ""
"final generated environment variable will be 'jms_name'."
msgstr ""

#: ops/models/variable.py:16
#: ops/models/variable.py:16 ops/serializers/variable.py:31
msgid "Default Value"
msgstr ""

#: ops/models/variable.py:18
msgid "Variable type"
msgstr ""

#: ops/models/variable.py:21 ops/serializers/variable.py:32
#: ops/models/variable.py:21 ops/serializers/variable.py:33
msgid "ExtraVars"
msgstr ""

Expand Down Expand Up @@ -5141,7 +5149,7 @@ msgstr ""
msgid "Variable Type"
msgstr ""

#: ops/serializers/variable.py:34
#: ops/serializers/variable.py:35
msgid ""
"Each item is on a separate line, with each line separated by a colon. The "
"part before the colon is the display content, and the part after the colon "
Expand Down Expand Up @@ -6534,7 +6542,7 @@ msgstr ""

#: settings/serializers/feature.py:27
#: settings/templates/ldap/_msg_import_ldap_user.html:6
#: terminal/models/session/session.py:46
#: terminal/models/session/session.py:47
msgid "Date end"
msgstr ""

Expand Down Expand Up @@ -7847,43 +7855,43 @@ msgstr ""
msgid "Can download session replay"
msgstr ""

#: terminal/models/session/session.py:35
#: terminal/models/session/session.py:36
msgid "Account ID"
msgstr ""

#: terminal/models/session/session.py:37 terminal/models/session/sharing.py:118
#: terminal/models/session/session.py:38 terminal/models/session/sharing.py:118
msgid "Login from"
msgstr ""

#: terminal/models/session/session.py:42
#: terminal/models/session/session.py:43
msgid "Replay"
msgstr ""

#: terminal/models/session/session.py:48 terminal/serializers/session.py:112
#: terminal/models/session/session.py:49 terminal/serializers/session.py:112
msgid "Command amount"
msgstr ""

#: terminal/models/session/session.py:49 terminal/serializers/session.py:32
#: terminal/models/session/session.py:50 terminal/serializers/session.py:32
msgid "Error reason"
msgstr ""

#: terminal/models/session/session.py:308
#: terminal/models/session/session.py:310
msgid "Session record"
msgstr ""

#: terminal/models/session/session.py:310
#: terminal/models/session/session.py:312
msgid "Can monitor session"
msgstr ""

#: terminal/models/session/session.py:311
#: terminal/models/session/session.py:313
msgid "Can share session"
msgstr ""

#: terminal/models/session/session.py:312
#: terminal/models/session/session.py:314
msgid "Can terminate session"
msgstr ""

#: terminal/models/session/session.py:313
#: terminal/models/session/session.py:315
msgid "Can validate session action perm"
msgstr ""

Expand Down Expand Up @@ -10434,4 +10442,3 @@ msgstr ""
#: xpack/plugins/license/api.py:53
msgid "Invalid license"
msgstr ""

Loading

0 comments on commit e983ac3

Please sign in to comment.