From e0d906e6aa52594cc268218ef463e66a6083abf4 Mon Sep 17 00:00:00 2001 From: Abner G Jacobsen Date: Fri, 25 Oct 2024 15:51:02 -0300 Subject: [PATCH] Add Portuguese translation (#480) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add Portuguese translation * 🔥 remove(i18n.py): remove pt_BR from SUPPORTED_LOCALES due to error in get_locale_display_name * 🔥 remove(pt_BR): Remove Portuguese (Brazil) language support This commit removes the Portuguese (Brazil) language support from the application. This includes the removal of translation files, momentjs, flatpickr, and admin.po files. * 🌐 i18n(starlette_admin): Improve Portuguese translations and remove Brazilian Portuguese support - Corrected spelling errors in 'pt.json' file - Updated translation for 'New %(name)s' in 'admin.po' file - Adjusted test case in 'test_i18n.py' to reflect changes in Portuguese translation - Removed 'pt_BR' from SUPPORTED_LOCALES in 'i18n.py' as it's no longer needed * feat: adicionado tradução de botão de busca no filtro * Delete starlette-admin.code-workspace * minor fixes --------- Co-authored-by: Breno-de-Angelo Co-authored-by: GuilhermeAumo <160528382+GuilhermeAumo@users.noreply.github.com> Co-authored-by: Jocelin Hounon --- starlette_admin/i18n.py | 1 + starlette_admin/statics/i18n/dt/pt.json | 176 ++++++++++++++++ starlette_admin/statics/i18n/flatpickr/pt.js | 7 + starlette_admin/statics/i18n/momentjs/pt.js | 12 ++ .../translations/pt/LC_MESSAGES/admin.mo | Bin 0 -> 2396 bytes .../translations/pt/LC_MESSAGES/admin.po | 191 ++++++++++++++++++ tests/test_i18n.py | 1 + 7 files changed, 388 insertions(+) create mode 100644 starlette_admin/statics/i18n/dt/pt.json create mode 100644 starlette_admin/statics/i18n/flatpickr/pt.js create mode 100644 starlette_admin/statics/i18n/momentjs/pt.js create mode 100644 starlette_admin/translations/pt/LC_MESSAGES/admin.mo create mode 100644 starlette_admin/translations/pt/LC_MESSAGES/admin.po diff --git a/starlette_admin/i18n.py b/starlette_admin/i18n.py index 2c20f1bc..8cec90b7 100644 --- a/starlette_admin/i18n.py +++ b/starlette_admin/i18n.py @@ -13,6 +13,7 @@ "de", # German "en", # English "fr", # French + "pt", # Portuguese "ru", # Russian "tr", # Turkish ] diff --git a/starlette_admin/statics/i18n/dt/pt.json b/starlette_admin/statics/i18n/dt/pt.json new file mode 100644 index 00000000..eda00ea4 --- /dev/null +++ b/starlette_admin/statics/i18n/dt/pt.json @@ -0,0 +1,176 @@ +{ + "aria": { + "sortAscending": ": Ordenar colunas de forma ascendente", + "sortDescending": ": Ordenar colunas de forma descendente" + }, + "buttons": { + "collection": "Coleção", + "colvis": "Visibilidade de colunas", + "colvisRestore": "Restaurar visibilidade", + "copy": "Copiar", + "copyKeys": "Pressionar CTRL ou u2318 + C para copiar a informação para a área de transferência. Para cancelar, clique nesta mensagem ou pressione ESC.", + "copySuccess": { + "1": "Uma linha copiada para a área de transferência", + "_": "%ds linhas copiadas para a área de transferência" + }, + "copyTitle": "Copiar para a área de transferência", + "createState": "Criar", + "csv": "CSV", + "excel": "Excel", + "pageLength": { + "-1": "Mostrar todas as linhas", + "_": "Mostrar %d linhas" + }, + "pdf": "PDF", + "print": "Imprimir", + "removeAllStates": "Remover Todos", + "removeState": "Remover", + "renameState": "Renomear", + "savedStates": "Gravados", + "stateRestore": "Estado %d", + "updateState": "Atualizar" + }, + "datetime": { + "amPm": [ + "am", + "pm" + ], + "hours": "horas", + "minutes": "minutos", + "months": [ + "Janeiro", + "Fevereiro", + "Março", + "Abril", + "Maio", + "Junho", + "Julho", + "Agosto", + "Setembro", + "Outubro", + "Novembro", + "Dezembro" + ], + "next": "próximo", + "previous": "anterior", + "seconds": "segundos", + "unknown": "desconhecido", + "weekdays": [ + "Seg", + "Ter", + "Qua", + "Qui", + "Sex", + "Sáb", + "Dom" + ] + }, + "decimal": ",", + "emptyTable": "Não foi encontrado nenhum registo", + "info": "Mostrando os registos _START_ a _END_ num total de _TOTAL_", + "infoEmpty": "Mostrando 0 os registos num total de 0", + "infoFiltered": "(filtrado num total de _MAX_ registos)", + "infoThousands": ".", + "lengthMenu": "Mostrar _MENU_ registos", + "loadingRecords": "Carregando...", + "paginate": { + "first": "Primeiro", + "last": "Último", + "next": "Seguinte", + "previous": "Anterior" + }, + "processing": "Processando...", + "search": "Procurar:", + "searchBuilder": { + "add": "Adicionar condição", + "search": "Buscar", + "button": { + "0": " Construtor de pesquisa", + "_": " Construtor de pesquisa (%d)" + }, + "clearAll": "Limpar tudo", + "condition": "Condição", + "conditions": { + "array": { + "contains": "Contém", + "empty": "Vazio", + "equals": "Igual", + "not": "Diferente", + "notEmpty": "Não está vazio", + "without": "Sem" + }, + "date": { + "after": "Depois", + "before": "Antes", + "between": "Entre", + "empty": "Vazio", + "equals": "Igual", + "not": "Diferente", + "notBetween": "Não está entre", + "notEmpty": "Não está vazio" + }, + "number": { + "between": "Entre", + "empty": "Vazio", + "equals": "Igual", + "gt": "Maior que", + "gte": "Maior ou igual a", + "lt": "Menor que", + "lte": "Menor ou igual a", + "not": "Diferente", + "notBetween": "Não está entre", + "notEmpty": "Não está vazio" + }, + "string": { + "contains": "Contém", + "empty": "Vazio", + "endsWith": "Termina em", + "equals": "Igual", + "not": "Diferente", + "notContains": "Não contém", + "notEmpty": "Não está vazio", + "notEndsWith": "Não termina com", + "notStartsWith": "Não começa com", + "startsWith": "Começa em" + } + }, + "data": "Dados", + "deleteTitle": "Excluir condição de filtragem", + "leftTitle": "Excluir critério", + "logicAnd": "E", + "logicOr": "Ou", + "rightTitle": "Incluir critério", + "title": { + "0": "Construtor de pesquisa", + "_": "Construtor de pesquisa (%d)" + }, + "value": "Valor" + }, + "select": { + "cells": { + "1": "1 célula selecionada", + "_": "%d células selecionadas" + }, + "columns": { + "1": "1 coluna selecionada", + "_": "%d colunas selecionadas" + }, + "rows": { + "1": "%d linha selecionada", + "_": "%d linhas selecionadas" + } + }, + "starlette-admin": { + "buttons": { + "export": "Exportar" + }, + "conditions": { + "empty": "Vazia", + "false": "Falso", + "notEmpty": "Não está vazio", + "true": "Verdadeiro" + } + }, + "thousands": ".", + "zeroRecords": "Não foram encontrados resultados" +} diff --git a/starlette_admin/statics/i18n/flatpickr/pt.js b/starlette_admin/statics/i18n/flatpickr/pt.js new file mode 100644 index 00000000..4209353b --- /dev/null +++ b/starlette_admin/statics/i18n/flatpickr/pt.js @@ -0,0 +1,7 @@ +/** + * Minified by jsDelivr using Terser v5.10.0. + * Original file: /npm/flatpickr@4.6.13/dist/l10n/pt.js + * + * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files + */ +!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).pt={})}(this,(function(e){"use strict";var o="undefined"!=typeof window&&void 0!==window.flatpickr?window.flatpickr:{l10ns:{}},a={weekdays:{shorthand:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],longhand:["Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"]},months:{shorthand:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],longhand:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"]},rangeSeparator:" até ",time_24hr:!0};o.l10ns.pt=a;var n=o.l10ns;e.Portuguese=a,e.default=n,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/starlette_admin/statics/i18n/momentjs/pt.js b/starlette_admin/statics/i18n/momentjs/pt.js new file mode 100644 index 00000000..a172ef16 --- /dev/null +++ b/starlette_admin/statics/i18n/momentjs/pt.js @@ -0,0 +1,12 @@ +/** + * Minified by jsDelivr using Terser v5.14.1. + * Original file: /npm/moment@2.29.4/locale/pt.js + * + * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files + */ +//! moment.js locale configuration +//! locale : Portuguese [pt] +//! author : Jefferson : https://github.com/jalex79 +!function(e,a){"object"==typeof exports&&"undefined"!=typeof module&&"function"==typeof require?a(require("../moment")):"function"==typeof define&&define.amd?define(["../moment"],a):a(e.moment)}(this,(function(e){"use strict"; +//! moment.js locale configuration +return e.defineLocale("pt",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Do_2ª_3ª_4ª_5ª_6ª_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",w:"uma semana",ww:"%d semanas",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})})); diff --git a/starlette_admin/translations/pt/LC_MESSAGES/admin.mo b/starlette_admin/translations/pt/LC_MESSAGES/admin.mo new file mode 100644 index 0000000000000000000000000000000000000000..ac32f6c3ad180a5cd1d8d418d5500247fa4b6d0c GIT binary patch literal 2396 zcma)+-)kII6vuD1+L~IGQmu;O6|5xEX?HhO1_fPa=QDTa+;h%7 z_uTJKySBb1@Ov2l`|xjU;nDE-+zmo(!|-`HVJ~80jfG5GN`2GyYeie8EG$6 zVFv7hm?B;PIsSRD3BC=EfWLxwgTH}DNoQYUIr zB(*@rv8Y*+>n4*f8$9$>>ZLa_qL@5M2ZWvqFYd^H+WU@nc|@3c zZ}m#%NldFWq*zRMC_DpKxy>*{m|05*8k*EI&1zw>sws}dv?T=>GkH3IS2`B;Nc;RI z_l~A2p)n_Bu}axf4l4;ma&9$?vSWCK{O7ufZogsLa9fJ@j9a%1>SXOa{yQZFanwPlI1L739 zeR9E?kSHn!gDz3%B)mV3IKgZbER%I;zp8XzS+tR-Kym-c<@(~%?EKuwB6W@RLDRK$ z6dcRiE@+vmtT$`3jia@hnZ^3j(#XPmE66t=o`M*fo^%LCdPt#oYc?dHiIfA?Iq%x;(Tg^kJB$ z?F@TSm0f>r5VS}o{6-#XG>*o4zp?GZBMWh6RU8~QHgQ#%cJrZ|s!Yn_acVS`4^GMQ z*yKoawpkz6ro6v2GF`NM&|2>zmZ!7+KsQ!8os?lmSx0^<^Q*zc(2lcTB^%V!&~Tep z<;05iBPS>&oM}Qa*Q@dv@3O4yFOMUHsP!-PKPQ#~9il|aN;rz&F(NPgOI;|v~4dYB(Y4RhU;;eCNu~W=D@;@e$gQTz?u{z}9UR#_W2LTdojshjMk`*EkDU@->;5&%@(v z>S8th%kUYRgv9`=VZK}PW!N>e}*)Fkf=l8`o@l7GhgO@fjylFvTc9did8 zPY8+(H*}@Wxns2?V_Jh_1Ci-pMu$LLvi=2&2Z#$gZCRs0u|5amX)gY-k4D`XbGd`kKZwfP&S@R5uF literal 0 HcmV?d00001 diff --git a/starlette_admin/translations/pt/LC_MESSAGES/admin.po b/starlette_admin/translations/pt/LC_MESSAGES/admin.po new file mode 100644 index 00000000..812a5459 --- /dev/null +++ b/starlette_admin/translations/pt/LC_MESSAGES/admin.po @@ -0,0 +1,191 @@ +# Portuguese translations for starlette-admin. +# Copyright (C) 2023 ORGANIZATION +# This file is distributed under the same license as the starlette-admin +# project. +# FIRST AUTHOR , 2023. +# +msgid "" +msgstr "" +"Project-Id-Version: starlette-admin VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2023-10-28 16:32-0500\n" +"PO-Revision-Date: 2024-01-18 22:30-0300\n" +"Last-Translator: FULL NAME \n" +"Language: pt\n" +"Language-Team: pt \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" + +#: starlette_admin/actions.py:11 starlette_admin/actions.py:107 +#: starlette_admin/templates/modals/actions.html:12 +msgid "Yes, Proceed" +msgstr "Sim, Prosseguir" + +#: starlette_admin/auth.py:31 +msgid "Administrator" +msgstr "Administrador" + +#: starlette_admin/base.py:44 starlette_admin/contrib/odmantic/admin.py:17 +#: starlette_admin/contrib/sqla/admin.py:28 +#: starlette_admin/templates/create.html:7 +#: starlette_admin/templates/detail.html:8 +#: starlette_admin/templates/edit.html:7 starlette_admin/templates/list.html:7 +msgid "Admin" +msgstr "Admin" + +#: starlette_admin/base.py:254 +#, python-format +msgid "Model with identity %(identity)s not found" +msgstr "Modelo com identidade %(identity)s não encontrado" + +#: starlette_admin/templates/forms/_delete.html:8 +#: starlette_admin/templates/modals/delete.html:25 starlette_admin/views.py:461 +#: starlette_admin/views.py:498 +msgid "Delete" +msgstr "Excluir" + +#: starlette_admin/views.py:462 +msgid "Are you sure you want to delete selected items?" +msgstr "Tem certeza de que deseja excluir os itens selecionados?" + +#: starlette_admin/views.py:463 +msgid "Yes, delete all" +msgstr "Sim, exclua tudo" + +#: starlette_admin/views.py:468 starlette_admin/views.py:507 +#, python-format +msgid "Item was successfully deleted" +msgid_plural "%(count)d items were successfully deleted" +msgstr[0] "O item foi excluído com sucesso" +msgstr[1] "%(count)d itens foram excluídos com sucesso" + +#: starlette_admin/views.py:476 +msgid "View" +msgstr "Visualizar" + +#: starlette_admin/templates/edit.html:12 starlette_admin/views.py:488 +msgid "Edit" +msgstr "Editar" + +#: starlette_admin/templates/modals/delete.html:15 starlette_admin/views.py:499 +msgid "Are you sure you want to delete this item?" +msgstr "Tem certeza de que deseja excluir este item?" + +#: starlette_admin/views.py:818 +msgid "All" +msgstr "Todos" + +#: starlette_admin/templates/actions.html:6 +msgid "With selected" +msgstr "Com selecionado(s)" + +#: starlette_admin/templates/create.html:12 +msgid "Create" +msgstr "Criar" + +#: starlette_admin/templates/create.html:25 +#: starlette_admin/templates/list.html:34 +#, python-format +msgid "New %(name)s" +msgstr "Novo(a) %(name)s" + +#: starlette_admin/templates/create.html:44 +#: starlette_admin/templates/edit.html:46 +#: starlette_admin/templates/modals/actions.html:10 +#: starlette_admin/templates/modals/delete.html:21 +msgid "Cancel" +msgstr "Cancelar" + +#: starlette_admin/templates/create.html:46 +#: starlette_admin/templates/edit.html:48 +msgid "Save and add another" +msgstr "Salvar e adicione outro" + +#: starlette_admin/templates/create.html:48 +#: starlette_admin/templates/edit.html:50 +msgid "Save and continue editing" +msgstr "Salvar e continue editando" + +#: starlette_admin/templates/create.html:49 +#: starlette_admin/templates/edit.html:51 +msgid "Save" +msgstr "Salvar" + +#: starlette_admin/templates/detail.html:13 +msgid "Detail" +msgstr "Detalhe" + +#: starlette_admin/templates/detail.html:47 +msgid "Attribute" +msgstr "Atributo" + +#: starlette_admin/templates/detail.html:48 +msgid "Value" +msgstr "Valor" + +#: starlette_admin/templates/edit.html:27 +#, python-format +msgid "Edit %(name)s" +msgstr "Editar %(name)s" + +#: starlette_admin/templates/error.html:7 +msgid "Oops… You just found an error page" +msgstr "Ops… Você acabou de encontrar uma página de erro" + +#: starlette_admin/templates/error.html:29 +msgid "Take me home" +msgstr "Me leve ao início" + +#: starlette_admin/templates/layout.html:95 +#: starlette_admin/templates/layout.html:118 +#: starlette_admin/templates/layout.html:204 +msgid "Logout" +msgstr "Sair" + +#: starlette_admin/templates/list.html:67 +msgid "Search" +msgstr "Procurar" + +#: starlette_admin/templates/login.html:16 +msgid "Login to your account" +msgstr "Faça login na sua conta" + +#: starlette_admin/templates/login.html:32 +msgid "Username" +msgstr "Usuário" + +#: starlette_admin/templates/login.html:43 +msgid "Password" +msgstr "Senha" + +#: starlette_admin/templates/login.html:56 +msgid "Remember me" +msgstr "Lembre de mim" + +#: starlette_admin/templates/login.html:60 +msgid "Sign in" +msgstr "Entrar" + +#: starlette_admin/templates/row-actions.html:38 +msgid "Actions" +msgstr "Ações" + +#: starlette_admin/templates/forms/_delete.html:13 +msgid "Checked this to delete current content of this field" +msgstr "Marquei isto para excluir o conteúdo atual deste campo" + +#: starlette_admin/templates/forms/enum.html:5 +#, python-format +msgid "Select a %(label)s" +msgstr "Selecione um %(label)s" + +#: starlette_admin/templates/forms/list.html:44 +msgid "Add item" +msgstr "Adicionar Item" + +#: starlette_admin/templates/modals/loading.html:7 +msgid "Loading" +msgstr "Carregando" diff --git a/tests/test_i18n.py b/tests/test_i18n.py index 26f63d18..564259e1 100644 --- a/tests/test_i18n.py +++ b/tests/test_i18n.py @@ -51,6 +51,7 @@ class PostView(DummyModelView): ("fr", "Créer Post"), ("ru", "Добавить Post"), ("tr", "Yeni Post"), + ("pt", "Novo(a) Post"), ], ) def test_default_locale(locale, expected_text):