From 5d3e633e83b8ec9f51a199f6593733cb2c07e285 Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Wed, 7 Aug 2024 19:06:57 +0800 Subject: [PATCH] perf: ldap import msg modify --- apps/i18n/core/ja/LC_MESSAGES/django.po | 29 +++++++++++--------- apps/i18n/core/zh/LC_MESSAGES/django.po | 28 ++++++++++--------- apps/i18n/core/zh_Hant/LC_MESSAGES/django.po | 28 ++++++++++--------- apps/settings/ws.py | 8 ++---- apps/terminal/serializers/storage.py | 5 ++-- 5 files changed, 52 insertions(+), 46 deletions(-) diff --git a/apps/i18n/core/ja/LC_MESSAGES/django.po b/apps/i18n/core/ja/LC_MESSAGES/django.po index 748e852eb..dcdbe650a 100644 --- a/apps/i18n/core/ja/LC_MESSAGES/django.po +++ b/apps/i18n/core/ja/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-06 10:17+0800\n" +"POT-Creation-Date: 2024-08-07 19:04+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -874,8 +874,8 @@ msgstr "カテゴリ" #: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:40 #: terminal/models/component/storage.py:58 #: terminal/models/component/storage.py:154 terminal/serializers/applet.py:29 -#: terminal/serializers/session.py:23 terminal/serializers/storage.py:277 -#: terminal/serializers/storage.py:290 tickets/models/comment.py:26 +#: terminal/serializers/session.py:23 terminal/serializers/storage.py:278 +#: terminal/serializers/storage.py:291 tickets/models/comment.py:26 #: tickets/models/flow.py:42 tickets/models/ticket/apply_application.py:16 #: tickets/models/ticket/general.py:276 tickets/serializers/flow.py:25 #: tickets/serializers/ticket/ticket.py:19 @@ -6776,9 +6776,10 @@ msgstr "認証成功: {}" msgid "Get ldap users is None" msgstr "Ldapユーザーを取得するにはNone" -#: settings/ws.py:205 -msgid "Imported {} users successfully (Organization: {})" -msgstr "{} 人のユーザーを正常にインポートしました (組織: {})" +#: settings/ws.py:201 +msgid "Imported total: {} new: {}, failed: {} Organization: {}" +msgstr "" +"インポートされた合計: {}、新規: {}、失敗: {}、組織: {}" #: templates/_csv_import_export.html:8 msgid "Export" @@ -7845,7 +7846,15 @@ msgstr "インデックス" msgid "Doc type" msgstr "Docタイプ" -#: terminal/serializers/storage.py:269 +#: terminal/serializers/storage.py:257 +msgid "Store locally" +msgstr "ローカルに保存する" + +#: terminal/serializers/storage.py:257 +msgid "Do not save" +msgstr "保存しない" + +#: terminal/serializers/storage.py:270 msgid "" "set as the default storage, will make new Component use the current storage " "by default, without affecting existing Component" @@ -9909,9 +9918,3 @@ msgstr "エンタープライズプロフェッショナル版" #: xpack/plugins/license/models.py:86 msgid "Ultimate edition" msgstr "エンタープライズ・フラッグシップ・エディション" - -msgid "Store locally" -msgstr "ローカルに保存する" - -msgid "Do not save" -msgstr "保存しない" \ No newline at end of file diff --git a/apps/i18n/core/zh/LC_MESSAGES/django.po b/apps/i18n/core/zh/LC_MESSAGES/django.po index c722945e7..213a3bad9 100644 --- a/apps/i18n/core/zh/LC_MESSAGES/django.po +++ b/apps/i18n/core/zh/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: JumpServer 0.3.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-06 10:19+0800\n" +"POT-Creation-Date: 2024-08-07 19:04+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -872,8 +872,8 @@ msgstr "类别" #: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:40 #: terminal/models/component/storage.py:58 #: terminal/models/component/storage.py:154 terminal/serializers/applet.py:29 -#: terminal/serializers/session.py:23 terminal/serializers/storage.py:277 -#: terminal/serializers/storage.py:290 tickets/models/comment.py:26 +#: terminal/serializers/session.py:23 terminal/serializers/storage.py:278 +#: terminal/serializers/storage.py:291 tickets/models/comment.py:26 #: tickets/models/flow.py:42 tickets/models/ticket/apply_application.py:16 #: tickets/models/ticket/general.py:276 tickets/serializers/flow.py:25 #: tickets/serializers/ticket/ticket.py:19 @@ -6650,9 +6650,9 @@ msgstr "认证成功: {}" msgid "Get ldap users is None" msgstr "获取 LDAP 用户为 None" -#: settings/ws.py:205 -msgid "Imported {} users successfully (Organization: {})" -msgstr "成功导入 {} 个用户 ( 组织: {} )" +#: settings/ws.py:201 +msgid "Imported total: {} new: {}, failed: {} Organization: {}" +msgstr "导入总计: {},新增: {},失败: {},组织: {}" #: templates/_csv_import_export.html:8 msgid "Export" @@ -7702,7 +7702,15 @@ msgstr "索引" msgid "Doc type" msgstr "文档类型" -#: terminal/serializers/storage.py:269 +#: terminal/serializers/storage.py:257 +msgid "Store locally" +msgstr "本地存储" + +#: terminal/serializers/storage.py:257 +msgid "Do not save" +msgstr "不保存" + +#: terminal/serializers/storage.py:270 msgid "" "set as the default storage, will make new Component use the current storage " "by default, without affecting existing Component" @@ -9729,9 +9737,3 @@ msgstr "企业专业版" #: xpack/plugins/license/models.py:86 msgid "Ultimate edition" msgstr "企业旗舰版" - -msgid "Store locally" -msgstr "本地存储" - -msgid "Do not save" -msgstr "不保存" \ No newline at end of file diff --git a/apps/i18n/core/zh_Hant/LC_MESSAGES/django.po b/apps/i18n/core/zh_Hant/LC_MESSAGES/django.po index e3a15c8b3..07c7ea037 100644 --- a/apps/i18n/core/zh_Hant/LC_MESSAGES/django.po +++ b/apps/i18n/core/zh_Hant/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: JumpServer 0.3.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-06 10:19+0800\n" +"POT-Creation-Date: 2024-08-07 19:04+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -874,8 +874,8 @@ msgstr "類別" #: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:40 #: terminal/models/component/storage.py:58 #: terminal/models/component/storage.py:154 terminal/serializers/applet.py:29 -#: terminal/serializers/session.py:23 terminal/serializers/storage.py:277 -#: terminal/serializers/storage.py:290 tickets/models/comment.py:26 +#: terminal/serializers/session.py:23 terminal/serializers/storage.py:278 +#: terminal/serializers/storage.py:291 tickets/models/comment.py:26 #: tickets/models/flow.py:42 tickets/models/ticket/apply_application.py:16 #: tickets/models/ticket/general.py:276 tickets/serializers/flow.py:25 #: tickets/serializers/ticket/ticket.py:19 @@ -6653,9 +6653,9 @@ msgstr "認證成功: {}" msgid "Get ldap users is None" msgstr "獲取 LDAP 用戶為 None" -#: settings/ws.py:205 -msgid "Imported {} users successfully (Organization: {})" -msgstr "成功匯入 {} 個用戶 ( 組織: {} )" +#: settings/ws.py:201 +msgid "Imported total: {} new: {}, failed: {} Organization: {}" +msgstr "導入總計: {},新增: {},失敗: {},組織: {}" #: templates/_csv_import_export.html:8 msgid "Export" @@ -7705,7 +7705,15 @@ msgstr "索引" msgid "Doc type" msgstr "文件類型" -#: terminal/serializers/storage.py:269 +#: terminal/serializers/storage.py:257 +msgid "Store locally" +msgstr "本地儲存" + +#: terminal/serializers/storage.py:257 +msgid "Do not save" +msgstr "不儲存" + +#: terminal/serializers/storage.py:270 msgid "" "set as the default storage, will make new Component use the current storage " "by default, without affecting existing Component" @@ -9745,9 +9753,3 @@ msgstr "企業專業版" #: xpack/plugins/license/models.py:86 msgid "Ultimate edition" msgstr "企業旗艦版" - -msgid "Store locally" -msgstr "本地儲存" - -msgid "Do not save" -msgstr "不儲存" \ No newline at end of file diff --git a/apps/settings/ws.py b/apps/settings/ws.py index dd0d16af4..7d2c94383 100644 --- a/apps/settings/ws.py +++ b/apps/settings/ws.py @@ -196,13 +196,11 @@ class LdapWebsocket(AsyncJsonWebsocketConsumer): orgs = self.get_orgs(org_ids) new_users, error_msg = LDAPImportUtil().perform_import(users, orgs) - if error_msg: - msg = error_msg - - count = users if users is None else len(users) orgs_name = ', '.join([str(org) for org in orgs]) ok = True - msg = _('Imported {} users successfully (Organization: {})').format(count, orgs_name) + msg = _('Imported total: {} new: {}, failed: {} Organization: {}').format( + len(users), len(new_users), len(error_msg), orgs_name + ) except Exception as e: msg = str(e) return ok, msg diff --git a/apps/terminal/serializers/storage.py b/apps/terminal/serializers/storage.py index b6ede5a05..d799722be 100644 --- a/apps/terminal/serializers/storage.py +++ b/apps/terminal/serializers/storage.py @@ -253,9 +253,10 @@ class BaseStorageSerializer(serializers.ModelSerializer): return serializer def get_comment(self, obj): - need_translate_comments = ['Store locally', 'Do not save'] + + need_translate_comments = {'Store locally': _('Store locally'), 'Do not save': _('Do not save')} comment = obj.comment - return _(comment) if comment in need_translate_comments else comment + return need_translate_comments.get(comment, comment) def save(self, **kwargs): instance = super().save(**kwargs)