From afaed872df4b2ad6907d9d776d9b293fe818d2b6 Mon Sep 17 00:00:00 2001 From: kterva Date: Thu, 22 May 2025 19:23:53 -0300 Subject: [PATCH 1/4] =?UTF-8?q?Adicionada=20fun=C3=A7=C3=A3o=20de=20intern?= =?UTF-8?q?acionaliza=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/spam-add-config/template.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/spam-add-config/template.php b/components/spam-add-config/template.php index 0cf9aa0..9bb7cfb 100644 --- a/components/spam-add-config/template.php +++ b/components/spam-add-config/template.php @@ -29,6 +29,8 @@
+ +
@@ -41,6 +43,8 @@
+ +
@@ -49,4 +53,4 @@ - \ No newline at end of file + From 199d0329cb73e2a423ff60f503881d67d1d3f775 Mon Sep 17 00:00:00 2001 From: leonardo Date: Wed, 4 Jun 2025 12:04:43 -0300 Subject: [PATCH 2/4] Update $pattern by Kike --- Plugin.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Plugin.php b/Plugin.php index 3120858..6c25902 100644 --- a/Plugin.php +++ b/Plugin.php @@ -396,8 +396,7 @@ public function getSpamTerms($entity, $terms): array { $lowercase_term = $this->formatText($term); $_term = implode("{$special_chars}", mb_str_split($lowercase_term)); - $pattern = '/([^\w]|[_0-9]|^)' . $_term . '([^\w]|[_0-9]|$)/'; - + $pattern = '/([^\w]|[_0-9]|^)' . preg_quote($_term, '/') . '([^\w]|[_0-9]|$)/'; if (preg_match($pattern, $lowercase_value) && !in_array($term, $found_terms)) { $found_terms[$field][] = $term; } From 51018b721763897438cb45ca47107f64d0aa9f64 Mon Sep 17 00:00:00 2001 From: leonardo Date: Mon, 16 Jun 2025 14:04:01 -0300 Subject: [PATCH 3/4] Update Plugin.php traducciones --- Plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugin.php b/Plugin.php index 6c25902..615dc16 100644 --- a/Plugin.php +++ b/Plugin.php @@ -228,7 +228,7 @@ public function createNotification($recipient, $entity, $spam_detections, $ip) $detected_details = []; foreach ($spam_detections as $detection) { $translated_field = isset($field_translations[$detection['field']]) ? $field_translations[$detection['field']] : $detection['field']; - $detected_details[] = "Campo: $translated_field, Termos: " . implode(', ', $detection['terms']) . '
'; + $detected_details[] = "Campo: $translated_field, Términos: " . implode(', ', $detection['terms']) . '
'; } $dict_entity = $this->dictEntity($entity, 'artigo'); From f0293c2b5b3ff9b73e5064b6ef8b8bbfee64fb82 Mon Sep 17 00:00:00 2001 From: kterva Date: Mon, 16 Jun 2025 15:19:52 -0300 Subject: [PATCH 4/4] =?UTF-8?q?Adiciona=20tradu=C3=A7=C3=A3o=20para=20labe?= =?UTF-8?q?ls=20est=C3=A1ticas=20"Campo"=20e=20"Termos"=20e=20corrige=20in?= =?UTF-8?q?ternacionaliza=C3=A7=C3=A3o=20no=20assunto=20do=20e-mail=20de?= =?UTF-8?q?=20detec=C3=A7=C3=A3o=20de=20spam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Envolve as palavras "Campo" e "Termos" na função i::__ para que possam ser detectadas pelo Poedit e traduzidas. - Ajusta o assunto do e-mail para usar corretamente a função i::__ com comentário para tradutores, garantindo clareza na tradução da mensagem. - Mantém a estrutura e formato original das mensagens. - Facilita a internacionalização sem alterar a lógica existente. - Actualiza archivo de traducción --- Plugin.php | 89 ++++++++++++++++++++-------------- translations/es_ES.mo | Bin 3335 -> 3873 bytes translations/es_ES.po | 110 +++++++++++++++++++++++++++--------------- 3 files changed, 123 insertions(+), 76 deletions(-) diff --git a/Plugin.php b/Plugin.php index 615dc16..d826d31 100644 --- a/Plugin.php +++ b/Plugin.php @@ -228,7 +228,7 @@ public function createNotification($recipient, $entity, $spam_detections, $ip) $detected_details = []; foreach ($spam_detections as $detection) { $translated_field = isset($field_translations[$detection['field']]) ? $field_translations[$detection['field']] : $detection['field']; - $detected_details[] = "Campo: $translated_field, Términos: " . implode(', ', $detection['terms']) . '
'; + $detected_details[] = i::__("Campo") . ": " . $translated_field . ", " . i::__("Termos") . ": " . implode(', ', $detection['terms']) . "
"; } $dict_entity = $this->dictEntity($entity, 'artigo'); @@ -254,14 +254,19 @@ public function createNotification($recipient, $entity, $spam_detections, $ip) $content = $mustache->render($template, $params); if ($email = $this->getAdminEmail($recipient)) { - $app->createAndSendMailMessage([ - 'from' => $app->config['mailer.from'], - 'to' => $email, - 'subject' => $is_save ? i::__("Spam - Conteúdo suspeito") : i::__("Spam - {$dict_entity} foi bloqueado(a)"), - 'body' => $content, - ]); - } + // TRANSLATORS: Subject of email reporting content flagged as suspicious or blocked + $subject = $is_save + ? i::__("Spam - Conteúdo suspeito") : sprintf(i::__("Spam - %s foi bloqueado(a)"), $dict_entity); + + $app->createAndSendMailMessage([ + 'from' => $app->config['mailer.from'], + 'to' => $email, + 'subject' => $subject, + 'body' => $content, + ]); + } + // Salvar metadado $date_time = new DateTime(); $date_time->add(new \DateInterval('PT10S')); @@ -286,37 +291,49 @@ public function createNotification($recipient, $entity, $spam_detections, $ip) * @return string */ public function dictEntity(Entity $entity, $type = "preposição"): string - { - $class = $entity->getClassName(); + { + $class = $entity->getClassName(); + + switch ($type) { + case 'preposição': + // TRANSLATORS: 'na' and 'no' are prepositions meaning 'in the (f)' and 'in the (m)' + $prefixes = (object) [ + 'f' => i::__('na'), // feminino + 'm' => i::__('no'), // masculino + ]; + break; + case 'pronome': + // TRANSLATORS: 'esta' and 'este' are demonstrative pronouns (this-f, this-m) + $prefixes = (object) [ + 'f' => i::__('esta'), + 'm' => i::__('este'), + ]; + break; + case 'artigo': + // TRANSLATORS: 'a' and 'o' are definite articles (the-f, the-m) + $prefixes = (object) [ + 'f' => i::__('a'), + 'm' => i::__('o'), + ]; + break; + case 'none': + default: + $prefixes = (object) ['f' => '', 'm' => '']; + break; + } - switch ($type) { - case 'preposição': - $prefixes = (object) ["f" => "na", "m" => "no"]; - break; - case 'pronome': - $prefixes = (object) ["f" => "esta", "m" => "este"]; - break; - case 'artigo': - $prefixes = (object) ["f" => "a", "m" => "o"]; - break; - case 'none': - $prefixes = (object) ["f" => "", "m" => ""]; - break; - default: - $prefixes = (object) ["f" => "", "m" => ""]; - break; - } + $entities = [ + // TRANSLATORS: %s is a prefix like 'na', 'esta', 'a' + Agent::class => sprintf(i::__('%s Agente'), $prefixes->m), + Opportunity::class => sprintf(i::__('%s Oportunidade'), $prefixes->f), + Project::class => sprintf(i::__('%s Projeto'), $prefixes->m), + Space::class => sprintf(i::__('%s Espaço'), $prefixes->m), + Event::class => sprintf(i::__('%s Evento'), $prefixes->m), + ]; - $entities = [ - Agent::class => "{$prefixes->m} Agente", - Opportunity::class => "{$prefixes->f} Oportunidade", - Project::class => "{$prefixes->m} Projeto", - Space::class => "{$prefixes->m} Espaço", - Event::class => "{$prefixes->m} Evento", - ]; + return $entities[$class]; +} - return $entities[$class]; - } /** * Retorna o texto com o nome da tabela diff --git a/translations/es_ES.mo b/translations/es_ES.mo index 495947e4aff06522c147bebaa85969583057682e..d482ace66c2e38da8a442a0f95cc10c4275c0e84 100644 GIT binary patch delta 1202 zcmZ|OOGs2v7{KvwMyDpH#%AoPX}5BGKomj`Oek6u=tdJo2nnvv$wtO|$C*(u7gJCg zv^aNEKI|$2hVXxq^Fe0Glw4TKb~zA~qA3F^+4#U$Bliz{B;^ z*5f>$!%keo0-Kh^&dm}Y$D70*_y}Ji*GTWK%@STiec%+5tCUa^oWoQ26g9C`)C#Wq zZXiGT#-P^+`Ce)`O8vE@Q5Lk6F}#g6cppptI#cfuX%+Na>Os>7>iN(e>r3_QXw!r> zIc*7gBmFR4E31u1ibdBm$Noi*c@q&fD;(0T*0446PcE?@AUz9OwR*bl;wXI|U7J=% zORb+tE1)Nxui!P^sQ#B7(I}C#E{+%{-)3}rDVMRApSj+2l2vckopH1I2`81blio!= zS$EXr-C|F$qrx7`l^cFfI*U7QS^Z8W*O zEeu9RmlrIJtYJH8=ki(Z5XTnBmGaxrbg=zTT3cBSr~aRnrb|*&W|*wn!=066<(6-S zt1G;;Cd|KS%|`00`<9ooV=0HsZt!}$xEQ(I^f$XH+sc}el%JPztTbsmmPw0Am%m41 Ff#3MasPF&) delta 693 zcmYk)KWGzC9Ki8ka`~gF7n3uoX)Kb(6mf7-ln4#96x*pS7%c^d!#gA$nv#o%Mu-9b z(T+#Eh>$>CgidjiI!HRW=$=7w_0K9rC%?Z-3jW~T=ia+__ulXKu6y=*zV+3LYzvX6 zP11hR&e8TmT!^Kx$T3{Ti@1te+{7vDUTDc$rHQOZWsA@ELx_I98$}6L=fX<9!^%E}p_YWNrC?9v)y5uf{~4lGIz&@07@D zn)PLdn+yYOEaDEH#P=gVp=SC8EsP!?n!_{nFQ8WLI(E>(1&k&{SW6aB6S|2H(Z!ee z4aZnt9&emQhQpo6-M6vp5Q^1PKKH#?hEMPV?Uw*LpvVLD-tDtvB5M zJEvCg?s*$-wNdl`#;#av{cgea8g}81?bu$UZack7yczZriTU12!ZiHHX4Zdg&Y2JF QLfySv4W`t3sbo6z4`gUgu>b%7 diff --git a/translations/es_ES.po b/translations/es_ES.po index 3f0a877..79f13e6 100644 --- a/translations/es_ES.po +++ b/translations/es_ES.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: mapas\n" -"POT-Creation-Date: 2025-05-08 14:53-0300\n" +"POT-Creation-Date: 2025-06-16 14:48-0300\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: librecoop\n" @@ -24,19 +24,27 @@ msgstr "Fecha de envío del correo electrónico" msgid "Classificar como Spam" msgstr "Clasificar como spam" -#: plugin-SpamDetector/Plugin.php:220 +#: plugin-SpamDetector/Plugin.php:223 msgid "Nome" msgstr "Nombre" -#: plugin-SpamDetector/Plugin.php:221 +#: plugin-SpamDetector/Plugin.php:224 msgid "Descrição Curta" msgstr "Descripción breve" -#: plugin-SpamDetector/Plugin.php:222 +#: plugin-SpamDetector/Plugin.php:225 msgid "Descrição Longa" msgstr "Descripción Larga" -#: plugin-SpamDetector/Plugin.php:233 +#: plugin-SpamDetector/Plugin.php:231 +msgid "Campo" +msgstr "Campo" + +#: plugin-SpamDetector/Plugin.php:231 +msgid "Termos" +msgstr "Términos" + +#: plugin-SpamDetector/Plugin.php:236 msgid "" "O sistema detectou possível spam em um conteúdo recente. Por favor, revise " "as informações abaixo e tome as medidas necessárias:" @@ -44,7 +52,7 @@ msgstr "" "El sistema ha detectado posible spam en contenido reciente. Revise la " "siguiente información y tome las medidas adecuadas:" -#: plugin-SpamDetector/Plugin.php:234 +#: plugin-SpamDetector/Plugin.php:237 msgid "" "O sistema detectou um conteúdo inadequado neste cadastro e moveu-o para a " "lixeira. Seguem abaixo os dados para análise do conteúdo:" @@ -52,10 +60,65 @@ msgstr "" "El sistema detectó contenido inapropiado en este registro y lo movió a la " "papelera. A continuación se muestran los datos para el análisis de contenido:" -#: plugin-SpamDetector/Plugin.php:257 +#: plugin-SpamDetector/Plugin.php:259 msgid "Spam - Conteúdo suspeito" msgstr "Spam - Contenido sospechoso" +#: plugin-SpamDetector/Plugin.php:259 +#, php-format +msgid "Spam - %s foi bloqueado(a)" +msgstr "Spam - %s fue bloqueado(a)" + +#: plugin-SpamDetector/Plugin.php:301 +msgid "na" +msgstr "en la" + +#: plugin-SpamDetector/Plugin.php:302 +msgid "no" +msgstr "en el" + +#: plugin-SpamDetector/Plugin.php:308 +msgid "esta" +msgstr "esta" + +#: plugin-SpamDetector/Plugin.php:309 +msgid "este" +msgstr "este" + +#: plugin-SpamDetector/Plugin.php:315 +msgid "a" +msgstr "hasta" + +#: plugin-SpamDetector/Plugin.php:316 +msgid "o" +msgstr "el" + +#. TRANSLATORS: %s is a prefix like 'na', 'esta', 'a' +#: plugin-SpamDetector/Plugin.php:327 +#, php-format +msgid "%s Agente" +msgstr "%s Agente" + +#: plugin-SpamDetector/Plugin.php:328 +#, php-format +msgid "%s Oportunidade" +msgstr "%s Oportunidad" + +#: plugin-SpamDetector/Plugin.php:329 +#, php-format +msgid "%s Projeto" +msgstr "%s Proyecto" + +#: plugin-SpamDetector/Plugin.php:330 +#, php-format +msgid "%s Espaço" +msgstr "%s Espacio" + +#: plugin-SpamDetector/Plugin.php:331 +#, php-format +msgid "%s Evento" +msgstr "%s Evento" + #: plugin-SpamDetector/components/spam-add-config/template.php:17 msgid "Controle de Spam" msgstr "Control de spam" @@ -338,9 +401,6 @@ msgstr "Acceda a la gestión de usuarios haciendo clic aquí" #~ "Agente colectivo sin RUT , con los campos Fecha de Nacimiento / Fundación " #~ "e Email privado completos" -#~ msgid "Espaço" -#~ msgstr "Espacio" - #~ msgid "Vincule um espaço a sua inscrição" #~ msgstr "Es obligatorio vincular un espacio a la inscripción" @@ -353,30 +413,18 @@ msgstr "Acceda a la gestión de usuarios haciendo clic aquí" #~ msgid "Site" #~ msgstr "Página web" -#~ msgid "Evento" -#~ msgstr "Evento" - #~ msgid "Eventos" #~ msgstr "Eventos" -#~ msgid "Agente" -#~ msgstr "Agente" - #~ msgid "Agentes" #~ msgstr "Agentes" #~ msgid "Espaços" #~ msgstr "Espacios" -#~ msgid "Projeto" -#~ msgstr "Proyecto" - #~ msgid "Projetos" #~ msgstr "Proyectos" -#~ msgid "Oportunidade" -#~ msgstr "Oportunidad" - #~ msgid "Oportunidades" #~ msgstr "Oportunidades" @@ -8715,9 +8763,6 @@ msgstr "Acceda a la gestión de usuarios haciendo clic aquí" #~ msgid "(0 = Sem limitações)" #~ msgstr "(0 = Sin limitaciones)" -#~ msgid "Campo" -#~ msgstr "Campo" - #~ msgid "Valor" #~ msgstr "Valor" @@ -9721,9 +9766,6 @@ msgstr "Acceda a la gestión de usuarios haciendo clic aquí" #~ msgid "Política de privacidade" #~ msgstr "Política de privacidad" -#~ msgid "Termos de uso" -#~ msgstr "Términos de uso" - #~ msgid "Autorização de uso de imagem" #~ msgstr "Autorización de uso de imagen" @@ -10469,9 +10511,6 @@ msgstr "Acceda a la gestión de usuarios haciendo clic aquí" #~ msgid "resultado final" #~ msgstr "resultado final" -#~ msgid "estado" -#~ msgstr "departamento" - #~ msgid "coletivo" #~ msgstr "colectivo" @@ -10881,9 +10920,6 @@ msgstr "Acceda a la gestión de usuarios haciendo clic aquí" #~ msgid "de" #~ msgstr "de" -#~ msgid "a" -#~ msgstr "hasta" - #~ msgid "Preencher formulário" #~ msgstr "Rellenar formulario" @@ -14151,9 +14187,6 @@ msgstr "Acceda a la gestión de usuarios haciendo clic aquí" #~ msgid "Bloqueio de campos" #~ msgstr "Bloqueo de campos" -#~ msgid "ano" -#~ msgstr "año" - #~ msgid "anos" #~ msgstr "años" @@ -19827,6 +19860,3 @@ msgstr "Acceda a la gestión de usuarios haciendo clic aquí" #~ msgid "Clique para marcar/desmarcar este" #~ msgstr "Haga clic para marcar/desmarcar este" - -#~ msgid "teste pt" -#~ msgstr "teste es"