perf: ldap import msg modify

pull/13910/head
wangruidong 2024-08-07 19:06:57 +08:00 committed by Bryan
parent c863bf63b1
commit 5d3e633e83
5 changed files with 52 additions and 46 deletions

View File

@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 "保存しない"

View File

@ -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 <ibuler@qq.com>\n"
"Language-Team: JumpServer team<ibuler@qq.com>\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 "不保存"

View File

@ -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 <ibuler@qq.com>\n"
"Language-Team: JumpServer team<ibuler@qq.com>\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 "不儲存"

View File

@ -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

View File

@ -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)