Text extraction and translation tool for RPG Maker games and JSON i18n files.
Read this in other languages: Português
Extractor and Translation is a Python-based tool designed to extract translatable text from specific formats and automate its translation using AI models via Ollama. It leverages modern libraries like PyQt5 for a GUI and deep_translator/Ollama for translating game assets and localization JSON files efficiently. It simplifies the localization process by managing the context and concurrency of requests to the AI engine.
The project was initially created to translate RPG Maker games, and later the concept evolved to also translate website JSON i18n files.
- Python 3.10+
- Docker (Optional, for containerized execution)
- Ollama (If using local LLMs for translation)
- Clone the repository:
git clone https://github.com/bgluis/extractor-and-translation.git- Navigate to the project directory:
cd extractor-and-translation- Create and activate a virtual environment (optional but recommended):
python -m venv .venv
source .venv/bin/activate # On Windows use: .venv\Scripts\activate- Install the dependencies:
pip install -r requirements.txt- Run the application:
python main.pyYou can install the executable globally with pre-configured terminal shortcuts/abbreviations (slime, slm, sl):
# Installs 'slime' and shortcuts (slm, sl, extractor-translation) into ~/.local/bin
make install-cliAfter installation, you can run the tool from any folder:
# Start interactive mode:
slime
# or with shortcuts:
slm
sl --interactive
# Direct translation:
slm -i /path/to/game -e RPGMaker -t Google -s ja -d pt
# Launch GUI:
slime --gui
# Add custom aliases/abbreviations:
make add-alias ALIAS=slx
# or directly:
slime --add-alias slx- Build and start the container using Docker Compose:
docker-compose up -d --buildThe application uses environment variables for configuration. You can copy .env.example to .env and adjust the values.
| Variable | Description | Default Value |
|---|---|---|
OLLAMA_MODEL |
Ollama model to be used for translation (e.g., llama3.1, mistral) | llama3.1 |
OLLAMA_MAX_REQUESTS |
Maximum number of concurrent requests to the model | 5 |
OLLAMA_CHAR_LIMIT |
Character limit per request (optional) | 10000 |
OLLAMA_CONTEXT_FUNCTION |
Custom function context for the prompt (optional) | - |
OLLAMA_CONTEXT_ADDITIONAL |
Additional context for the prompt (optional) | - |