init: scripts diversos (crawlers, conversores, scrapers)
This commit is contained in:
145
translate-wp-plugin/README-translate-wordpress-plugin.txt
Normal file
145
translate-wp-plugin/README-translate-wordpress-plugin.txt
Normal file
@@ -0,0 +1,145 @@
|
||||
WordPress Plugin Translation Toolkit
|
||||
=====================================
|
||||
|
||||
Conjunto de scripts reutilizáveis para traduzir e corrigir plugins WordPress
|
||||
para Português Europeu (PT-PT) usando LibreTranslate.
|
||||
|
||||
Author: Descomplicar® Crescimento Digital
|
||||
Version: 2.0.0
|
||||
Updated: 20-02-2026
|
||||
|
||||
|
||||
SCRIPTS DISPONÍVEIS
|
||||
===================
|
||||
|
||||
1. translate-wordpress-plugin.py ← Traduzir um único plugin (v1)
|
||||
2. fix_malformed.py ← Corrigir sintaxe .po mal formada
|
||||
3. fix_ptbr.py ← Corrigir PT-BR → PT-PT
|
||||
4. translate_missing.py ← Preencher strings em falta via API
|
||||
5. batch_process_library.py ← SCRIPT MESTRE: processar biblioteca inteira
|
||||
|
||||
|
||||
USO RÁPIDO — BIBLIOTECA INTEIRA
|
||||
=================================
|
||||
|
||||
# Processar TODOS os plugins (passos 1+2+3+4 automáticos):
|
||||
python3 /media/ealmeida/Dados/Dev/Scripts/translate-wp-plugin/batch_process_library.py \
|
||||
/media/ealmeida/Dados/Dev/WordPress/Tradução-Plugins-PT-PT
|
||||
|
||||
# Apenas correcções PT-BR (sem chamar API de tradução):
|
||||
python3 batch_process_library.py /path/to/library --skip-translate
|
||||
|
||||
# Simular sem gravar:
|
||||
python3 batch_process_library.py /path/to/library --dry-run
|
||||
|
||||
|
||||
USO INDIVIDUAL — SCRIPTS ESPECÍFICOS
|
||||
======================================
|
||||
|
||||
fix_malformed.py — Corrige sintaxe .po mal formada
|
||||
---------------------------------------------------
|
||||
# Um ficheiro:
|
||||
python3 fix_malformed.py plugin-pt_PT.po
|
||||
|
||||
# Toda uma biblioteca:
|
||||
find /path/to/library -name "*-pt_PT.po" | xargs python3 fix_malformed.py
|
||||
|
||||
|
||||
fix_ptbr.py — Corrige PT-BR → PT-PT
|
||||
--------------------------------------
|
||||
# Um ficheiro:
|
||||
python3 fix_ptbr.py plugin-pt_PT.po
|
||||
|
||||
# Toda uma biblioteca:
|
||||
find /path/to/library -name "*-pt_PT.po" | xargs python3 fix_ptbr.py
|
||||
|
||||
Correcções aplicadas:
|
||||
salvar → guardar
|
||||
senha → palavra-passe
|
||||
usuário → utilizador
|
||||
arquivo → ficheiro
|
||||
ativar → activar
|
||||
atualizar → actualizar
|
||||
desativar → desactivar
|
||||
conectar → ligar
|
||||
dashboard → painel
|
||||
backup → cópia de segurança
|
||||
você → o utilizador
|
||||
(+ 40 outros termos)
|
||||
|
||||
|
||||
translate_missing.py — Traduz strings em falta via LibreTranslate
|
||||
------------------------------------------------------------------
|
||||
# Um ficheiro:
|
||||
python3 translate_missing.py plugin-pt_PT.po
|
||||
|
||||
# Simular (sem gravar):
|
||||
python3 translate_missing.py plugin-pt_PT.po --dry-run
|
||||
|
||||
# Toda uma biblioteca:
|
||||
find /path/to/library -name "*-pt_PT.po" | xargs python3 translate_missing.py
|
||||
|
||||
Requisitos:
|
||||
- LibreTranslate API: https://translate.descomplicar.pt
|
||||
- Rate limit: 0.3s entre chamadas
|
||||
- Sem API key (whitelist IP 188.251.199.30)
|
||||
|
||||
|
||||
translate-wordpress-plugin.py — Traduzir plugin único (v1 legacy)
|
||||
-----------------------------------------------------------------
|
||||
python3 translate-wordpress-plugin.py input.po
|
||||
python3 translate-wordpress-plugin.py input.po --output output-pt_PT.po
|
||||
python3 translate-wordpress-plugin.py input.po --api-url http://localhost:5000
|
||||
|
||||
|
||||
REQUISITOS
|
||||
==========
|
||||
|
||||
- Python 3.8+
|
||||
- gettext (msgfmt): sudo apt install gettext
|
||||
- LibreTranslate API: https://translate.descomplicar.pt (self-hosted)
|
||||
- Acesso de rede ao servidor de tradução
|
||||
|
||||
|
||||
FLUXO RECOMENDADO
|
||||
=================
|
||||
|
||||
Para uma biblioteca nova ou actualização:
|
||||
|
||||
1. fix_malformed — garantir que os .po são válidos
|
||||
2. fix_ptbr — substituir PT-BR por PT-PT
|
||||
3. translate_missing — preencher strings em falta
|
||||
4. msgfmt — recompilar .mo
|
||||
|
||||
O batch_process_library.py executa este fluxo automaticamente.
|
||||
|
||||
|
||||
BIBLIOTECA PRINCIPAL
|
||||
====================
|
||||
|
||||
Localização: /media/ealmeida/Dados/Dev/WordPress/Tradução-Plugins-PT-PT/
|
||||
Glossário: /media/ealmeida/Dados/Dev/WordPress/Tradução-Plugins-PT-PT/GLOSSARIO-PT-PT.md
|
||||
|
||||
Destino WP: /wp-content/languages/loco/plugins/PLUGIN-SLUG-pt_PT.po
|
||||
/wp-content/languages/loco/plugins/PLUGIN-SLUG-pt_PT.mo
|
||||
|
||||
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
v2.0.0 (20-02-2026)
|
||||
- Adicionado fix_malformed.py (correcção de sintaxe .po)
|
||||
- Adicionado fix_ptbr.py (correcções PT-BR → PT-PT expandidas)
|
||||
- Adicionado translate_missing.py (tradução de strings em falta)
|
||||
- Adicionado batch_process_library.py (orquestrador para biblioteca inteira)
|
||||
- Glossário expandido com 50+ termos adicionais
|
||||
|
||||
v1.0.0 (11-02-2026)
|
||||
- Script inicial de tradução de plugin único
|
||||
|
||||
|
||||
CONTACTO
|
||||
========
|
||||
|
||||
Emanuel Almeida <emanuel@descomplicar.pt>
|
||||
Descomplicar® Crescimento Digital
|
||||
Reference in New Issue
Block a user