From 8a064af89c8932b27687bf0a42e6cb38a1c24185 Mon Sep 17 00:00:00 2001 From: MatsiukMykola Date: Wed, 18 Oct 2023 17:13:10 +0300 Subject: [PATCH 1/2] fix: translations +i18n --- fastapi_amis_admin/admin/extensions/admin.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fastapi_amis_admin/admin/extensions/admin.py b/fastapi_amis_admin/admin/extensions/admin.py index b5ac6e1..cde2cf9 100644 --- a/fastapi_amis_admin/admin/extensions/admin.py +++ b/fastapi_amis_admin/admin/extensions/admin.py @@ -15,6 +15,7 @@ from fastapi_amis_admin.crud.schema import CrudEnum from fastapi_amis_admin.utils.functools import cached_property from fastapi_amis_admin.utils.pydantic import ModelField +from fastapi_amis_admin.utils.translation import i18n as _ class ReadOnlyModelAdmin(ModelAdmin): @@ -123,11 +124,11 @@ def __init__(self, app: "AdminApp"): def get_permission_fields(self, action: str) -> Dict[str, str]: """获取权限字段""" info = { - "list": (self.schema_list, "列表展示-", FieldPermEnum.LIST), - "filter": (self.schema_filter, "列表筛选-", FieldPermEnum.FILTER), - "create": (self.schema_create, "新增-", FieldPermEnum.CREATE), - "read": (self.schema_read, "查看-", FieldPermEnum.READ), - "update": (self.schema_update, "更新-", FieldPermEnum.UPDATE), + "list": (self.schema_list, _("List display")+'-', FieldPermEnum.LIST), + "filter": (self.schema_filter, _("List filter")+'-', FieldPermEnum.FILTER), + "create": (self.schema_create, _("Create")+'-', FieldPermEnum.CREATE), + "read": (self.schema_read, _("Read")+'-', FieldPermEnum.READ), + "update": (self.schema_update, _("Update")+'-', FieldPermEnum.UPDATE), } if action not in info: return {} From 8984869ed85f8e954705488bfdfef7d243d5e2f6 Mon Sep 17 00:00:00 2001 From: atomi <1456417373@qq.com> Date: Thu, 23 Nov 2023 15:47:45 +0800 Subject: [PATCH 2/2] perf: Update the i18n locale file --- .../locale/de_DE/LC_MESSAGES/messages.mo | Bin 1973 -> 1908 bytes .../locale/de_DE/LC_MESSAGES/messages.po | 81 +++++++++++------- .../locale/zh_CN/LC_MESSAGES/messages.mo | Bin 1783 -> 1825 bytes .../locale/zh_CN/LC_MESSAGES/messages.po | 80 ++++++++++------- 4 files changed, 101 insertions(+), 60 deletions(-) diff --git a/fastapi_amis_admin/locale/de_DE/LC_MESSAGES/messages.mo b/fastapi_amis_admin/locale/de_DE/LC_MESSAGES/messages.mo index e48ec670823aa96baf63685542c721eda3a59959..30176ad36f832d5cb20b04672cdf6cd8f4cfc7b1 100644 GIT binary patch delta 342 zcmXZY&r1S96u|Mf&gK^R1I&I1QY!==RAdt|j4lPy!JD`B6htTpDyxYgcnG9JhhY8% z4?!o<4$-B*rN2QBUZn5B!tg%x-eYDS^A%sk-e;4Dh@2^r5auy~Mcly~%;P;6L0%|0jBjZ{x{`)LLHOer$Q& m_QOb@s+4xs$G+nfE=smju9hl`s2Ngbz1bP+n3dM9)%XW!DJN9` delta 405 zcmX}ou}eZh9Ki9PzIql?LRkq7UD8yBf+%4$NKjj2L`d+$QyDdklW$aqt|eMf{AF zQiolA)KP86I0w3;jXHLkZq@0yEl+7\n" "Language: de_DE\n" @@ -18,104 +18,125 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.12.1\n" -#: admin/admin.py:235 admin/admin.py:252 admin/admin.py:255 +#: admin/admin.py:204 admin/admin.py:219 admin/admin.py:222 msgid "Add Association" msgstr "Assoziation hinzufügen" -#: admin/admin.py:237 +#: admin/admin.py:206 msgid "Are you sure you want to add the association?" msgstr "Sind Sie sicher, dass Sie die Assoziation hinzufügen wollen?" -#: admin/admin.py:278 +#: admin/admin.py:245 msgid "Remove Association" msgstr "Assoziation entfernen" -#: admin/admin.py:280 +#: admin/admin.py:247 msgid "Are you sure you want to remove the association?" msgstr "Sind Sie sicher, dass Sie die Assoziation entfernen wollen?" -#: admin/admin.py:401 +#: admin/admin.py:728 msgid "Operation" msgstr "" -#: admin/admin.py:449 +#: admin/admin.py:765 msgid "SHOWING ${items|count} OF ${total} RESULT(S)" msgstr "Zeige ${items|count} von ${total} Resultate" -#: admin/admin.py:535 +#: admin/admin.py:864 msgid "Filter" msgstr "Filter" -#: admin/admin.py:542 +#: admin/admin.py:871 msgid "Clear" msgstr "Löschen" -#: admin/admin.py:547 +#: admin/admin.py:876 msgid "Reset" msgstr "Zurücksetzen" -#: admin/admin.py:550 +#: admin/admin.py:879 msgid "Search" msgstr "Suchen" -#: admin/admin.py:623 admin/admin.py:626 admin/admin.py:1065 +#: admin/admin.py:954 admin/admin.py:956 admin/admin.py:1078 msgid "View" msgstr "Anzeigen" -#: admin/admin.py:636 admin/admin.py:639 admin/admin.py:1020 +#: admin/admin.py:966 admin/admin.py:969 admin/admin.py:1033 +#: admin/extensions/admin.py:129 msgid "Create" msgstr "Erstellen" -#: admin/admin.py:646 admin/admin.py:649 admin/admin.py:1057 +#: admin/admin.py:976 admin/admin.py:979 admin/admin.py:1070 msgid "Bulk Create" msgstr "Massenhaft erstellen" -#: admin/admin.py:659 admin/admin.py:661 admin/admin.py:1027 +#: admin/admin.py:989 admin/admin.py:991 admin/admin.py:1040 +#: admin/extensions/admin.py:131 msgid "Update" msgstr "Aktualisieren" -#: admin/admin.py:668 admin/admin.py:670 admin/admin.py:1073 +#: admin/admin.py:998 admin/admin.py:1000 admin/admin.py:1086 msgid "Bulk Update" msgstr "Massenhaft aktualisieren" -#: admin/admin.py:1036 +#: admin/admin.py:1049 msgid "Delete" msgstr "Löschen" -#: admin/admin.py:1037 +#: admin/admin.py:1050 #, python-format msgid "Are you sure you want to delete row ${%s}?" msgstr "Sind Sie sicher, dass Sie die Zeile ${%s} löschen wollen?" -#: admin/admin.py:1046 +#: admin/admin.py:1059 msgid "Bulk Delete" msgstr "Massenhaft löschen" -#: admin/admin.py:1047 +#: admin/admin.py:1060 msgid "Are you sure you want to delete the selected rows?" msgstr "Sind Sie sicher, dass Sie die ausgewählten Zeilen löschen wollen?" -#: admin/admin.py:1194 +#: admin/admin.py:1215 msgid "Custom form actions" msgstr "Benutzerdefinierte Formular-Aktionen" -#: admin/parser.py:183 +#: admin/handlers.py:76 +#, fuzzy +msgid "Request parameter validation exception" +msgstr "Fehler bei der Validierung der Anfrageparameter" + +#: admin/handlers.py:86 +msgid "Internal data validation exception" +msgstr "Interne Datenvalidierungsausnahme" + +#: admin/handlers.py:96 +msgid "Internal server exception" +msgstr "Interne Serverausnahme" + +#: admin/parser.py:197 msgid "YES" msgstr "JA" -#: admin/parser.py:184 +#: admin/parser.py:198 msgid "NO" msgstr "NEIN" -#: admin/site.py:50 +#: admin/site.py:51 msgid "Home" msgstr "Home" -msgid "Request parameter validation error" -msgstr "Fehler bei der Validierung der Anfrageparameter" +#: admin/extensions/admin.py:127 +msgid "List display" +msgstr "Show" -msgid "Internal data validation exception" -msgstr "Interne Datenvalidierungsausnahme" +#: admin/extensions/admin.py:128 +#, fuzzy +msgid "List filter" +msgstr "Filter" + +#: admin/extensions/admin.py:130 +#, fuzzy +msgid "Read" +msgstr "Erstellen" -msgid "Internal server exception" -msgstr "Interne Serverausnahme" diff --git a/fastapi_amis_admin/locale/zh_CN/LC_MESSAGES/messages.mo b/fastapi_amis_admin/locale/zh_CN/LC_MESSAGES/messages.mo index bc6797ecd86df1c2f85b95dc8f13bdd70a35b0d6..e7eb11c7096aea2fa23ab63c22242101d78a4fc0 100644 GIT binary patch delta 537 zcmYk&KS%;$7{~GV)U?nN3?s2X0v#$PwFp|;8p4RihJqjm!67gNmqc3HFR8YKf{2z7 zf}*LRA*dl-q(4ItwM5WROHtnkpP}Qu`@FyR-*b0gowcs=W5884Tzz_fOZa!)TgLdw z4;aTc9K^80m=sRo2$s-`hw6!Xfo+W6pc@<5jd!hFHt#y|i7qC7Z~z@nV?r23A5J1u zCW9R~ivgU+80Jw5**J_lC)QO(mR>*h2sVlO$1!38>Nx?mIK&1y(9`#OGvvf)(6Z!tk`YHs(m z*89~Slymw$^(!lD`7*h}YGgTASjjJy?1b~fn@q-2=}2;HB0XLoa?Lor8(XingXiPw L%ift?bXWcWsNgxdoybuX0T8N-UaCONI5gWS{25UiL$irp%(v0UOYFz%zZ}bhEj**g!Yhv92M%Gz6=5jTn8X~W zaSkVN5%q#~oWv^XMaSkT>UYnOD(7^2JmLaV5{oQxT3^13`WLow92+)&g(>o*`DXs0 zUX-L$`{*(_U^zrRSFk*fgXA*mzGZYP3^r`TChCDL)Qvkfe}q%y6U!a*$$UY5*{9#S db5@+%g8Lps`7p|lMl-X;QmgD$614+A{sm{#GGhP$ diff --git a/fastapi_amis_admin/locale/zh_CN/LC_MESSAGES/messages.po b/fastapi_amis_admin/locale/zh_CN/LC_MESSAGES/messages.po index c75e9c8..9db964c 100644 --- a/fastapi_amis_admin/locale/zh_CN/LC_MESSAGES/messages.po +++ b/fastapi_amis_admin/locale/zh_CN/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2023-03-03 08:56+0800\n" +"POT-Creation-Date: 2023-11-23 15:37+0800\n" "PO-Revision-Date: 2023-03-03 08:57+0800\n" "Last-Translator: FULL NAME \n" "Language: zh_Hans_CN\n" @@ -18,104 +18,124 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.12.1\n" -#: admin/admin.py:235 admin/admin.py:252 admin/admin.py:255 +#: admin/admin.py:204 admin/admin.py:219 admin/admin.py:222 msgid "Add Association" msgstr "添加关联" -#: admin/admin.py:237 +#: admin/admin.py:206 msgid "Are you sure you want to add the association?" msgstr "你确定要添加关联吗?" -#: admin/admin.py:278 +#: admin/admin.py:245 msgid "Remove Association" msgstr "移除关联" -#: admin/admin.py:280 +#: admin/admin.py:247 msgid "Are you sure you want to remove the association?" msgstr "你确定要移除关联吗?" -#: admin/admin.py:401 +#: admin/admin.py:728 msgid "Operation" msgstr "操作" -#: admin/admin.py:449 +#: admin/admin.py:765 msgid "SHOWING ${items|count} OF ${total} RESULT(S)" msgstr "显示${total}条结果中的${items|count}条" -#: admin/admin.py:535 +#: admin/admin.py:864 msgid "Filter" msgstr "数据筛选" -#: admin/admin.py:542 +#: admin/admin.py:871 msgid "Clear" msgstr "清空" -#: admin/admin.py:547 +#: admin/admin.py:876 msgid "Reset" msgstr "重置" -#: admin/admin.py:550 +#: admin/admin.py:879 msgid "Search" msgstr "搜索" -#: admin/admin.py:623 admin/admin.py:626 admin/admin.py:1065 +#: admin/admin.py:954 admin/admin.py:956 admin/admin.py:1078 msgid "View" msgstr "查看" -#: admin/admin.py:636 admin/admin.py:639 admin/admin.py:1020 +#: admin/admin.py:966 admin/admin.py:969 admin/admin.py:1033 +#: admin/extensions/admin.py:129 msgid "Create" msgstr "新增" -#: admin/admin.py:646 admin/admin.py:649 admin/admin.py:1057 +#: admin/admin.py:976 admin/admin.py:979 admin/admin.py:1070 msgid "Bulk Create" msgstr "批量新增" -#: admin/admin.py:659 admin/admin.py:661 admin/admin.py:1027 +#: admin/admin.py:989 admin/admin.py:991 admin/admin.py:1040 +#: admin/extensions/admin.py:131 msgid "Update" msgstr "更新" -#: admin/admin.py:668 admin/admin.py:670 admin/admin.py:1073 +#: admin/admin.py:998 admin/admin.py:1000 admin/admin.py:1086 msgid "Bulk Update" msgstr "批量更新" -#: admin/admin.py:1036 +#: admin/admin.py:1049 msgid "Delete" msgstr "删除" -#: admin/admin.py:1037 +#: admin/admin.py:1050 #, python-format msgid "Are you sure you want to delete row ${%s}?" msgstr "你确定要删除行${%s}?" -#: admin/admin.py:1046 +#: admin/admin.py:1059 msgid "Bulk Delete" msgstr "批量删除" -#: admin/admin.py:1047 +#: admin/admin.py:1060 msgid "Are you sure you want to delete the selected rows?" msgstr "你确定要批量删除选中行吗?" -#: admin/admin.py:1194 +#: admin/admin.py:1215 msgid "Custom form actions" msgstr "自定义表单动作" -#: admin/parser.py:183 +#: admin/handlers.py:76 +msgid "Request parameter validation exception" +msgstr "请求参数验证错误" + +#: admin/handlers.py:86 +msgid "Internal data validation exception" +msgstr "内部数据验证异常" + +#: admin/handlers.py:96 +msgid "Internal server exception" +msgstr "内部服务器异常" + +#: admin/parser.py:197 msgid "YES" msgstr "是" -#: admin/parser.py:184 +#: admin/parser.py:198 msgid "NO" msgstr "否" -#: admin/site.py:50 +#: admin/site.py:51 msgid "Home" msgstr "首页" -msgid "Request parameter validation exception" -msgstr "请求参数验证错误" +#: admin/extensions/admin.py:127 +msgid "List display" +msgstr "列表展示" -msgid "Internal data validation exception" -msgstr "内部数据验证异常" +#: admin/extensions/admin.py:128 +#, fuzzy +msgid "List filter" +msgstr "数据筛选" + +#: admin/extensions/admin.py:130 +#, fuzzy +msgid "Read" +msgstr "新增" -msgid "Internal server exception" -msgstr "内部服务器异常"