diff --git a/README-es.md b/README-es.md new file mode 100644 index 00000000..4ae40a3f --- /dev/null +++ b/README-es.md @@ -0,0 +1,60 @@ +# FastAPI Admin + +[![image](https://img.shields.io/pypi/v/fastapi-admin.svg?style=flat)](https://pypi.python.org/pypi/fastapi-admin) +[![image](https://img.shields.io/github/license/fastapi-admin/fastapi-admin)](https://github.com/fastapi-admin/fastapi-admin) +[![image](https://github.com/fastapi-admin/fastapi-admin/workflows/deploy/badge.svg)](https://github.com/fastapi-admin/fastapi-admin/actions?query=workflow:deploy) +[![image](https://github.com/fastapi-admin/fastapi-admin/workflows/pypi/badge.svg)](https://github.com/fastapi-admin/fastapi-admin/actions?query=workflow:pypi) + +[中文文档](./README-zh.md) +[한국어 문서](./README-ko.md) + +## Introducción + +`fastapi-admin` es un panel de administrador basado en [FastAPI](https://github.com/tiangolo/fastapi) y [TortoiseORM](https://github.com/tortoise/tortoise-orm/) con [tabler](https://github.com/tabler/tabler) ui, inspirado en Djando Admin. + +## Instalación + +```shell +> pip install fastapi-admin +``` + +## Requisitos + +- [Redis](https://redis.io) + +## Demo Online + +Puedes checar una demo online [aquí](https://fastapi-admin.long2ice.io/admin/login). + +- Usuario: `admin` +- Contraseña: `123456` + +O una demo online versión pro [aquí](https://fastapi-admin-pro.long2ice.io/admin/login). + +- Usuario: `admin` +- Contraseña: `123456` + +## Capturas + +![](https://raw.githubusercontent.com/fastapi-admin/fastapi-admin/dev/images/login.png) + +![](https://raw.githubusercontent.com/fastapi-admin/fastapi-admin/dev/images/dashboard.png) + +## Ejecutar el ejemplo localmente + +1. Clona el repositorio. +2. Crea un archivo `.env`. + ```dotenv + DATABASE_URL=mysql://root:123456@127.0.0.1:3306/fastapi_admin + REDIS_URL=redis://localhost:6379/0 + ``` +3. Ejecuta el comando `docker-compose up -d --build`. +4. Visita para crear el primer administrador. + +## Documentación + +Mira la documentación en . + +## Licencia + +Este proyecto está licenciado bajo la [licencia Apache-2.0](https://github.com/fastapi-admin/fastapi-admin/blob/master/LICENSE). diff --git a/README-ja.md b/README-ja.md new file mode 100644 index 00000000..257422f2 --- /dev/null +++ b/README-ja.md @@ -0,0 +1,63 @@ +# FastAPI Admin + +[![image](https://img.shields.io/pypi/v/fastapi-admin.svg?style=flat)](https://pypi.python.org/pypi/fastapi-admin) +[![image](https://img.shields.io/github/license/fastapi-admin/fastapi-admin)](https://github.com/fastapi-admin/fastapi-admin) +[![image](https://github.com/fastapi-admin/fastapi-admin/workflows/deploy/badge.svg)](https://github.com/fastapi-admin/fastapi-admin/actions?query=workflow:deploy) +[![image](https://github.com/fastapi-admin/fastapi-admin/workflows/pypi/badge.svg)](https://github.com/fastapi-admin/fastapi-admin/actions?query=workflow:pypi) + +[中文文档](./README-zh.md) +[한국어 문서](./README-ko.md) +[日本語ドキュメント](./README-ja.md) + +## はじめに + +`fastapi-admin`は、[tabler](https://github.com/tabler/tabler)UIを使用して開発された[FastAPI](https://github.com/tiangolo/fastapi)と[TortoiseORM](https://github.com/tortoise/tortoise-orm/)の高速な管理ダッシュボードで、Django adminを参考にしています。 + +## インストール + +```shell +> pip install fastapi-admin +``` + +## 環境 + +- [Redis](https://redis.io) + +## オンラインデモ + +[ここ](https://fastapi-admin.long2ice.io/admin/login)でオンラインデモを確認できます。 + +- username: `admin` +- password: `123456` + +もしくは、[ここ](https://fastapi-admin-pro.long2ice.io/admin/login)でプロ版のオンラインデモを確認できます。 + +- username: `admin` +- password: `123456` + +## スクリーンショット + +![](https://raw.githubusercontent.com/fastapi-admin/fastapi-admin/dev/images/login.png) + +![](https://raw.githubusercontent.com/fastapi-admin/fastapi-admin/dev/images/dashboard.png) + +## ローカル環境での実行方法 + +1. レポジトリをクローンする。 +2. .envファイルを作成し、以下の内容を記述する。 + + ```dotenv + DATABASE_URL=mysql://root:123456@127.0.0.1:3306/fastapi-admin + REDIS_URL=redis://localhost:6379/0 + ``` + +3. `docker-compose up -d --build`を実行する。 +4. にアクセスして、管理者用アカウントを作成する。 + +## ドキュメント + +ドキュメントは[こちら](https://fastapi-admin-docs.long2ice.io)で確認できます。 + +## ライセンス + +このプロジェクトは、[Apache-2.0](https://github.com/fastapi-admin/fastapi-admin/blob/master/LICENSE)ライセンスに準拠しています。 diff --git a/README-ko.md b/README-ko.md index 45127aba..a5d28f11 100644 --- a/README-ko.md +++ b/README-ko.md @@ -7,6 +7,7 @@ [中文文档](./README-zh.md) [한국어 문서](./README-ko.md) +[日本語ドキュメント](./README-ja.md) ## 개요 diff --git a/README-zh.md b/README-zh.md index caf87639..2d3cb822 100644 --- a/README-zh.md +++ b/README-zh.md @@ -5,6 +5,10 @@ [![image](https://github.com/fastapi-admin/fastapi-admin/workflows/gh-pages/badge.svg)](https://github.com/fastapi-admin/fastapi-admin/actions?query=workflow:gh-pages) [![image](https://github.com/fastapi-admin/fastapi-admin/workflows/pypi/badge.svg)](https://github.com/fastapi-admin/fastapi-admin/actions?query=workflow:pypi) +[中文文档](./README-zh.md) +[한국어 문서](./README-ko.md) +[日本語ドキュメント](./README-ja.md) + ## 简介 `fastapi-admin` 是一个基于 [FastAPI](https://github.com/tiangolo/fastapi) @@ -49,3 +53,9 @@ ## 许可 本项目遵循 [Apache-2.0](https://github.com/fastapi-admin/fastapi-admin/blob/master/LICENSE) 开源许可。 + +## 感谢 + +[![image](./images/yxvm.png)](https://yxvm.com/) + +[NodeSupport](https://github.com/NodeSeekDev/NodeSupport) 赞助了本项目 diff --git a/README.md b/README.md index f4e150e0..21d0b847 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ [中文文档](./README-zh.md) [한국어 문서](./README-ko.md) +[日本語ドキュメント](./README-ja.md) ## Introduction @@ -64,3 +65,9 @@ See documentation at . This project is licensed under the [Apache-2.0](https://github.com/fastapi-admin/fastapi-admin/blob/master/LICENSE) License. + +## Credits + +[![image](./images/yxvm.png)](https://yxvm.com/) + +[NodeSupport](https://github.com/NodeSeekDev/NodeSupport) supports this project. diff --git a/babel.cfg b/babel.cfg index 806b6cb5..92d71b03 100644 --- a/babel.cfg +++ b/babel.cfg @@ -1,3 +1,3 @@ [python: fastapi_admin/**.py] [jinja2: fastapi_admin/templates/**.html] -extensions = jinja2.ext.i18n,jinja2.ext.autoescape +extensions = jinja2.ext.i18n diff --git a/examples/main.py b/examples/main.py index 433390ce..eff816ea 100644 --- a/examples/main.py +++ b/examples/main.py @@ -1,4 +1,5 @@ import os +from contextlib import asynccontextmanager import redis.asyncio as redis import uvicorn @@ -27,8 +28,30 @@ ) +@asynccontextmanager +async def lifespan(app: FastAPI): + r = redis.from_url( + settings.REDIS_URL, + decode_responses=True, + encoding="utf8", + ) + await admin_app.configure( + logo_url="https://preview.tabler.io/static/logo-white.svg", + template_folders=[os.path.join(BASE_DIR, "templates")], + favicon_url="https://raw.githubusercontent.com/fastapi-admin/fastapi-admin/dev/images/favicon.png", + providers=[ + LoginProvider( + login_logo_url="https://preview.tabler.io/static/logo.svg", + admin_model=Admin, + ) + ], + redis=r, + ) + yield + + def create_app(): - app = FastAPI() + app = FastAPI(lifespan=lifespan) app.mount( "/static", StaticFiles(directory=os.path.join(BASE_DIR, "static")), @@ -44,26 +67,6 @@ async def index(): admin_app.add_exception_handler(HTTP_403_FORBIDDEN, forbidden_error_exception) admin_app.add_exception_handler(HTTP_401_UNAUTHORIZED, unauthorized_error_exception) - @app.on_event("startup") - async def startup(): - r = redis.from_url( - settings.REDIS_URL, - decode_responses=True, - encoding="utf8", - ) - await admin_app.configure( - logo_url="https://preview.tabler.io/static/logo-white.svg", - template_folders=[os.path.join(BASE_DIR, "templates")], - favicon_url="https://raw.githubusercontent.com/fastapi-admin/fastapi-admin/dev/images/favicon.png", - providers=[ - LoginProvider( - login_logo_url="https://preview.tabler.io/static/logo.svg", - admin_model=Admin, - ) - ], - redis=r, - ) - app.mount("/admin", admin_app) app.add_middleware( CORSMiddleware, diff --git a/fastapi_admin/i18n.py b/fastapi_admin/i18n.py index f1b34513..b8c0e5ac 100644 --- a/fastapi_admin/i18n.py +++ b/fastapi_admin/i18n.py @@ -8,8 +8,10 @@ TRANSLATIONS = { "zh_CN": Translations.load(os.path.join(BASE_DIR, "locales"), locales=["zh_CN"]), "en_US": Translations.load(os.path.join(BASE_DIR, "locales"), locales=["en_US"]), + "es_PY": Translations.load(os.path.join(BASE_DIR, "locales"), locales=["es_PY"]), "fr_FR": Translations.load(os.path.join(BASE_DIR, "locales"), locales=["fr_FR"]), "fa_IR": Translations.load(os.path.join(BASE_DIR, "locales"), locales=["fa_IR"]), + "tr_TR": Translations.load(os.path.join(BASE_DIR, "locales"), locales=["tr_TR"]), } translations = TRANSLATIONS.get("en_US") diff --git a/fastapi_admin/locales/en_US/LC_MESSAGES/messages.po b/fastapi_admin/locales/en_US/LC_MESSAGES/messages.po index c62de86a..74409398 100644 --- a/fastapi_admin/locales/en_US/LC_MESSAGES/messages.po +++ b/fastapi_admin/locales/en_US/LC_MESSAGES/messages.po @@ -7,16 +7,16 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2021-08-06 23:07+0800\n" +"POT-Creation-Date: 2024-08-28 10:24+0100\n" "PO-Revision-Date: 2021-04-16 22:46+0800\n" "Last-Translator: FULL NAME \n" "Language: en_US\n" "Language-Team: en_US \n" -"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.1\n" +"Generated-By: Babel 2.14.0\n" #: fastapi_admin/resources.py:91 msgid "create" @@ -115,27 +115,32 @@ msgstr "Search" msgid "bulk_actions" msgstr "Bulk Actions" -#: fastapi_admin/templates/list.html:125 +#: fastapi_admin/templates/list.html:139 msgid "actions" msgstr "Actions" -#: fastapi_admin/templates/list.html:156 +#: fastapi_admin/templates/list.html:170 #, python-format msgid "Showing %(from)s to %(to)s of %(total)s entries" msgstr "" -#: fastapi_admin/templates/list.html:167 +#: fastapi_admin/templates/list.html:181 msgid "prev_page" msgstr "Prev" -#: fastapi_admin/templates/list.html:188 +#: fastapi_admin/templates/list.html:202 msgid "next_page" msgstr "Next" +#: fastapi_admin/templates/list.html:214 +msgid "delete_confirmation" +msgstr "Are you sure want to delete this item?" + #: fastapi_admin/templates/update.html:23 msgid "save_and_return" msgstr "Save and return" +#: fastapi_admin/templates/errors/401.html:21 #: fastapi_admin/templates/errors/403.html:21 #: fastapi_admin/templates/errors/404.html:21 #: fastapi_admin/templates/errors/500.html:21 diff --git a/fastapi_admin/locales/es_PY/LC_MESSAGES/messages.mo b/fastapi_admin/locales/es_PY/LC_MESSAGES/messages.mo new file mode 100644 index 00000000..a909f510 Binary files /dev/null and b/fastapi_admin/locales/es_PY/LC_MESSAGES/messages.mo differ diff --git a/fastapi_admin/locales/es_PY/LC_MESSAGES/messages.po b/fastapi_admin/locales/es_PY/LC_MESSAGES/messages.po new file mode 100644 index 00000000..a13b6663 --- /dev/null +++ b/fastapi_admin/locales/es_PY/LC_MESSAGES/messages.po @@ -0,0 +1,242 @@ +# Spanish (Paraguay) translations for PROJECT. +# Copyright (C) 2024 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2024. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2024-08-28 10:24+0100\n" +"PO-Revision-Date: 2024-02-21 12:22-0300\n" +"Last-Translator: FULL NAME \n" +"Language: es_PY\n" +"Language-Team: es_PY \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.14.0\n" + +#: fastapi_admin/resources.py:91 +msgid "create" +msgstr "Agregar nuevo" + +#: fastapi_admin/resources.py:112 +msgid "update" +msgstr "Editar" + +#: fastapi_admin/resources.py:114 +msgid "delete" +msgstr "Borrar" + +#: fastapi_admin/resources.py:120 +msgid "delete_selected" +msgstr "Eliminar seleccionados" + +#: fastapi_admin/providers/login.py:90 +msgid "login_failed" +msgstr "Fallo en el inicio de sesión" + +#: fastapi_admin/providers/login.py:161 +msgid "confirm_password_different" +msgstr "Las contraseñas no coinciden" + +#: fastapi_admin/providers/login.py:196 +msgid "old_password_error" +msgstr "Error en la contraseña antigua" + +#: fastapi_admin/providers/login.py:198 +msgid "new_password_different" +msgstr "La nueva contraseña no coincide" + +#: fastapi_admin/templates/create.html:14 +#: fastapi_admin/templates/update.html:16 +msgid "save" +msgstr "Guardar" + +#: fastapi_admin/templates/create.html:16 +msgid "save_and_add_another" +msgstr "Guardar y agregar otro" + +#: fastapi_admin/templates/create.html:18 +#: fastapi_admin/templates/update.html:29 +msgid "return" +msgstr "Volver" + +#: fastapi_admin/templates/init.html:10 +msgid "Create first admin" +msgstr "Crear primer administrador" + +#: fastapi_admin/templates/init.html:12 +#: fastapi_admin/templates/providers/login/login.html:44 +msgid "username" +msgstr "Nombre de usuario" + +#: fastapi_admin/templates/init.html:14 +msgid "username_placeholder" +msgstr "Ingrese el nombre de usuario" + +#: fastapi_admin/templates/init.html:18 +#: fastapi_admin/templates/providers/login/login.html:54 +msgid "password" +msgstr "Contraseña" + +#: fastapi_admin/templates/init.html:23 +msgid "password_placeholder" +msgstr "Ingrese la contraseña" + +#: fastapi_admin/templates/init.html:31 +msgid "confirm_password" +msgstr "Confirmar contraseña" + +#: fastapi_admin/templates/init.html:36 +msgid "confirm_password_placeholder" +msgstr "Ingrese la contraseña nuevamente" + +#: fastapi_admin/templates/init.html:43 +#: fastapi_admin/templates/providers/login/password.html:32 +msgid "submit" +msgstr "Enviar" + +#: fastapi_admin/templates/list.html:13 +msgid "show" +msgstr "Mostrar" + +#: fastapi_admin/templates/list.html:24 +msgid "entries" +msgstr "entradas" + +#: fastapi_admin/templates/list.html:33 +msgid "search" +msgstr "Buscar" + +#: fastapi_admin/templates/list.html:46 +msgid "bulk_actions" +msgstr "Acciones masivas" + +#: fastapi_admin/templates/list.html:139 +msgid "actions" +msgstr "Acciones" + +#: fastapi_admin/templates/list.html:170 +#, python-format +msgid "Showing %(from)s to %(to)s of %(total)s entries" +msgstr "Mostrando %(from)s a %(to)s de %(total)s entradas" + +#: fastapi_admin/templates/list.html:181 +msgid "prev_page" +msgstr "Pág. Anterior" + +#: fastapi_admin/templates/list.html:202 +msgid "next_page" +msgstr "Pág. Siguiente" + +#: fastapi_admin/templates/list.html:214 +msgid "delete_confirmation" +msgstr "¿Estás seguro de que quieres eliminar este artículo?" + +#: fastapi_admin/templates/update.html:23 +msgid "save_and_return" +msgstr "Guardar y volver" + +#: fastapi_admin/templates/errors/401.html:21 +#: fastapi_admin/templates/errors/403.html:21 +#: fastapi_admin/templates/errors/404.html:21 +#: fastapi_admin/templates/errors/500.html:21 +msgid "return_home" +msgstr "Volver a inicio" + +#: fastapi_admin/templates/providers/login/avatar.html:18 +#: fastapi_admin/templates/providers/login/password.html:6 +msgid "update_password" +msgstr "Actualizar contraseña" + +#: fastapi_admin/templates/providers/login/avatar.html:24 +msgid "logout" +msgstr "Cerrar sesión" + +#: fastapi_admin/templates/providers/login/login.html:49 +#, fuzzy +msgid "login_username_placeholder" +msgstr "Ingrese el nombre de usuario" + +#: fastapi_admin/templates/providers/login/login.html:59 +#, fuzzy +msgid "login_password_placeholder" +msgstr "Ingrese la contraseña antigua" + +#: fastapi_admin/templates/providers/login/login.html:75 +msgid "remember_me" +msgstr "Recordarme" + +#: fastapi_admin/templates/providers/login/login.html:80 +msgid "sign_in" +msgstr "Iniciar sesión" + +#: fastapi_admin/templates/providers/login/password.html:12 +msgid "old_password" +msgstr "Contraseña antigua" + +#: fastapi_admin/templates/providers/login/password.html:15 +msgid "old_password_placeholder" +msgstr "Ingrese la contraseña antigua" + +#: fastapi_admin/templates/providers/login/password.html:19 +msgid "new_password" +msgstr "Nueva contraseña" + +#: fastapi_admin/templates/providers/login/password.html:22 +msgid "new_password_placeholder" +msgstr "Ingrese la nueva contraseña" + +#: fastapi_admin/templates/providers/login/password.html:26 +msgid "re_new_password" +msgstr "Repetir nueva contraseña" + +#: fastapi_admin/templates/providers/login/password.html:29 +msgid "re_new_password_placeholder" +msgstr "Ingrese la nueva contraseña nuevamente" + +#~ msgid "You can only try after %(seconds)s seconds" +#~ msgstr "Solo puedes intentarlo después de %(seconds)s segundos" + +#~ msgid "Login failed %(times)s times, you can try %(rest_times)s more times" +#~ msgstr "" +#~ "Fallo en el inicio de sesión " +#~ "%(times)s veces, puedes intentarlo " +#~ "%(rest_times)s veces más" + +#~ msgid "Import" +#~ msgstr "Importar" + +#~ msgid "Export" +#~ msgstr "Exportar" + +#~ msgid "Success create %(count)s %(label)s" +#~ msgstr "Éxito al crear %(count)s %(label)s" + +#~ msgid "captcha_error" +#~ msgstr "Error en el captcha" + +#~ msgid "Google recaptcha verify failed" +#~ msgstr "La verificación de Google reCAPTCHA falló" + +#~ msgid "Format" +#~ msgstr "Formato" + +#~ msgid "File to import" +#~ msgstr "Archivo a importar" + +#~ msgid "captcha" +#~ msgstr "Captcha" + +#~ msgid "captcha_placeholder" +#~ msgstr "Ingrese el captcha" + +#~ msgid "Search in site..." +#~ msgstr "Buscar en el sitio..." + +#~ msgid "No results found for search text" +#~ msgstr "No se encontraron resultados para el texto de búsqueda" + diff --git a/fastapi_admin/locales/fa_IR/LC_MESSAGES/messages.po b/fastapi_admin/locales/fa_IR/LC_MESSAGES/messages.po index 0d9accd4..d5f290f6 100644 --- a/fastapi_admin/locales/fa_IR/LC_MESSAGES/messages.po +++ b/fastapi_admin/locales/fa_IR/LC_MESSAGES/messages.po @@ -7,16 +7,16 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2021-08-06 23:07+0800\n" +"POT-Creation-Date: 2024-08-28 10:24+0100\n" "PO-Revision-Date: 2021-04-16 22:46+0800\n" "Last-Translator: FULL NAME \n" "Language: fa_IR\n" "Language-Team: fa_IR \n" -"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.1\n" +"Generated-By: Babel 2.14.0\n" #: fastapi_admin/resources.py:91 msgid "create" @@ -115,27 +115,32 @@ msgstr "جستجو" msgid "bulk_actions" msgstr "اقدامات دسته‌ای" -#: fastapi_admin/templates/list.html:125 +#: fastapi_admin/templates/list.html:139 msgid "actions" msgstr "اقدامات" -#: fastapi_admin/templates/list.html:156 +#: fastapi_admin/templates/list.html:170 #, python-format msgid "Showing %(from)s to %(to)s of %(total)s entries" msgstr "نمایش %(from)s الی %(to)s از %(total)s مورد" -#: fastapi_admin/templates/list.html:167 +#: fastapi_admin/templates/list.html:181 msgid "prev_page" msgstr "قبلی" -#: fastapi_admin/templates/list.html:188 +#: fastapi_admin/templates/list.html:202 msgid "next_page" msgstr "بعدی" +#: fastapi_admin/templates/list.html:214 +msgid "delete_confirmation" +msgstr "هل أنت متأكد أنك تريد حذف هذا العنصر؟" + #: fastapi_admin/templates/update.html:23 msgid "save_and_return" msgstr "ذخیره و بازگشت" +#: fastapi_admin/templates/errors/401.html:21 #: fastapi_admin/templates/errors/403.html:21 #: fastapi_admin/templates/errors/404.html:21 #: fastapi_admin/templates/errors/500.html:21 @@ -190,3 +195,4 @@ msgstr "رمز عبور جدید را تایید کنید" #: fastapi_admin/templates/providers/login/password.html:29 msgid "re_new_password_placeholder" msgstr "رمز عبور جدید را دوباره وارد کنید" + diff --git a/fastapi_admin/locales/fr_FR/LC_MESSAGES/messages.po b/fastapi_admin/locales/fr_FR/LC_MESSAGES/messages.po index 1bdd8024..5e6e7f79 100644 --- a/fastapi_admin/locales/fr_FR/LC_MESSAGES/messages.po +++ b/fastapi_admin/locales/fr_FR/LC_MESSAGES/messages.po @@ -7,16 +7,16 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2021-08-06 23:07+0800\n" +"POT-Creation-Date: 2024-08-28 10:24+0100\n" "PO-Revision-Date: 2021-04-16 22:46+0800\n" "Last-Translator: FULL NAME \n" "Language: fr_FR\n" "Language-Team: fr_FR \n" -"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.1\n" +"Generated-By: Babel 2.14.0\n" #: fastapi_admin/resources.py:91 msgid "create" @@ -115,27 +115,32 @@ msgstr "Search" msgid "bulk_actions" msgstr "Actions groupées" -#: fastapi_admin/templates/list.html:125 +#: fastapi_admin/templates/list.html:139 msgid "actions" msgstr "Actions" -#: fastapi_admin/templates/list.html:156 +#: fastapi_admin/templates/list.html:170 #, python-format msgid "Showing %(from)s to %(to)s of %(total)s entries" msgstr "Voir %(from)s de %(to)s à %(total)s entrées" -#: fastapi_admin/templates/list.html:167 +#: fastapi_admin/templates/list.html:181 msgid "prev_page" msgstr "Prec" -#: fastapi_admin/templates/list.html:188 +#: fastapi_admin/templates/list.html:202 msgid "next_page" msgstr "Suiv" +#: fastapi_admin/templates/list.html:214 +msgid "delete_confirmation" +msgstr "Etes-vous sûr de vouloir supprimer cet élément ?" + #: fastapi_admin/templates/update.html:23 msgid "save_and_return" msgstr "Enregistrer et retourner" +#: fastapi_admin/templates/errors/401.html:21 #: fastapi_admin/templates/errors/403.html:21 #: fastapi_admin/templates/errors/404.html:21 #: fastapi_admin/templates/errors/500.html:21 diff --git a/fastapi_admin/locales/tr_TR/LC_MESSAGES/messages.po b/fastapi_admin/locales/tr_TR/LC_MESSAGES/messages.po new file mode 100644 index 00000000..9d9588f7 --- /dev/null +++ b/fastapi_admin/locales/tr_TR/LC_MESSAGES/messages.po @@ -0,0 +1,193 @@ +# Turkish translations for FastAPI Admin. +# Copyright (C) 2021 ORGANIZATION +# This file is distributed under the same license as the FastAPI Admin project. +# FIRST AUTHOR , 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2021-08-06 23:07+0800\n" +"PO-Revision-Date: 2024-03-01 02:39+0300\n" +"Last-Translator: Hasan Sezer Taşan \n" +"Language: tr_TR\n" +"Language-Team: tr_TR \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.12.1\n" + +#: fastapi_admin/resources.py:91 +msgid "create" +msgstr "Oluştur" + +#: fastapi_admin/resources.py:112 +msgid "update" +msgstr "Güncelle" + +#: fastapi_admin/resources.py:114 +msgid "delete" +msgstr "Sil" + +#: fastapi_admin/resources.py:120 +msgid "delete_selected" +msgstr "Seçili öğeleri sil" + +#: fastapi_admin/providers/login.py:90 +msgid "login_failed" +msgstr "Giriş başarısız" + +#: fastapi_admin/providers/login.py:161 +msgid "confirm_password_different" +msgstr "Şifreler farklı" + +#: fastapi_admin/providers/login.py:196 +msgid "old_password_error" +msgstr "Eski şifre hatalı" + +#: fastapi_admin/providers/login.py:198 +msgid "new_password_different" +msgstr "Yeni şifre farklı" + +#: fastapi_admin/templates/create.html:14 +#: fastapi_admin/templates/update.html:16 +msgid "save" +msgstr "Kaydet" + +#: fastapi_admin/templates/create.html:16 +msgid "save_and_add_another" +msgstr "Kaydet ve başka bir tane ekle" + +#: fastapi_admin/templates/create.html:18 +#: fastapi_admin/templates/update.html:29 +msgid "return" +msgstr "Geri dön" + +#: fastapi_admin/templates/init.html:10 +msgid "Create first admin" +msgstr "İlk yöneticiyi oluştur" + +#: fastapi_admin/templates/init.html:12 +#: fastapi_admin/templates/providers/login/login.html:44 +msgid "username" +msgstr "Kullanıcı adı" + +#: fastapi_admin/templates/init.html:14 +msgid "username_placeholder" +msgstr "Kullanıcı adını girin" + +#: fastapi_admin/templates/init.html:18 +#: fastapi_admin/templates/providers/login/login.html:54 +msgid "password" +msgstr "Şifre" + +#: fastapi_admin/templates/init.html:23 +msgid "password_placeholder" +msgstr "Şifreyi girin" + +#: fastapi_admin/templates/init.html:31 +msgid "confirm_password" +msgstr "Şifreyi onayla" + +#: fastapi_admin/templates/init.html:36 +msgid "confirm_password_placeholder" +msgstr "Şifreyi tekrar girin" + +#: fastapi_admin/templates/init.html:43 +#: fastapi_admin/templates/providers/login/password.html:32 +msgid "submit" +msgstr "Gönder" + +#: fastapi_admin/templates/list.html:13 +msgid "show" +msgstr "Göster" + +#: fastapi_admin/templates/list.html:24 +msgid "entries" +msgstr "Kayıtlar" + +#: fastapi_admin/templates/list.html:33 +msgid "search" +msgstr "Ara" + +#: fastapi_admin/templates/list.html:46 +msgid "bulk_actions" +msgstr "Toplu işlemler" + +#: fastapi_admin/templates/list.html:125 +msgid "actions" +msgstr "İşlemler" + +#: fastapi_admin/templates/list.html:156 +#, python-format +msgid "Showing %(from)s to %(to)s of %(total)s entries" +msgstr "Toplam %(total)s kayıttan %(from)s ile %(to)s arası kayıt gösteriliyor." + +#: fastapi_admin/templates/list.html:167 +msgid "prev_page" +msgstr "Önceki" + +#: fastapi_admin/templates/list.html:188 +msgid "next_page" +msgstr "Sonraki" + +#: fastapi_admin/templates/update.html:23 +msgid "save_and_return" +msgstr "Kaydet ve geri dön" + +#: fastapi_admin/templates/errors/403.html:21 +#: fastapi_admin/templates/errors/404.html:21 +#: fastapi_admin/templates/errors/500.html:21 +msgid "return_home" +msgstr "Beni anasayfaya götür" + +#: fastapi_admin/templates/providers/login/avatar.html:18 +#: fastapi_admin/templates/providers/login/password.html:6 +msgid "update_password" +msgstr "Şifreyi güncelle" + +#: fastapi_admin/templates/providers/login/avatar.html:24 +msgid "logout" +msgstr "Çıkış yap" + +#: fastapi_admin/templates/providers/login/login.html:49 +msgid "login_username_placeholder" +msgstr "Kullanıcı adını girin" + +#: fastapi_admin/templates/providers/login/login.html:59 +msgid "login_password_placeholder" +msgstr "Şifreyi girin" + +#: fastapi_admin/templates/providers/login/login.html:75 +msgid "remember_me" +msgstr "Beni hatırla" + +#: fastapi_admin/templates/providers/login/login.html:80 +msgid "sign_in" +msgstr "Giriş yap" + +#: fastapi_admin/templates/providers/login/password.html:12 +msgid "old_password" +msgstr "Eski şifre" + +#: fastapi_admin/templates/providers/login/password.html:15 +msgid "old_password_placeholder" +msgstr "Eski şifreyi girin" + +#: fastapi_admin/templates/providers/login/password.html:19 +msgid "new_password" +msgstr "Yeni şifre" + +#: fastapi_admin/templates/providers/login/password.html:22 +msgid "new_password_placeholder" +msgstr "Yeni şifreyi girin" + +#: fastapi_admin/templates/providers/login/password.html:26 +msgid "re_new_password" +msgstr "Yeni şifreyi onaylayın" + +#: fastapi_admin/templates/providers/login/password.html:29 +msgid "re_new_password_placeholder" +msgstr "Yeni şifreyi tekrar girin" + diff --git a/fastapi_admin/locales/zh_CN/LC_MESSAGES/messages.po b/fastapi_admin/locales/zh_CN/LC_MESSAGES/messages.po index b36eb69a..df3690f6 100644 --- a/fastapi_admin/locales/zh_CN/LC_MESSAGES/messages.po +++ b/fastapi_admin/locales/zh_CN/LC_MESSAGES/messages.po @@ -7,16 +7,16 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2021-08-06 23:07+0800\n" +"POT-Creation-Date: 2024-08-28 10:24+0100\n" "PO-Revision-Date: 2021-04-16 22:46+0800\n" "Last-Translator: FULL NAME \n" "Language: zh_Hans_CN\n" "Language-Team: zh_Hans_CN \n" -"Plural-Forms: nplurals=1; plural=0\n" +"Plural-Forms: nplurals=1; plural=0;\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.1\n" +"Generated-By: Babel 2.14.0\n" #: fastapi_admin/resources.py:91 msgid "create" @@ -115,27 +115,32 @@ msgstr "查询" msgid "bulk_actions" msgstr "批量操作" -#: fastapi_admin/templates/list.html:125 +#: fastapi_admin/templates/list.html:139 msgid "actions" msgstr "动作" -#: fastapi_admin/templates/list.html:156 +#: fastapi_admin/templates/list.html:170 #, python-format msgid "Showing %(from)s to %(to)s of %(total)s entries" msgstr "显示 %(from)s 到 %(to)s 共 %(total)s 项" -#: fastapi_admin/templates/list.html:167 +#: fastapi_admin/templates/list.html:181 msgid "prev_page" msgstr "上一页" -#: fastapi_admin/templates/list.html:188 +#: fastapi_admin/templates/list.html:202 msgid "next_page" msgstr "下一页" +#: fastapi_admin/templates/list.html:214 +msgid "delete_confirmation" +msgstr "您确定要删除该项目吗?" + #: fastapi_admin/templates/update.html:23 msgid "save_and_return" msgstr "保存并返回" +#: fastapi_admin/templates/errors/401.html:21 #: fastapi_admin/templates/errors/403.html:21 #: fastapi_admin/templates/errors/404.html:21 #: fastapi_admin/templates/errors/500.html:21 diff --git a/fastapi_admin/providers/login.py b/fastapi_admin/providers/login.py index bec3e02d..ba6ff6f2 100644 --- a/fastapi_admin/providers/login.py +++ b/fastapi_admin/providers/login.py @@ -119,7 +119,7 @@ async def authenticate( request: Request, call_next: RequestResponseEndpoint, ): - redis = request.app.redis # type:Redis + redis = request.app.redis # type:ignore token = request.cookies.get(self.access_token) path = request.scope["path"] admin = None diff --git a/fastapi_admin/routes/resources.py b/fastapi_admin/routes/resources.py index 42c7726c..ebdda047 100644 --- a/fastapi_admin/routes/resources.py +++ b/fastapi_admin/routes/resources.py @@ -1,3 +1,5 @@ +from typing import Optional + from fastapi import APIRouter, Depends, Path from jinja2 import TemplateNotFound from starlette.requests import Request @@ -25,6 +27,7 @@ async def list_view( resource: str = Path(...), page_size: int = 10, page_num: int = 1, + order_by: Optional[str] = None, ): fields_label = model_resource.get_fields_label() fields = model_resource.get_fields() @@ -33,6 +36,8 @@ async def list_view( params, qs = await model_resource.resolve_query_params(request, dict(request.query_params), qs) filters = await model_resource.get_filters(request, params) total = await qs.count() + if order_by: + qs = qs.order_by(order_by) if page_size: qs = qs.limit(page_size) else: diff --git a/fastapi_admin/templates/components/language.html b/fastapi_admin/templates/components/language.html index 3a8c7a45..b276bcff 100644 --- a/fastapi_admin/templates/components/language.html +++ b/fastapi_admin/templates/components/language.html @@ -30,5 +30,13 @@ href="{{ {'language':'fa_IR'}|current_page_with_params }}"> 🇮🇷Persian + + 🇵🇾Español + + + 🇹🇷Türkçe + diff --git a/fastapi_admin/templates/layout.html b/fastapi_admin/templates/layout.html index 3ed58edc..f6c13302 100644 --- a/fastapi_admin/templates/layout.html +++ b/fastapi_admin/templates/layout.html @@ -15,6 +15,12 @@

{% endif %} +