Automated English → Italian translator for Apache Superset .po translation files.
Uses the free Google Translate API, protects technical terms from mistranslation, and removes fuzzy flags automatically.
- Translates all untranslated and
fuzzy-flagged entries - Protects technical terms (
API,SQL,JWT,OAuth, …) from being altered - Handles both singular and plural PO forms
- Rate-limited requests to avoid Google Translate throttling
- Clean CLI with configurable input/output paths
superset-po-translator/
├── src/
│ └── translator/
│ ├── __init__.py # Public API
│ ├── translator.py # Core PO orchestration
│ ├── protection.py # Technical term guard
│ └── google.py # Google Translate client
├── tests/
│ ├── test_translator.py
│ ├── test_protection.py
│ └── test_google.py
├── scripts/
│ └── run.py # CLI entry-point
├── examples/
│ └── messages.po # Sample PO file for testing
├── .github/workflows/
│ └── ci.yml # Lint + test + coverage
├── pyproject.toml # Build, deps, tooling config
├── LICENSE
└── README.md
git clone https://github.com/FrancescoCastaldi/Superset-Translator-ITA.git
cd Superset-Translator-ITA
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e . # install package
pip install -e ".[dev]" # include dev tools (ruff, mypy, pytest)# Default: messages.po → messages_it.po
python scripts/run.py
# Custom input/output paths
python scripts/run.py path/to/input.po path/to/output_it.pocp /path/to/superset/superset/translations/it/LC_MESSAGES/messages.po .
python scripts/run.pyFound 4523 entries in 'messages.po'
✓ 1/4523 - 'Add a filter'
- 2/4523 - Already translated
✓ 3/4523 - 'Save dashboard'
↳ [singular] 'item' → 'elemento'
↳ [plural[1]] 'items' → 'elementi'
...
Saving to 'messages_it.po'...
Done!
# Run tests
pytest tests/ -v
# Lint & format check
ruff format src tests scripts
ruff check src tests scripts
# Type check
mypy src/translator| Module | Responsibility |
|---|---|
src/translator/translator.py |
Orchestrates PO file I/O and entry iteration |
src/translator/protection.py |
Placeholder substitution for technical terms |
src/translator/google.py |
HTTP client for Google Translate free API |
scripts/run.py |
CLI entry-point with argument parsing |
- Uses the unofficial Google Translate endpoint (
gtx) — no API key needed but may be rate-limited on large files (>10k strings) - Machine translations should be reviewed manually before merging into production
- Sleep interval of 0.1 s per request; full Superset translation (~4500 strings) takes ~10 minutes
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit following Conventional Commits
- Push and open a Pull Request against
main
Francesco Castaldi
Software Engineer | Healthcare Business Consultant
LinkedIn · GitHub
This project is licensed under the MIT License — see LICENSE for details.