A lightweight, user-friendly AI translation system for OpenStack i18n.
This tool helps contributors translate `.pot` / `.po` files into 54 languages using CPU-friendly LLMs such as **Ollama**, as well as GPT, Claude, and Gemini.
If you're new to OpenStack i18n, see the official OpenStack i18n guide.
- Python 3.10 is needed
- Designed for local and CI environments
The fastest way to run your first translation.
By default, this system translates the nova project files into Korean (ko_KR) and Japanese (ja) using the llama3.2:3b model via Ollama.
You can customize the target project, model, and language in config.yaml (see Choose Your Options below).
git clone https://github.com/openstack-kr/knu_i18n_2025.git
cd knu_i18n_2025# if you trouble in upgrading pip, we recommend to use venv
python -m pip install --upgrade pip
pip install tox
# Install Ollama
# For Linux:
curl -fsSL https://ollama.com/install.sh | sh
# For other operating systems (Windows, macOS):
# Please visit https://ollama.com/download and follow the installation instructions# if you trouble in upgrading pip, we recommend to use venv
python -m pip install --upgrade pip
# Install Ollama
# For Linux:
curl -fsSL https://ollama.com/install.sh | sh
# For other operating systems (Windows, macOS):
# Please visit https://ollama.com/download and follow the installation instructions
pip install -r requirements.txtThis will translate the file specified in config.yaml using the configured model and language.
tox -e i18n -vv
# or
bash local.shWhat's happening:
- The system reads your target
.potor.pofile from./data/target/{lang}directory - Uses the specified model (default:
llama3.2:3bvia Ollama) - Translates into your chosen languages (default: ko_KR, ja)
- Outputs translated
.pofiles to./po/{model}/{lang}/directory
After AI translation, human review is essential to ensure accuracy and context appropriateness. AI translations are drafts that require human verification before production use.
Open the generated .po file in ./po/{model}/{lang}/ directory and review the translations manually for technical accuracy, natural language flow, and consistency with existing translations.
After reviewing AI translation, merge your reviewed translations back to the original .po file:
tox -e i18n-merge -vv
# or
python merge_po.py --config config.yamlThis will merge your reviewed translations and save the final result to ./data/result/{lang} directory.
You can customize target file, model, language, and performance settings in config.yaml
- Place your target
.potor.pofile in the./data/target/{lang}directory - Specify the filename in
config.yaml:
files:
# Set target_file to translate (must be placed under ./data/target/{lang})
target_file: "example_nova.po"- Input:
./data/target/{lang}/{target_file}.poor./data/target/{lang}/{target_file}.pot - Intermediate outputs:
- Extracted POT:
./pot/{target_file}.pot - AI translations:
./po/{model}/{lang}/{target_file}.po
- Extracted POT:
- Final output:
./data/result/{lang}/{target_file}.po(merged translation)
You can manually download the latest translated POT or PO files directly from the Weblate interface.
Steps:
- Go to the Weblate translation dashboard for the project Example
- Select the project (e.g., Nova, Horizon, etc.)
- Navigate to:
project → languages → <Your Language> - Click "Download translation"
- Save the downloaded file to the
./data/target/{lang}/directory - Update the
target_filename inconfig.yaml
Please insert your language code from this link. We support 54 languages
languages:
# When running local.sh, please choose exactly ONE language.
# When running ci.sh, you can specify MULTIPLE languages.
- "ko_KR"
- "ja"Uses Ollama. Browse available models HERE.
When using closed-source model, edit the backend using llm.mode: [ollama (default), gpt, claude, gemini]
# You can tune these arguments for performance / partial translation:
llm:
model: "llama3.2:3b"
mode: "ollama" # Choose your LLM mode: `ollama` (default), `gpt`, `claude`, `gemini`
workers: 1 # number of parallel threads (default: 1)
start: 0 # entry index range to translate (default: 0 ~ all)
end: -1
batch_size: 5 # entries per LLM call (default: 5)For automated translation in OpenStack's Zuul CI environment, use the provided CI script:
# Ensure you have completed Step 2 — Install dependencies before running this
bash ci.shconfig.yaml (git settings) and understanding current limitations, please refer to the CI.md.
The script automatically uses config.yaml by default, or you can specify a different config file:
bash ci.sh my-config.yamlWhat ci.sh does:
The script runs a 3-step pipeline:
- Find changed content: Runs
commit_diff.pyto detect added or edited msgid entries in your target file and extracts them to a.potfile - Translate: Executes
translate.pyto translate the extracted entries using your configured model - Merge: Uses
merge_po.pyto merge AI-translated content back into the original.pofile
Results are saved to ./data/result/{lang}/{target_file}.po
Usage in CI pipeline:
# Example Zuul job configuration
- job:
name: translate-pot-files
run: playbooks/translate.yaml
# In your playbook:
- name: Run AI Translation
shell: bash ci.shThe CI workflow is optimized to translate only changed content, making it efficient for continuous integration pipelines.
The system automatically:
- Loads the
.potfile - Splits text into batches
- Applies the general prompt or a language-specific prompt (if available)
- Adds few-shot examples when reference translations exist
- Generates draft
.potranslations
Draft translations are then pushed to Gerrit → reviewed → synced to Weblate. For full architecture details, see PAPER.md.
You can tune two major components:
- Few-shot examples (
/examples/) - Language-specific prompts (
/prompts/)
See CONTRIBUTING.md to learn how you can contribute.
Run PEP8 style checks:
tox -e pep8Auto-fix style issues:
autopep8 --in-place --aggressive --aggressive -r .- Lee Juyeong - Project Lead
- Oh Jiwoo
- Jo Taeho
- Chun Sihyeon
- Hwang Jiyoung