Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: translations +i18n #139

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions fastapi_amis_admin/admin/extensions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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 {}
Expand Down
Binary file modified fastapi_amis_admin/locale/de_DE/LC_MESSAGES/messages.mo
Binary file not shown.
81 changes: 51 additions & 30 deletions fastapi_amis_admin/locale/de_DE/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -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: 2022-10-09 22:12+0800\n"
"Last-Translator: Stefan Welcker <[email protected]>\n"
"Language: de_DE\n"
Expand All @@ -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"
Binary file modified fastapi_amis_admin/locale/zh_CN/LC_MESSAGES/messages.mo
Binary file not shown.
80 changes: 50 additions & 30 deletions fastapi_amis_admin/locale/zh_CN/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EMAIL@ADDRESS>\n"
"Language: zh_Hans_CN\n"
Expand All @@ -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 "内部服务器异常"