MOS-ReLocalization is a Python toolkit for re-localizing MILFs of Sunville (or any JSON-based localization). It provides AI translation, placeholder fixing, English-in-Chinese review, proper‑noun unification, and coverage analytics — producing cleaner, more natural Chinese output.
- Language column detection: auto build column→language map (
scripts/detect_all_languages.py→data/language_map.json) - AI translation (RU/EN → ZH): context‑aware Chinese localization (
scripts/ai_translate.py→output/language_dict_translated.json) - English‑in‑Chinese review and merge: export mixed entries, manually fix, then merge (
scripts/export_english_in_chinese.py→ fix →scripts/merge_fixed_translations.py) - Placeholder fixes: normalize
[mcname]/[mcsurname]and variants (scripts/fix_mcname_tags.py,scripts/fix_mcname_format.py,scripts/fix_mcsurname_tags.py) - Proper‑noun unification: apply
data/name_map.jsonand optionally AI‑assisted unification- Apply + AI QA:
scripts/ai_apply_namemap_unify.py - Unified flow (merge + apply):
scripts/unify_namemap_and_apply_ai.py - Alternative applier:
scripts/ai_apply_namemap_aiunify.py - Merge candidates & generate mapping:
scripts/ai_name_unify_with_namemap.py - No‑AI quick apply (pure replace):
scripts/apply_namemap_fix_no_ai.py
- Apply + AI QA:
- Coverage analytics: per‑column fill ratio (
scripts/translation_coverage.py)
-
Python 3.13+
-
Install dependencies
pip install -U openai python-dotenv langdetect- Configure environment via
.env(examples)
# Engine selection
MODEL_PROVIDER=deepseek # or: chatgpt
# OpenAI
OPENAI_API_KEY=sk-...
MODEL=gpt-4o-mini
# DeepSeek (OpenAI-compatible)
DEEPSEEK_API_KEY=sk-...
DEEPSEEK_BASE_URL=https://api.siliconflow.cn
DEEPSEEK_MODEL=deepseek-ai/DeepSeek-R1
# Optional rate limiting / concurrency
RPM=1000
TPM=100000
ASYNC_CONCURRENCY=100
PRINT_EVERY=50
BATCH_FLUSH=200- Detect language columns
python scripts/detect_all_languages.pyOutput: data/language_map.json
- AI translation to Chinese (using RU + EN)
python scripts/ai_translate.pyOutput: output/language_dict_translated.json
- Review English‑in‑Chinese and merge back
# Export mixed entries in Chinese columns
python scripts/export_english_in_chinese.py
# Manually fix: output/review_english_mixed/mixed_entries_fixed.json
# Merge back
python scripts/merge_fixed_translations.pyOutput: output/language_dict_merged.json
- Fix placeholders and normalize formats
python scripts/fix_mcname_tags.py # → output/language_dict_fixed.json
python scripts/fix_mcname_format.py # → output/language_dict_mcname_fixed.json
python scripts/fix_mcsurname_tags.py # → output/language_dict_mcsurname_fixed.json- Unify proper nouns (pick one path)
- Path A: Apply
name_mapwith AI QA
python scripts/ai_apply_namemap_unify.py # → output/language_dict_namemap_applied.json- Path B: Merge candidates + apply in one go
python scripts/unify_namemap_and_apply_ai.py # → output/language_dict_name_final.json- Alternatives (advanced)
python scripts/ai_apply_namemap_aiunify.py
python scripts/ai_name_unify_with_namemap.py
python scripts/apply_namemap_fix_no_ai.py- Coverage report
python scripts/translation_coverage.py --saveOutput: output/translation_coverage.json
- Input data:
data/language_dict.json,data/name_map.json - Language map:
data/language_map.json(generated) - Intermediate/final outputs under
output/(JSON + reports likename_unify_report.txt) - Caches under
cache/
- Rate limits: DeepSeek typical RPM≈1000 / TPM≈100000; scripts auto back‑off on 429.
- Placeholders: keep
[mcname],[mcsurname]intact in translations. - Proper nouns: curate
data/name_map.jsonfirst, then run unification to ensure consistency.
MIT License © 2025 AyeSt0
Re‑forging words — re‑localizing MILFs of Sunville.