Latest commit

History

162 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Game Localization MVR (Minimum Viable Rules) v2.1

A robust, automated workflow system for game localization with strict validation, AI translation/repair, glossary management, and multi-format export.

Core Principle: Input rows == Output rows ALWAYS. No silent data loss.


🤖 For AI Coding Agents

Quick Commands for Agents:

# 1. Verify LLM connectivity (MUST run first)
python scripts/llm_ping.py
# 2. Validate workflow configuration (dry-run)
python scripts/translate_llm.py --input input.csv --output output.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run
# 3. Run E2E test
python scripts/test_e2e_workflow.py

Environment Variables (REQUIRED):

LLM_BASE_URL=https://api.example.com/v1
LLM_API_KEY=sk-your-key
LLM_MODEL=gpt-4.1-mini
LLM_TRACE_PATH=data/llm_trace.jsonl

Key Rules for Agents:

  1. Never hardcode API keys - Use environment variables only
  2. Run llm_ping.py first - Fail-fast if LLM unavailable
  3. Check WORKSPACE_RULES.md - See docs/WORKSPACE_RULES.md for hard constraints
  4. Row preservation is P0 - Empty source rows must be preserved with status=skipped_empty
  5. Glossary is mandatory - glossary/compiled.yaml must exist before translation

🔄 Handoff

Use this section when a new machine or a new agent needs to continue the current UI/operator roadmap without local context from the previous workstation.

Roadmap status

  • Phase 5 frontend_runtime_shell: implemented and merged
  • Phase 6 operator_workspace_dashboard: implemented and merged
  • Latest local follow-up scope: dashboard redesign, Chinese UI toggle, manual UAT seed/helper, and migration closeout docs

Recommended starting point

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
git checkout main
  • Start from a fresh main
  • Create a new codex/* branch for any follow-up work instead of reviving old merged feature branches
  • Treat task_plan.md, progress.md, and the latest docs/project_lifecycle/run_records/... chain as the continuity trail

UI/operator runtime entrypoints

python scripts/seed_phase6_manual_uat.py
python scripts/operator_ui_server.py --host 127.0.0.1 --port 8765
  • Manual UI entry: http://127.0.0.1:8765/
  • Seeded manual UAT fixtures create:
    • phase6_manual_uat_derived
    • phase6_manual_uat_persisted

Required preflight

python scripts/llm_ping.py
  • Required env:
    • LLM_BASE_URL
    • LLM_API_KEY
    • LLM_MODEL
  • Do not start smoke runs or UI live-launch validation until llm_ping.py passes

Current truth sources

  • Runtime truth:
    • run_manifest.json
    • smoke_verify_<run_id>.json
    • smoke_issues.json
  • Operator/workspace truth:
    • data/operator_cards/<run_id>/operator_cards.jsonl
    • data/operator_reports/<run_id>/operator_summary.json
  • Governance continuity:
    • docs/project_lifecycle/run_records/...
    • task_plan.md
    • progress.md

Recommended next step

  • Finish or re-run human UI acceptance on the latest dashboard build
  • Address any follow-up UX/runtime defects found in manual UAT
  • Then open the next roadmap scope from fresh main

🚀 Pipeline Overview

Input CSV → Normalize → Translate → QA_Hard → Repair → Export
↓
Glossary (required)
StepScriptPurposeBlocking?
0llm_ping.py🔌 LLM connectivity checkYES
1normalize_guard.py🧊 Freeze placeholders → tokensYES
2-4extract_terms.pyglossary_compile.py📖 Build glossaryYES
5translate_llm.py🤖 AI TranslationYES
6qa_hard.py🛡️ Validate tokens/patternsYES
7repair_loop.py🔧 Auto-repair hard errors-
8soft_qa_llm.py🧠 Quality review-
10rehydrate_export.py💧 Restore tokens → placeholdersYES

📁 Project Structure

loc-mvr/
├── config/
│ ├── llm_routing.yaml # Model routing per step
│ └── pricing.yaml # Cost calculation
├── glossary/
│ ├── compiled.yaml # Active glossary (generated)
│ └── generic_terms_zh.txt # Blacklist for extraction
├── scripts/
│ ├── llm_ping.py # ★ Run first - connectivity check
│ ├── normalize_guard.py # Step 1: Placeholder freezing
│ ├── translate_llm.py # Step 5: Translation
│ ├── qa_hard.py # Step 6: Hard validation
│ ├── repair_loop.py # Step 7: Auto-repair
│ └── runtime_adapter.py # LLM client with routing
├── workflow/
│ ├── style_guide.md # Translation style rules
│ ├── forbidden_patterns.txt
│ └── placeholder_schema.yaml
└── docs/
└── WORKSPACE_RULES.md # ★ Hard constraints for agents

🔧 Quick Start (Human)

1. Setup

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
pip install pyyaml requests numpy pandas jieba

2. Configure LLM (推荐持久化)

# Windows PowerShell$env:LLM_BASE_URL="https://api.apiyi.com/v1"$env:LLM_API_KEY="sk-your-key"$env:LLM_MODEL="gpt-4.1-mini"

也可在本地持久化文件中配置(优先于环境变量自动读取):

# 在 main_worktree/.llm_credentials 创建
LLM_BASE_URL=https://api.apiyi.com/v1
LLM_API_KEY=sk-your-key

当前加载顺序:LLM_API_KEY_FILE -> ./.llm_credentials/./.llm_env/./config/llm_credentials.env/~/.game-localization-mvr/.llm_credentials -> LLM_API_KEY

4. Dependency + Environment Quick Check (before every smoke run)

python - <<'PY'import osimport importlibfor pkg in ["requests", "numpy", "yaml", "pandas"]: try: importlib.import_module(pkg) print(f"[OK] {pkg}") except Exception: print(f"[MISSING] {pkg}")for key in ["LLM_BASE_URL", "LLM_API_KEY", "LLM_MODEL"]: print(f"{key}={'SET' if os.getenv(key) else 'MISSING'}")PY

If any dependency shows MISSING or env variable shows MISSING, do not start smoke run yet.

PowerShell 快速检查:

$missing=@()
foreach ($min@("requests","numpy","yaml","pandas","jieba")) {
try {
python -c "import importlib.util; print(bool(importlib.util.find_spec('$m')))"Write-Host"[OK] $m"
} catch {
$missing+=$mWrite-Host"[MISSING] $m"
}
}
Write-Host"LLM_BASE_URL=$([bool]$env:LLM_BASE_URL)"Write-Host"LLM_API_KEY=$([bool]$env:LLM_API_KEY)"Write-Host"LLM_MODEL=$([bool]$env:LLM_MODEL)"

3. Run Pipeline

# Bootstrap tracked style assets once per clean worktree
python scripts/style_guide_bootstrap.py --dry-run
# Verify LLM
python scripts/llm_ping.py
# Normalize → Translate → QA → Export
python scripts/normalize_guard.py input.csv normalized.csv map.json workflow/placeholder_schema.yaml
python scripts/translate_llm.py --input normalized.csv --output translated.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml
python scripts/qa_hard.py translated.csv qa_report.json map.json
python scripts/rehydrate_export.py translated.csv map.json final.csv

3.1 Smoke Pipeline (Manifest + Issue Record)

# Full smoke pass with manifest output + issue recording
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US
# 可选:仅做预检
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US --verify-mode preflight

This command:

  • auto-bootstraps workflow/style_profile.generated.yaml if the clean worktree does not have one yet
  • runs llm_ping -> normalize_guard -> translate_llm -> qa_hard -> rehydrate_export
  • generates a run manifest: data/smoke_run_<timestamp>/run_manifest.json
  • runs smoke_verify --manifest ...
  • records issues to reports/smoke_issues_<run-id>.json and .jsonl
  • emits manifest.stage_artifacts with:
    • connectivity_log
    • normalize_log
    • translate_log
    • qa_hard_report
    • final_csv
    • smoke_verify_log
  • verify_mode supports preflight|full,默认 full(含行数/QA 统计)

建议每次冒烟固定检查以下产物:

  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\data\smoke_runs\<run>\run_manifest.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_issues_<run_id>.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_verify_<run_id>.json

⚡ Key Features

  • Row Preservation: Empty rows kept with status=skipped_empty
  • Drift Guard: Refresh stage blocks non-placeholder text changes
  • Progress Reporting: --progress_every N for translation progress
  • Router-based Models: Configure per-step models in llm_routing.yaml
  • LLM Tracing: All calls logged to LLM_TRACE_PATH for billing

📋 Testing

# Unit tests
python scripts/test_normalize.py
python scripts/test_qa_hard.py
python scripts/test_rehydrate.py
# E2E test (small dataset)
python scripts/test_e2e_workflow.py
# Dry-run validation
python scripts/translate_llm.py --input input.csv --output out.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run

📄 License

MIT License. Built for game localization automation.


🔗 Links

About

Game localization workflow with placeholder freezing, QA validation, and export automation

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Latest commit

History

162 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Game Localization MVR (Minimum Viable Rules) v2.1

A robust, automated workflow system for game localization with strict validation, AI translation/repair, glossary management, and multi-format export.

Core Principle: Input rows == Output rows ALWAYS. No silent data loss.


🤖 For AI Coding Agents

Quick Commands for Agents:

# 1. Verify LLM connectivity (MUST run first)
python scripts/llm_ping.py
# 2. Validate workflow configuration (dry-run)
python scripts/translate_llm.py --input input.csv --output output.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run
# 3. Run E2E test
python scripts/test_e2e_workflow.py

Environment Variables (REQUIRED):

LLM_BASE_URL=https://api.example.com/v1
LLM_API_KEY=sk-your-key
LLM_MODEL=gpt-4.1-mini
LLM_TRACE_PATH=data/llm_trace.jsonl

Key Rules for Agents:

  1. Never hardcode API keys - Use environment variables only
  2. Run llm_ping.py first - Fail-fast if LLM unavailable
  3. Check WORKSPACE_RULES.md - See docs/WORKSPACE_RULES.md for hard constraints
  4. Row preservation is P0 - Empty source rows must be preserved with status=skipped_empty
  5. Glossary is mandatory - glossary/compiled.yaml must exist before translation

🔄 Handoff

Use this section when a new machine or a new agent needs to continue the current UI/operator roadmap without local context from the previous workstation.

Roadmap status

  • Phase 5 frontend_runtime_shell: implemented and merged
  • Phase 6 operator_workspace_dashboard: implemented and merged
  • Latest local follow-up scope: dashboard redesign, Chinese UI toggle, manual UAT seed/helper, and migration closeout docs

Recommended starting point

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
git checkout main
  • Start from a fresh main
  • Create a new codex/* branch for any follow-up work instead of reviving old merged feature branches
  • Treat task_plan.md, progress.md, and the latest docs/project_lifecycle/run_records/... chain as the continuity trail

UI/operator runtime entrypoints

python scripts/seed_phase6_manual_uat.py
python scripts/operator_ui_server.py --host 127.0.0.1 --port 8765
  • Manual UI entry: http://127.0.0.1:8765/
  • Seeded manual UAT fixtures create:
    • phase6_manual_uat_derived
    • phase6_manual_uat_persisted

Required preflight

python scripts/llm_ping.py
  • Required env:
    • LLM_BASE_URL
    • LLM_API_KEY
    • LLM_MODEL
  • Do not start smoke runs or UI live-launch validation until llm_ping.py passes

Current truth sources

  • Runtime truth:
    • run_manifest.json
    • smoke_verify_<run_id>.json
    • smoke_issues.json
  • Operator/workspace truth:
    • data/operator_cards/<run_id>/operator_cards.jsonl
    • data/operator_reports/<run_id>/operator_summary.json
  • Governance continuity:
    • docs/project_lifecycle/run_records/...
    • task_plan.md
    • progress.md

Recommended next step

  • Finish or re-run human UI acceptance on the latest dashboard build
  • Address any follow-up UX/runtime defects found in manual UAT
  • Then open the next roadmap scope from fresh main

🚀 Pipeline Overview

Input CSV → Normalize → Translate → QA_Hard → Repair → Export
↓
Glossary (required)
StepScriptPurposeBlocking?
0llm_ping.py🔌 LLM connectivity checkYES
1normalize_guard.py🧊 Freeze placeholders → tokensYES
2-4extract_terms.pyglossary_compile.py📖 Build glossaryYES
5translate_llm.py🤖 AI TranslationYES
6qa_hard.py🛡️ Validate tokens/patternsYES
7repair_loop.py🔧 Auto-repair hard errors-
8soft_qa_llm.py🧠 Quality review-
10rehydrate_export.py💧 Restore tokens → placeholdersYES

📁 Project Structure

loc-mvr/
├── config/
│ ├── llm_routing.yaml # Model routing per step
│ └── pricing.yaml # Cost calculation
├── glossary/
│ ├── compiled.yaml # Active glossary (generated)
│ └── generic_terms_zh.txt # Blacklist for extraction
├── scripts/
│ ├── llm_ping.py # ★ Run first - connectivity check
│ ├── normalize_guard.py # Step 1: Placeholder freezing
│ ├── translate_llm.py # Step 5: Translation
│ ├── qa_hard.py # Step 6: Hard validation
│ ├── repair_loop.py # Step 7: Auto-repair
│ └── runtime_adapter.py # LLM client with routing
├── workflow/
│ ├── style_guide.md # Translation style rules
│ ├── forbidden_patterns.txt
│ └── placeholder_schema.yaml
└── docs/
└── WORKSPACE_RULES.md # ★ Hard constraints for agents

🔧 Quick Start (Human)

1. Setup

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
pip install pyyaml requests numpy pandas jieba

2. Configure LLM (推荐持久化)

# Windows PowerShell$env:LLM_BASE_URL="https://api.apiyi.com/v1"$env:LLM_API_KEY="sk-your-key"$env:LLM_MODEL="gpt-4.1-mini"

也可在本地持久化文件中配置(优先于环境变量自动读取):

# 在 main_worktree/.llm_credentials 创建
LLM_BASE_URL=https://api.apiyi.com/v1
LLM_API_KEY=sk-your-key

当前加载顺序:LLM_API_KEY_FILE -> ./.llm_credentials/./.llm_env/./config/llm_credentials.env/~/.game-localization-mvr/.llm_credentials -> LLM_API_KEY

4. Dependency + Environment Quick Check (before every smoke run)

python - <<'PY'import osimport importlibfor pkg in ["requests", "numpy", "yaml", "pandas"]: try: importlib.import_module(pkg) print(f"[OK] {pkg}") except Exception: print(f"[MISSING] {pkg}")for key in ["LLM_BASE_URL", "LLM_API_KEY", "LLM_MODEL"]: print(f"{key}={'SET' if os.getenv(key) else 'MISSING'}")PY

If any dependency shows MISSING or env variable shows MISSING, do not start smoke run yet.

PowerShell 快速检查:

$missing=@()
foreach ($min@("requests","numpy","yaml","pandas","jieba")) {
try {
python -c "import importlib.util; print(bool(importlib.util.find_spec('$m')))"Write-Host"[OK] $m"
} catch {
$missing+=$mWrite-Host"[MISSING] $m"
}
}
Write-Host"LLM_BASE_URL=$([bool]$env:LLM_BASE_URL)"Write-Host"LLM_API_KEY=$([bool]$env:LLM_API_KEY)"Write-Host"LLM_MODEL=$([bool]$env:LLM_MODEL)"

3. Run Pipeline

# Bootstrap tracked style assets once per clean worktree
python scripts/style_guide_bootstrap.py --dry-run
# Verify LLM
python scripts/llm_ping.py
# Normalize → Translate → QA → Export
python scripts/normalize_guard.py input.csv normalized.csv map.json workflow/placeholder_schema.yaml
python scripts/translate_llm.py --input normalized.csv --output translated.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml
python scripts/qa_hard.py translated.csv qa_report.json map.json
python scripts/rehydrate_export.py translated.csv map.json final.csv

3.1 Smoke Pipeline (Manifest + Issue Record)

# Full smoke pass with manifest output + issue recording
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US
# 可选:仅做预检
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US --verify-mode preflight

This command:

  • auto-bootstraps workflow/style_profile.generated.yaml if the clean worktree does not have one yet
  • runs llm_ping -> normalize_guard -> translate_llm -> qa_hard -> rehydrate_export
  • generates a run manifest: data/smoke_run_<timestamp>/run_manifest.json
  • runs smoke_verify --manifest ...
  • records issues to reports/smoke_issues_<run-id>.json and .jsonl
  • emits manifest.stage_artifacts with:
    • connectivity_log
    • normalize_log
    • translate_log
    • qa_hard_report
    • final_csv
    • smoke_verify_log
  • verify_mode supports preflight|full,默认 full(含行数/QA 统计)

建议每次冒烟固定检查以下产物:

  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\data\smoke_runs\<run>\run_manifest.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_issues_<run_id>.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_verify_<run_id>.json

⚡ Key Features

  • Row Preservation: Empty rows kept with status=skipped_empty
  • Drift Guard: Refresh stage blocks non-placeholder text changes
  • Progress Reporting: --progress_every N for translation progress
  • Router-based Models: Configure per-step models in llm_routing.yaml
  • LLM Tracing: All calls logged to LLM_TRACE_PATH for billing

📋 Testing

# Unit tests
python scripts/test_normalize.py
python scripts/test_qa_hard.py
python scripts/test_rehydrate.py
# E2E test (small dataset)
python scripts/test_e2e_workflow.py
# Dry-run validation
python scripts/translate_llm.py --input input.csv --output out.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run

📄 License

MIT License. Built for game localization automation.


🔗 Links

About

Game localization workflow with placeholder freezing, QA validation, and export automation

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

162 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Game Localization MVR (Minimum Viable Rules) v2.1

A robust, automated workflow system for game localization with strict validation, AI translation/repair, glossary management, and multi-format export.

Core Principle: Input rows == Output rows ALWAYS. No silent data loss.


🤖 For AI Coding Agents

Quick Commands for Agents:

# 1. Verify LLM connectivity (MUST run first)
python scripts/llm_ping.py
# 2. Validate workflow configuration (dry-run)
python scripts/translate_llm.py --input input.csv --output output.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run
# 3. Run E2E test
python scripts/test_e2e_workflow.py

Environment Variables (REQUIRED):

LLM_BASE_URL=https://api.example.com/v1
LLM_API_KEY=sk-your-key
LLM_MODEL=gpt-4.1-mini
LLM_TRACE_PATH=data/llm_trace.jsonl

Key Rules for Agents:

  1. Never hardcode API keys - Use environment variables only
  2. Run llm_ping.py first - Fail-fast if LLM unavailable
  3. Check WORKSPACE_RULES.md - See docs/WORKSPACE_RULES.md for hard constraints
  4. Row preservation is P0 - Empty source rows must be preserved with status=skipped_empty
  5. Glossary is mandatory - glossary/compiled.yaml must exist before translation

🔄 Handoff

Use this section when a new machine or a new agent needs to continue the current UI/operator roadmap without local context from the previous workstation.

Roadmap status

  • Phase 5 frontend_runtime_shell: implemented and merged
  • Phase 6 operator_workspace_dashboard: implemented and merged
  • Latest local follow-up scope: dashboard redesign, Chinese UI toggle, manual UAT seed/helper, and migration closeout docs

Recommended starting point

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
git checkout main
  • Start from a fresh main
  • Create a new codex/* branch for any follow-up work instead of reviving old merged feature branches
  • Treat task_plan.md, progress.md, and the latest docs/project_lifecycle/run_records/... chain as the continuity trail

UI/operator runtime entrypoints

python scripts/seed_phase6_manual_uat.py
python scripts/operator_ui_server.py --host 127.0.0.1 --port 8765
  • Manual UI entry: http://127.0.0.1:8765/
  • Seeded manual UAT fixtures create:
    • phase6_manual_uat_derived
    • phase6_manual_uat_persisted

Required preflight

python scripts/llm_ping.py
  • Required env:
    • LLM_BASE_URL
    • LLM_API_KEY
    • LLM_MODEL
  • Do not start smoke runs or UI live-launch validation until llm_ping.py passes

Current truth sources

  • Runtime truth:
    • run_manifest.json
    • smoke_verify_<run_id>.json
    • smoke_issues.json
  • Operator/workspace truth:
    • data/operator_cards/<run_id>/operator_cards.jsonl
    • data/operator_reports/<run_id>/operator_summary.json
  • Governance continuity:
    • docs/project_lifecycle/run_records/...
    • task_plan.md
    • progress.md

Recommended next step

  • Finish or re-run human UI acceptance on the latest dashboard build
  • Address any follow-up UX/runtime defects found in manual UAT
  • Then open the next roadmap scope from fresh main

🚀 Pipeline Overview

Input CSV → Normalize → Translate → QA_Hard → Repair → Export
↓
Glossary (required)
StepScriptPurposeBlocking?
0llm_ping.py🔌 LLM connectivity checkYES
1normalize_guard.py🧊 Freeze placeholders → tokensYES
2-4extract_terms.pyglossary_compile.py📖 Build glossaryYES
5translate_llm.py🤖 AI TranslationYES
6qa_hard.py🛡️ Validate tokens/patternsYES
7repair_loop.py🔧 Auto-repair hard errors-
8soft_qa_llm.py🧠 Quality review-
10rehydrate_export.py💧 Restore tokens → placeholdersYES

📁 Project Structure

loc-mvr/
├── config/
│ ├── llm_routing.yaml # Model routing per step
│ └── pricing.yaml # Cost calculation
├── glossary/
│ ├── compiled.yaml # Active glossary (generated)
│ └── generic_terms_zh.txt # Blacklist for extraction
├── scripts/
│ ├── llm_ping.py # ★ Run first - connectivity check
│ ├── normalize_guard.py # Step 1: Placeholder freezing
│ ├── translate_llm.py # Step 5: Translation
│ ├── qa_hard.py # Step 6: Hard validation
│ ├── repair_loop.py # Step 7: Auto-repair
│ └── runtime_adapter.py # LLM client with routing
├── workflow/
│ ├── style_guide.md # Translation style rules
│ ├── forbidden_patterns.txt
│ └── placeholder_schema.yaml
└── docs/
└── WORKSPACE_RULES.md # ★ Hard constraints for agents

🔧 Quick Start (Human)

1. Setup

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
pip install pyyaml requests numpy pandas jieba

2. Configure LLM (推荐持久化)

# Windows PowerShell$env:LLM_BASE_URL="https://api.apiyi.com/v1"$env:LLM_API_KEY="sk-your-key"$env:LLM_MODEL="gpt-4.1-mini"

也可在本地持久化文件中配置(优先于环境变量自动读取):

# 在 main_worktree/.llm_credentials 创建
LLM_BASE_URL=https://api.apiyi.com/v1
LLM_API_KEY=sk-your-key

当前加载顺序:LLM_API_KEY_FILE -> ./.llm_credentials/./.llm_env/./config/llm_credentials.env/~/.game-localization-mvr/.llm_credentials -> LLM_API_KEY

4. Dependency + Environment Quick Check (before every smoke run)

python - <<'PY'import osimport importlibfor pkg in ["requests", "numpy", "yaml", "pandas"]: try: importlib.import_module(pkg) print(f"[OK] {pkg}") except Exception: print(f"[MISSING] {pkg}")for key in ["LLM_BASE_URL", "LLM_API_KEY", "LLM_MODEL"]: print(f"{key}={'SET' if os.getenv(key) else 'MISSING'}")PY

If any dependency shows MISSING or env variable shows MISSING, do not start smoke run yet.

PowerShell 快速检查:

$missing=@()
foreach ($min@("requests","numpy","yaml","pandas","jieba")) {
try {
python -c "import importlib.util; print(bool(importlib.util.find_spec('$m')))"Write-Host"[OK] $m"
} catch {
$missing+=$mWrite-Host"[MISSING] $m"
}
}
Write-Host"LLM_BASE_URL=$([bool]$env:LLM_BASE_URL)"Write-Host"LLM_API_KEY=$([bool]$env:LLM_API_KEY)"Write-Host"LLM_MODEL=$([bool]$env:LLM_MODEL)"

3. Run Pipeline

# Bootstrap tracked style assets once per clean worktree
python scripts/style_guide_bootstrap.py --dry-run
# Verify LLM
python scripts/llm_ping.py
# Normalize → Translate → QA → Export
python scripts/normalize_guard.py input.csv normalized.csv map.json workflow/placeholder_schema.yaml
python scripts/translate_llm.py --input normalized.csv --output translated.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml
python scripts/qa_hard.py translated.csv qa_report.json map.json
python scripts/rehydrate_export.py translated.csv map.json final.csv

3.1 Smoke Pipeline (Manifest + Issue Record)

# Full smoke pass with manifest output + issue recording
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US
# 可选:仅做预检
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US --verify-mode preflight

This command:

  • auto-bootstraps workflow/style_profile.generated.yaml if the clean worktree does not have one yet
  • runs llm_ping -> normalize_guard -> translate_llm -> qa_hard -> rehydrate_export
  • generates a run manifest: data/smoke_run_<timestamp>/run_manifest.json
  • runs smoke_verify --manifest ...
  • records issues to reports/smoke_issues_<run-id>.json and .jsonl
  • emits manifest.stage_artifacts with:
    • connectivity_log
    • normalize_log
    • translate_log
    • qa_hard_report
    • final_csv
    • smoke_verify_log
  • verify_mode supports preflight|full,默认 full(含行数/QA 统计)

建议每次冒烟固定检查以下产物:

  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\data\smoke_runs\<run>\run_manifest.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_issues_<run_id>.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_verify_<run_id>.json

⚡ Key Features

  • Row Preservation: Empty rows kept with status=skipped_empty
  • Drift Guard: Refresh stage blocks non-placeholder text changes
  • Progress Reporting: --progress_every N for translation progress
  • Router-based Models: Configure per-step models in llm_routing.yaml
  • LLM Tracing: All calls logged to LLM_TRACE_PATH for billing

📋 Testing

# Unit tests
python scripts/test_normalize.py
python scripts/test_qa_hard.py
python scripts/test_rehydrate.py
# E2E test (small dataset)
python scripts/test_e2e_workflow.py
# Dry-run validation
python scripts/translate_llm.py --input input.csv --output out.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run

📄 License

MIT License. Built for game localization automation.


🔗 Links

About

Game localization workflow with placeholder freezing, QA validation, and export automation

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

162 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Game Localization MVR (Minimum Viable Rules) v2.1

A robust, automated workflow system for game localization with strict validation, AI translation/repair, glossary management, and multi-format export.

Core Principle: Input rows == Output rows ALWAYS. No silent data loss.


🤖 For AI Coding Agents

Quick Commands for Agents:

# 1. Verify LLM connectivity (MUST run first)
python scripts/llm_ping.py
# 2. Validate workflow configuration (dry-run)
python scripts/translate_llm.py --input input.csv --output output.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run
# 3. Run E2E test
python scripts/test_e2e_workflow.py

Environment Variables (REQUIRED):

LLM_BASE_URL=https://api.example.com/v1
LLM_API_KEY=sk-your-key
LLM_MODEL=gpt-4.1-mini
LLM_TRACE_PATH=data/llm_trace.jsonl

Key Rules for Agents:

  1. Never hardcode API keys - Use environment variables only
  2. Run llm_ping.py first - Fail-fast if LLM unavailable
  3. Check WORKSPACE_RULES.md - See docs/WORKSPACE_RULES.md for hard constraints
  4. Row preservation is P0 - Empty source rows must be preserved with status=skipped_empty
  5. Glossary is mandatory - glossary/compiled.yaml must exist before translation

🔄 Handoff

Use this section when a new machine or a new agent needs to continue the current UI/operator roadmap without local context from the previous workstation.

Roadmap status

  • Phase 5 frontend_runtime_shell: implemented and merged
  • Phase 6 operator_workspace_dashboard: implemented and merged
  • Latest local follow-up scope: dashboard redesign, Chinese UI toggle, manual UAT seed/helper, and migration closeout docs

Recommended starting point

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
git checkout main
  • Start from a fresh main
  • Create a new codex/* branch for any follow-up work instead of reviving old merged feature branches
  • Treat task_plan.md, progress.md, and the latest docs/project_lifecycle/run_records/... chain as the continuity trail

UI/operator runtime entrypoints

python scripts/seed_phase6_manual_uat.py
python scripts/operator_ui_server.py --host 127.0.0.1 --port 8765
  • Manual UI entry: http://127.0.0.1:8765/
  • Seeded manual UAT fixtures create:
    • phase6_manual_uat_derived
    • phase6_manual_uat_persisted

Required preflight

python scripts/llm_ping.py
  • Required env:
    • LLM_BASE_URL
    • LLM_API_KEY
    • LLM_MODEL
  • Do not start smoke runs or UI live-launch validation until llm_ping.py passes

Current truth sources

  • Runtime truth:
    • run_manifest.json
    • smoke_verify_<run_id>.json
    • smoke_issues.json
  • Operator/workspace truth:
    • data/operator_cards/<run_id>/operator_cards.jsonl
    • data/operator_reports/<run_id>/operator_summary.json
  • Governance continuity:
    • docs/project_lifecycle/run_records/...
    • task_plan.md
    • progress.md

Recommended next step

  • Finish or re-run human UI acceptance on the latest dashboard build
  • Address any follow-up UX/runtime defects found in manual UAT
  • Then open the next roadmap scope from fresh main

🚀 Pipeline Overview

Input CSV → Normalize → Translate → QA_Hard → Repair → Export
↓
Glossary (required)
StepScriptPurposeBlocking?
0llm_ping.py🔌 LLM connectivity checkYES
1normalize_guard.py🧊 Freeze placeholders → tokensYES
2-4extract_terms.pyglossary_compile.py📖 Build glossaryYES
5translate_llm.py🤖 AI TranslationYES
6qa_hard.py🛡️ Validate tokens/patternsYES
7repair_loop.py🔧 Auto-repair hard errors-
8soft_qa_llm.py🧠 Quality review-
10rehydrate_export.py💧 Restore tokens → placeholdersYES

📁 Project Structure

loc-mvr/
├── config/
│ ├── llm_routing.yaml # Model routing per step
│ └── pricing.yaml # Cost calculation
├── glossary/
│ ├── compiled.yaml # Active glossary (generated)
│ └── generic_terms_zh.txt # Blacklist for extraction
├── scripts/
│ ├── llm_ping.py # ★ Run first - connectivity check
│ ├── normalize_guard.py # Step 1: Placeholder freezing
│ ├── translate_llm.py # Step 5: Translation
│ ├── qa_hard.py # Step 6: Hard validation
│ ├── repair_loop.py # Step 7: Auto-repair
│ └── runtime_adapter.py # LLM client with routing
├── workflow/
│ ├── style_guide.md # Translation style rules
│ ├── forbidden_patterns.txt
│ └── placeholder_schema.yaml
└── docs/
└── WORKSPACE_RULES.md # ★ Hard constraints for agents

🔧 Quick Start (Human)

1. Setup

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
pip install pyyaml requests numpy pandas jieba

2. Configure LLM (推荐持久化)

# Windows PowerShell$env:LLM_BASE_URL="https://api.apiyi.com/v1"$env:LLM_API_KEY="sk-your-key"$env:LLM_MODEL="gpt-4.1-mini"

也可在本地持久化文件中配置(优先于环境变量自动读取):

# 在 main_worktree/.llm_credentials 创建
LLM_BASE_URL=https://api.apiyi.com/v1
LLM_API_KEY=sk-your-key

当前加载顺序:LLM_API_KEY_FILE -> ./.llm_credentials/./.llm_env/./config/llm_credentials.env/~/.game-localization-mvr/.llm_credentials -> LLM_API_KEY

4. Dependency + Environment Quick Check (before every smoke run)

python - <<'PY'import osimport importlibfor pkg in ["requests", "numpy", "yaml", "pandas"]: try: importlib.import_module(pkg) print(f"[OK] {pkg}") except Exception: print(f"[MISSING] {pkg}")for key in ["LLM_BASE_URL", "LLM_API_KEY", "LLM_MODEL"]: print(f"{key}={'SET' if os.getenv(key) else 'MISSING'}")PY

If any dependency shows MISSING or env variable shows MISSING, do not start smoke run yet.

PowerShell 快速检查:

$missing=@()
foreach ($min@("requests","numpy","yaml","pandas","jieba")) {
try {
python -c "import importlib.util; print(bool(importlib.util.find_spec('$m')))"Write-Host"[OK] $m"
} catch {
$missing+=$mWrite-Host"[MISSING] $m"
}
}
Write-Host"LLM_BASE_URL=$([bool]$env:LLM_BASE_URL)"Write-Host"LLM_API_KEY=$([bool]$env:LLM_API_KEY)"Write-Host"LLM_MODEL=$([bool]$env:LLM_MODEL)"

3. Run Pipeline

# Bootstrap tracked style assets once per clean worktree
python scripts/style_guide_bootstrap.py --dry-run
# Verify LLM
python scripts/llm_ping.py
# Normalize → Translate → QA → Export
python scripts/normalize_guard.py input.csv normalized.csv map.json workflow/placeholder_schema.yaml
python scripts/translate_llm.py --input normalized.csv --output translated.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml
python scripts/qa_hard.py translated.csv qa_report.json map.json
python scripts/rehydrate_export.py translated.csv map.json final.csv

3.1 Smoke Pipeline (Manifest + Issue Record)

# Full smoke pass with manifest output + issue recording
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US
# 可选:仅做预检
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US --verify-mode preflight

This command:

  • auto-bootstraps workflow/style_profile.generated.yaml if the clean worktree does not have one yet
  • runs llm_ping -> normalize_guard -> translate_llm -> qa_hard -> rehydrate_export
  • generates a run manifest: data/smoke_run_<timestamp>/run_manifest.json
  • runs smoke_verify --manifest ...
  • records issues to reports/smoke_issues_<run-id>.json and .jsonl
  • emits manifest.stage_artifacts with:
    • connectivity_log
    • normalize_log
    • translate_log
    • qa_hard_report
    • final_csv
    • smoke_verify_log
  • verify_mode supports preflight|full,默认 full(含行数/QA 统计)

建议每次冒烟固定检查以下产物:

  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\data\smoke_runs\<run>\run_manifest.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_issues_<run_id>.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_verify_<run_id>.json

⚡ Key Features

  • Row Preservation: Empty rows kept with status=skipped_empty
  • Drift Guard: Refresh stage blocks non-placeholder text changes
  • Progress Reporting: --progress_every N for translation progress
  • Router-based Models: Configure per-step models in llm_routing.yaml
  • LLM Tracing: All calls logged to LLM_TRACE_PATH for billing

📋 Testing

# Unit tests
python scripts/test_normalize.py
python scripts/test_qa_hard.py
python scripts/test_rehydrate.py
# E2E test (small dataset)
python scripts/test_e2e_workflow.py
# Dry-run validation
python scripts/translate_llm.py --input input.csv --output out.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run

📄 License

MIT License. Built for game localization automation.


🔗 Links

About

Game localization workflow with placeholder freezing, QA validation, and export automation

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Latest commit

History

162 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Game Localization MVR (Minimum Viable Rules) v2.1

A robust, automated workflow system for game localization with strict validation, AI translation/repair, glossary management, and multi-format export.

Core Principle: Input rows == Output rows ALWAYS. No silent data loss.


🤖 For AI Coding Agents

Quick Commands for Agents:

# 1. Verify LLM connectivity (MUST run first)
python scripts/llm_ping.py
# 2. Validate workflow configuration (dry-run)
python scripts/translate_llm.py --input input.csv --output output.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run
# 3. Run E2E test
python scripts/test_e2e_workflow.py

Environment Variables (REQUIRED):

LLM_BASE_URL=https://api.example.com/v1
LLM_API_KEY=sk-your-key
LLM_MODEL=gpt-4.1-mini
LLM_TRACE_PATH=data/llm_trace.jsonl

Key Rules for Agents:

  1. Never hardcode API keys - Use environment variables only
  2. Run llm_ping.py first - Fail-fast if LLM unavailable
  3. Check WORKSPACE_RULES.md - See docs/WORKSPACE_RULES.md for hard constraints
  4. Row preservation is P0 - Empty source rows must be preserved with status=skipped_empty
  5. Glossary is mandatory - glossary/compiled.yaml must exist before translation

🔄 Handoff

Use this section when a new machine or a new agent needs to continue the current UI/operator roadmap without local context from the previous workstation.

Roadmap status

  • Phase 5 frontend_runtime_shell: implemented and merged
  • Phase 6 operator_workspace_dashboard: implemented and merged
  • Latest local follow-up scope: dashboard redesign, Chinese UI toggle, manual UAT seed/helper, and migration closeout docs

Recommended starting point

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
git checkout main
  • Start from a fresh main
  • Create a new codex/* branch for any follow-up work instead of reviving old merged feature branches
  • Treat task_plan.md, progress.md, and the latest docs/project_lifecycle/run_records/... chain as the continuity trail

UI/operator runtime entrypoints

python scripts/seed_phase6_manual_uat.py
python scripts/operator_ui_server.py --host 127.0.0.1 --port 8765
  • Manual UI entry: http://127.0.0.1:8765/
  • Seeded manual UAT fixtures create:
    • phase6_manual_uat_derived
    • phase6_manual_uat_persisted

Required preflight

python scripts/llm_ping.py
  • Required env:
    • LLM_BASE_URL
    • LLM_API_KEY
    • LLM_MODEL
  • Do not start smoke runs or UI live-launch validation until llm_ping.py passes

Current truth sources

  • Runtime truth:
    • run_manifest.json
    • smoke_verify_<run_id>.json
    • smoke_issues.json
  • Operator/workspace truth:
    • data/operator_cards/<run_id>/operator_cards.jsonl
    • data/operator_reports/<run_id>/operator_summary.json
  • Governance continuity:
    • docs/project_lifecycle/run_records/...
    • task_plan.md
    • progress.md

Recommended next step

  • Finish or re-run human UI acceptance on the latest dashboard build
  • Address any follow-up UX/runtime defects found in manual UAT
  • Then open the next roadmap scope from fresh main

🚀 Pipeline Overview

Input CSV → Normalize → Translate → QA_Hard → Repair → Export
↓
Glossary (required)
StepScriptPurposeBlocking?
0llm_ping.py🔌 LLM connectivity checkYES
1normalize_guard.py🧊 Freeze placeholders → tokensYES
2-4extract_terms.pyglossary_compile.py📖 Build glossaryYES
5translate_llm.py🤖 AI TranslationYES
6qa_hard.py🛡️ Validate tokens/patternsYES
7repair_loop.py🔧 Auto-repair hard errors-
8soft_qa_llm.py🧠 Quality review-
10rehydrate_export.py💧 Restore tokens → placeholdersYES

📁 Project Structure

loc-mvr/
├── config/
│ ├── llm_routing.yaml # Model routing per step
│ └── pricing.yaml # Cost calculation
├── glossary/
│ ├── compiled.yaml # Active glossary (generated)
│ └── generic_terms_zh.txt # Blacklist for extraction
├── scripts/
│ ├── llm_ping.py # ★ Run first - connectivity check
│ ├── normalize_guard.py # Step 1: Placeholder freezing
│ ├── translate_llm.py # Step 5: Translation
│ ├── qa_hard.py # Step 6: Hard validation
│ ├── repair_loop.py # Step 7: Auto-repair
│ └── runtime_adapter.py # LLM client with routing
├── workflow/
│ ├── style_guide.md # Translation style rules
│ ├── forbidden_patterns.txt
│ └── placeholder_schema.yaml
└── docs/
└── WORKSPACE_RULES.md # ★ Hard constraints for agents

🔧 Quick Start (Human)

1. Setup

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
pip install pyyaml requests numpy pandas jieba

2. Configure LLM (推荐持久化)

# Windows PowerShell$env:LLM_BASE_URL="https://api.apiyi.com/v1"$env:LLM_API_KEY="sk-your-key"$env:LLM_MODEL="gpt-4.1-mini"

也可在本地持久化文件中配置(优先于环境变量自动读取):

# 在 main_worktree/.llm_credentials 创建
LLM_BASE_URL=https://api.apiyi.com/v1
LLM_API_KEY=sk-your-key

当前加载顺序:LLM_API_KEY_FILE -> ./.llm_credentials/./.llm_env/./config/llm_credentials.env/~/.game-localization-mvr/.llm_credentials -> LLM_API_KEY

4. Dependency + Environment Quick Check (before every smoke run)

python - <<'PY'import osimport importlibfor pkg in ["requests", "numpy", "yaml", "pandas"]: try: importlib.import_module(pkg) print(f"[OK] {pkg}") except Exception: print(f"[MISSING] {pkg}")for key in ["LLM_BASE_URL", "LLM_API_KEY", "LLM_MODEL"]: print(f"{key}={'SET' if os.getenv(key) else 'MISSING'}")PY

If any dependency shows MISSING or env variable shows MISSING, do not start smoke run yet.

PowerShell 快速检查:

$missing=@()
foreach ($min@("requests","numpy","yaml","pandas","jieba")) {
try {
python -c "import importlib.util; print(bool(importlib.util.find_spec('$m')))"Write-Host"[OK] $m"
} catch {
$missing+=$mWrite-Host"[MISSING] $m"
}
}
Write-Host"LLM_BASE_URL=$([bool]$env:LLM_BASE_URL)"Write-Host"LLM_API_KEY=$([bool]$env:LLM_API_KEY)"Write-Host"LLM_MODEL=$([bool]$env:LLM_MODEL)"

3. Run Pipeline

# Bootstrap tracked style assets once per clean worktree
python scripts/style_guide_bootstrap.py --dry-run
# Verify LLM
python scripts/llm_ping.py
# Normalize → Translate → QA → Export
python scripts/normalize_guard.py input.csv normalized.csv map.json workflow/placeholder_schema.yaml
python scripts/translate_llm.py --input normalized.csv --output translated.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml
python scripts/qa_hard.py translated.csv qa_report.json map.json
python scripts/rehydrate_export.py translated.csv map.json final.csv

3.1 Smoke Pipeline (Manifest + Issue Record)

# Full smoke pass with manifest output + issue recording
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US
# 可选:仅做预检
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US --verify-mode preflight

This command:

  • auto-bootstraps workflow/style_profile.generated.yaml if the clean worktree does not have one yet
  • runs llm_ping -> normalize_guard -> translate_llm -> qa_hard -> rehydrate_export
  • generates a run manifest: data/smoke_run_<timestamp>/run_manifest.json
  • runs smoke_verify --manifest ...
  • records issues to reports/smoke_issues_<run-id>.json and .jsonl
  • emits manifest.stage_artifacts with:
    • connectivity_log
    • normalize_log
    • translate_log
    • qa_hard_report
    • final_csv
    • smoke_verify_log
  • verify_mode supports preflight|full,默认 full(含行数/QA 统计)

建议每次冒烟固定检查以下产物:

  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\data\smoke_runs\<run>\run_manifest.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_issues_<run_id>.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_verify_<run_id>.json

⚡ Key Features

  • Row Preservation: Empty rows kept with status=skipped_empty
  • Drift Guard: Refresh stage blocks non-placeholder text changes
  • Progress Reporting: --progress_every N for translation progress
  • Router-based Models: Configure per-step models in llm_routing.yaml
  • LLM Tracing: All calls logged to LLM_TRACE_PATH for billing

📋 Testing

# Unit tests
python scripts/test_normalize.py
python scripts/test_qa_hard.py
python scripts/test_rehydrate.py
# E2E test (small dataset)
python scripts/test_e2e_workflow.py
# Dry-run validation
python scripts/translate_llm.py --input input.csv --output out.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run

📄 License

MIT License. Built for game localization automation.


🔗 Links

About

Game localization workflow with placeholder freezing, QA validation, and export automation

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

162 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Game Localization MVR (Minimum Viable Rules) v2.1

A robust, automated workflow system for game localization with strict validation, AI translation/repair, glossary management, and multi-format export.

Core Principle: Input rows == Output rows ALWAYS. No silent data loss.


🤖 For AI Coding Agents

Quick Commands for Agents:

# 1. Verify LLM connectivity (MUST run first)
python scripts/llm_ping.py
# 2. Validate workflow configuration (dry-run)
python scripts/translate_llm.py --input input.csv --output output.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run
# 3. Run E2E test
python scripts/test_e2e_workflow.py

Environment Variables (REQUIRED):

LLM_BASE_URL=https://api.example.com/v1
LLM_API_KEY=sk-your-key
LLM_MODEL=gpt-4.1-mini
LLM_TRACE_PATH=data/llm_trace.jsonl

Key Rules for Agents:

  1. Never hardcode API keys - Use environment variables only
  2. Run llm_ping.py first - Fail-fast if LLM unavailable
  3. Check WORKSPACE_RULES.md - See docs/WORKSPACE_RULES.md for hard constraints
  4. Row preservation is P0 - Empty source rows must be preserved with status=skipped_empty
  5. Glossary is mandatory - glossary/compiled.yaml must exist before translation

🔄 Handoff

Use this section when a new machine or a new agent needs to continue the current UI/operator roadmap without local context from the previous workstation.

Roadmap status

  • Phase 5 frontend_runtime_shell: implemented and merged
  • Phase 6 operator_workspace_dashboard: implemented and merged
  • Latest local follow-up scope: dashboard redesign, Chinese UI toggle, manual UAT seed/helper, and migration closeout docs

Recommended starting point

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
git checkout main
  • Start from a fresh main
  • Create a new codex/* branch for any follow-up work instead of reviving old merged feature branches
  • Treat task_plan.md, progress.md, and the latest docs/project_lifecycle/run_records/... chain as the continuity trail

UI/operator runtime entrypoints

python scripts/seed_phase6_manual_uat.py
python scripts/operator_ui_server.py --host 127.0.0.1 --port 8765
  • Manual UI entry: http://127.0.0.1:8765/
  • Seeded manual UAT fixtures create:
    • phase6_manual_uat_derived
    • phase6_manual_uat_persisted

Required preflight

python scripts/llm_ping.py
  • Required env:
    • LLM_BASE_URL
    • LLM_API_KEY
    • LLM_MODEL
  • Do not start smoke runs or UI live-launch validation until llm_ping.py passes

Current truth sources

  • Runtime truth:
    • run_manifest.json
    • smoke_verify_<run_id>.json
    • smoke_issues.json
  • Operator/workspace truth:
    • data/operator_cards/<run_id>/operator_cards.jsonl
    • data/operator_reports/<run_id>/operator_summary.json
  • Governance continuity:
    • docs/project_lifecycle/run_records/...
    • task_plan.md
    • progress.md

Recommended next step

  • Finish or re-run human UI acceptance on the latest dashboard build
  • Address any follow-up UX/runtime defects found in manual UAT
  • Then open the next roadmap scope from fresh main

🚀 Pipeline Overview

Input CSV → Normalize → Translate → QA_Hard → Repair → Export
↓
Glossary (required)
StepScriptPurposeBlocking?
0llm_ping.py🔌 LLM connectivity checkYES
1normalize_guard.py🧊 Freeze placeholders → tokensYES
2-4extract_terms.pyglossary_compile.py📖 Build glossaryYES
5translate_llm.py🤖 AI TranslationYES
6qa_hard.py🛡️ Validate tokens/patternsYES
7repair_loop.py🔧 Auto-repair hard errors-
8soft_qa_llm.py🧠 Quality review-
10rehydrate_export.py💧 Restore tokens → placeholdersYES

📁 Project Structure

loc-mvr/
├── config/
│ ├── llm_routing.yaml # Model routing per step
│ └── pricing.yaml # Cost calculation
├── glossary/
│ ├── compiled.yaml # Active glossary (generated)
│ └── generic_terms_zh.txt # Blacklist for extraction
├── scripts/
│ ├── llm_ping.py # ★ Run first - connectivity check
│ ├── normalize_guard.py # Step 1: Placeholder freezing
│ ├── translate_llm.py # Step 5: Translation
│ ├── qa_hard.py # Step 6: Hard validation
│ ├── repair_loop.py # Step 7: Auto-repair
│ └── runtime_adapter.py # LLM client with routing
├── workflow/
│ ├── style_guide.md # Translation style rules
│ ├── forbidden_patterns.txt
│ └── placeholder_schema.yaml
└── docs/
└── WORKSPACE_RULES.md # ★ Hard constraints for agents

🔧 Quick Start (Human)

1. Setup

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
pip install pyyaml requests numpy pandas jieba

2. Configure LLM (推荐持久化)

# Windows PowerShell$env:LLM_BASE_URL="https://api.apiyi.com/v1"$env:LLM_API_KEY="sk-your-key"$env:LLM_MODEL="gpt-4.1-mini"

也可在本地持久化文件中配置(优先于环境变量自动读取):

# 在 main_worktree/.llm_credentials 创建
LLM_BASE_URL=https://api.apiyi.com/v1
LLM_API_KEY=sk-your-key

当前加载顺序:LLM_API_KEY_FILE -> ./.llm_credentials/./.llm_env/./config/llm_credentials.env/~/.game-localization-mvr/.llm_credentials -> LLM_API_KEY

4. Dependency + Environment Quick Check (before every smoke run)

python - <<'PY'import osimport importlibfor pkg in ["requests", "numpy", "yaml", "pandas"]: try: importlib.import_module(pkg) print(f"[OK] {pkg}") except Exception: print(f"[MISSING] {pkg}")for key in ["LLM_BASE_URL", "LLM_API_KEY", "LLM_MODEL"]: print(f"{key}={'SET' if os.getenv(key) else 'MISSING'}")PY

If any dependency shows MISSING or env variable shows MISSING, do not start smoke run yet.

PowerShell 快速检查:

$missing=@()
foreach ($min@("requests","numpy","yaml","pandas","jieba")) {
try {
python -c "import importlib.util; print(bool(importlib.util.find_spec('$m')))"Write-Host"[OK] $m"
} catch {
$missing+=$mWrite-Host"[MISSING] $m"
}
}
Write-Host"LLM_BASE_URL=$([bool]$env:LLM_BASE_URL)"Write-Host"LLM_API_KEY=$([bool]$env:LLM_API_KEY)"Write-Host"LLM_MODEL=$([bool]$env:LLM_MODEL)"

3. Run Pipeline

# Bootstrap tracked style assets once per clean worktree
python scripts/style_guide_bootstrap.py --dry-run
# Verify LLM
python scripts/llm_ping.py
# Normalize → Translate → QA → Export
python scripts/normalize_guard.py input.csv normalized.csv map.json workflow/placeholder_schema.yaml
python scripts/translate_llm.py --input normalized.csv --output translated.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml
python scripts/qa_hard.py translated.csv qa_report.json map.json
python scripts/rehydrate_export.py translated.csv map.json final.csv

3.1 Smoke Pipeline (Manifest + Issue Record)

# Full smoke pass with manifest output + issue recording
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US
# 可选:仅做预检
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US --verify-mode preflight

This command:

  • auto-bootstraps workflow/style_profile.generated.yaml if the clean worktree does not have one yet
  • runs llm_ping -> normalize_guard -> translate_llm -> qa_hard -> rehydrate_export
  • generates a run manifest: data/smoke_run_<timestamp>/run_manifest.json
  • runs smoke_verify --manifest ...
  • records issues to reports/smoke_issues_<run-id>.json and .jsonl
  • emits manifest.stage_artifacts with:
    • connectivity_log
    • normalize_log
    • translate_log
    • qa_hard_report
    • final_csv
    • smoke_verify_log
  • verify_mode supports preflight|full,默认 full(含行数/QA 统计)

建议每次冒烟固定检查以下产物:

  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\data\smoke_runs\<run>\run_manifest.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_issues_<run_id>.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_verify_<run_id>.json

⚡ Key Features

  • Row Preservation: Empty rows kept with status=skipped_empty
  • Drift Guard: Refresh stage blocks non-placeholder text changes
  • Progress Reporting: --progress_every N for translation progress
  • Router-based Models: Configure per-step models in llm_routing.yaml
  • LLM Tracing: All calls logged to LLM_TRACE_PATH for billing

📋 Testing

# Unit tests
python scripts/test_normalize.py
python scripts/test_qa_hard.py
python scripts/test_rehydrate.py
# E2E test (small dataset)
python scripts/test_e2e_workflow.py
# Dry-run validation
python scripts/translate_llm.py --input input.csv --output out.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run

📄 License

MIT License. Built for game localization automation.


🔗 Links

About

Game localization workflow with placeholder freezing, QA validation, and export automation

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

162 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Game Localization MVR (Minimum Viable Rules) v2.1

A robust, automated workflow system for game localization with strict validation, AI translation/repair, glossary management, and multi-format export.

Core Principle: Input rows == Output rows ALWAYS. No silent data loss.


🤖 For AI Coding Agents

Quick Commands for Agents:

# 1. Verify LLM connectivity (MUST run first)
python scripts/llm_ping.py
# 2. Validate workflow configuration (dry-run)
python scripts/translate_llm.py --input input.csv --output output.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run
# 3. Run E2E test
python scripts/test_e2e_workflow.py

Environment Variables (REQUIRED):

LLM_BASE_URL=https://api.example.com/v1
LLM_API_KEY=sk-your-key
LLM_MODEL=gpt-4.1-mini
LLM_TRACE_PATH=data/llm_trace.jsonl

Key Rules for Agents:

  1. Never hardcode API keys - Use environment variables only
  2. Run llm_ping.py first - Fail-fast if LLM unavailable
  3. Check WORKSPACE_RULES.md - See docs/WORKSPACE_RULES.md for hard constraints
  4. Row preservation is P0 - Empty source rows must be preserved with status=skipped_empty
  5. Glossary is mandatory - glossary/compiled.yaml must exist before translation

🔄 Handoff

Use this section when a new machine or a new agent needs to continue the current UI/operator roadmap without local context from the previous workstation.

Roadmap status

  • Phase 5 frontend_runtime_shell: implemented and merged
  • Phase 6 operator_workspace_dashboard: implemented and merged
  • Latest local follow-up scope: dashboard redesign, Chinese UI toggle, manual UAT seed/helper, and migration closeout docs

Recommended starting point

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
git checkout main
  • Start from a fresh main
  • Create a new codex/* branch for any follow-up work instead of reviving old merged feature branches
  • Treat task_plan.md, progress.md, and the latest docs/project_lifecycle/run_records/... chain as the continuity trail

UI/operator runtime entrypoints

python scripts/seed_phase6_manual_uat.py
python scripts/operator_ui_server.py --host 127.0.0.1 --port 8765
  • Manual UI entry: http://127.0.0.1:8765/
  • Seeded manual UAT fixtures create:
    • phase6_manual_uat_derived
    • phase6_manual_uat_persisted

Required preflight

python scripts/llm_ping.py
  • Required env:
    • LLM_BASE_URL
    • LLM_API_KEY
    • LLM_MODEL
  • Do not start smoke runs or UI live-launch validation until llm_ping.py passes

Current truth sources

  • Runtime truth:
    • run_manifest.json
    • smoke_verify_<run_id>.json
    • smoke_issues.json
  • Operator/workspace truth:
    • data/operator_cards/<run_id>/operator_cards.jsonl
    • data/operator_reports/<run_id>/operator_summary.json
  • Governance continuity:
    • docs/project_lifecycle/run_records/...
    • task_plan.md
    • progress.md

Recommended next step

  • Finish or re-run human UI acceptance on the latest dashboard build
  • Address any follow-up UX/runtime defects found in manual UAT
  • Then open the next roadmap scope from fresh main

🚀 Pipeline Overview

Input CSV → Normalize → Translate → QA_Hard → Repair → Export
↓
Glossary (required)
StepScriptPurposeBlocking?
0llm_ping.py🔌 LLM connectivity checkYES
1normalize_guard.py🧊 Freeze placeholders → tokensYES
2-4extract_terms.pyglossary_compile.py📖 Build glossaryYES
5translate_llm.py🤖 AI TranslationYES
6qa_hard.py🛡️ Validate tokens/patternsYES
7repair_loop.py🔧 Auto-repair hard errors-
8soft_qa_llm.py🧠 Quality review-
10rehydrate_export.py💧 Restore tokens → placeholdersYES

📁 Project Structure

loc-mvr/
├── config/
│ ├── llm_routing.yaml # Model routing per step
│ └── pricing.yaml # Cost calculation
├── glossary/
│ ├── compiled.yaml # Active glossary (generated)
│ └── generic_terms_zh.txt # Blacklist for extraction
├── scripts/
│ ├── llm_ping.py # ★ Run first - connectivity check
│ ├── normalize_guard.py # Step 1: Placeholder freezing
│ ├── translate_llm.py # Step 5: Translation
│ ├── qa_hard.py # Step 6: Hard validation
│ ├── repair_loop.py # Step 7: Auto-repair
│ └── runtime_adapter.py # LLM client with routing
├── workflow/
│ ├── style_guide.md # Translation style rules
│ ├── forbidden_patterns.txt
│ └── placeholder_schema.yaml
└── docs/
└── WORKSPACE_RULES.md # ★ Hard constraints for agents

🔧 Quick Start (Human)

1. Setup

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
pip install pyyaml requests numpy pandas jieba

2. Configure LLM (推荐持久化)

# Windows PowerShell$env:LLM_BASE_URL="https://api.apiyi.com/v1"$env:LLM_API_KEY="sk-your-key"$env:LLM_MODEL="gpt-4.1-mini"

也可在本地持久化文件中配置(优先于环境变量自动读取):

# 在 main_worktree/.llm_credentials 创建
LLM_BASE_URL=https://api.apiyi.com/v1
LLM_API_KEY=sk-your-key

当前加载顺序:LLM_API_KEY_FILE -> ./.llm_credentials/./.llm_env/./config/llm_credentials.env/~/.game-localization-mvr/.llm_credentials -> LLM_API_KEY

4. Dependency + Environment Quick Check (before every smoke run)

python - <<'PY'import osimport importlibfor pkg in ["requests", "numpy", "yaml", "pandas"]: try: importlib.import_module(pkg) print(f"[OK] {pkg}") except Exception: print(f"[MISSING] {pkg}")for key in ["LLM_BASE_URL", "LLM_API_KEY", "LLM_MODEL"]: print(f"{key}={'SET' if os.getenv(key) else 'MISSING'}")PY

If any dependency shows MISSING or env variable shows MISSING, do not start smoke run yet.

PowerShell 快速检查:

$missing=@()
foreach ($min@("requests","numpy","yaml","pandas","jieba")) {
try {
python -c "import importlib.util; print(bool(importlib.util.find_spec('$m')))"Write-Host"[OK] $m"
} catch {
$missing+=$mWrite-Host"[MISSING] $m"
}
}
Write-Host"LLM_BASE_URL=$([bool]$env:LLM_BASE_URL)"Write-Host"LLM_API_KEY=$([bool]$env:LLM_API_KEY)"Write-Host"LLM_MODEL=$([bool]$env:LLM_MODEL)"

3. Run Pipeline

# Bootstrap tracked style assets once per clean worktree
python scripts/style_guide_bootstrap.py --dry-run
# Verify LLM
python scripts/llm_ping.py
# Normalize → Translate → QA → Export
python scripts/normalize_guard.py input.csv normalized.csv map.json workflow/placeholder_schema.yaml
python scripts/translate_llm.py --input normalized.csv --output translated.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml
python scripts/qa_hard.py translated.csv qa_report.json map.json
python scripts/rehydrate_export.py translated.csv map.json final.csv

3.1 Smoke Pipeline (Manifest + Issue Record)

# Full smoke pass with manifest output + issue recording
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US
# 可选:仅做预检
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US --verify-mode preflight

This command:

  • auto-bootstraps workflow/style_profile.generated.yaml if the clean worktree does not have one yet
  • runs llm_ping -> normalize_guard -> translate_llm -> qa_hard -> rehydrate_export
  • generates a run manifest: data/smoke_run_<timestamp>/run_manifest.json
  • runs smoke_verify --manifest ...
  • records issues to reports/smoke_issues_<run-id>.json and .jsonl
  • emits manifest.stage_artifacts with:
    • connectivity_log
    • normalize_log
    • translate_log
    • qa_hard_report
    • final_csv
    • smoke_verify_log
  • verify_mode supports preflight|full,默认 full(含行数/QA 统计)

建议每次冒烟固定检查以下产物:

  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\data\smoke_runs\<run>\run_manifest.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_issues_<run_id>.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_verify_<run_id>.json

⚡ Key Features

  • Row Preservation: Empty rows kept with status=skipped_empty
  • Drift Guard: Refresh stage blocks non-placeholder text changes
  • Progress Reporting: --progress_every N for translation progress
  • Router-based Models: Configure per-step models in llm_routing.yaml
  • LLM Tracing: All calls logged to LLM_TRACE_PATH for billing

📋 Testing

# Unit tests
python scripts/test_normalize.py
python scripts/test_qa_hard.py
python scripts/test_rehydrate.py
# E2E test (small dataset)
python scripts/test_e2e_workflow.py
# Dry-run validation
python scripts/translate_llm.py --input input.csv --output out.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run

📄 License

MIT License. Built for game localization automation.


🔗 Links

About

Game localization workflow with placeholder freezing, QA validation, and export automation

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Latest commit

History

162 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Game Localization MVR (Minimum Viable Rules) v2.1

A robust, automated workflow system for game localization with strict validation, AI translation/repair, glossary management, and multi-format export.

Core Principle: Input rows == Output rows ALWAYS. No silent data loss.


🤖 For AI Coding Agents

Quick Commands for Agents:

# 1. Verify LLM connectivity (MUST run first)
python scripts/llm_ping.py
# 2. Validate workflow configuration (dry-run)
python scripts/translate_llm.py --input input.csv --output output.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run
# 3. Run E2E test
python scripts/test_e2e_workflow.py

Environment Variables (REQUIRED):

LLM_BASE_URL=https://api.example.com/v1
LLM_API_KEY=sk-your-key
LLM_MODEL=gpt-4.1-mini
LLM_TRACE_PATH=data/llm_trace.jsonl

Key Rules for Agents:

  1. Never hardcode API keys - Use environment variables only
  2. Run llm_ping.py first - Fail-fast if LLM unavailable
  3. Check WORKSPACE_RULES.md - See docs/WORKSPACE_RULES.md for hard constraints
  4. Row preservation is P0 - Empty source rows must be preserved with status=skipped_empty
  5. Glossary is mandatory - glossary/compiled.yaml must exist before translation

🔄 Handoff

Use this section when a new machine or a new agent needs to continue the current UI/operator roadmap without local context from the previous workstation.

Roadmap status

  • Phase 5 frontend_runtime_shell: implemented and merged
  • Phase 6 operator_workspace_dashboard: implemented and merged
  • Latest local follow-up scope: dashboard redesign, Chinese UI toggle, manual UAT seed/helper, and migration closeout docs

Recommended starting point

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
git checkout main
  • Start from a fresh main
  • Create a new codex/* branch for any follow-up work instead of reviving old merged feature branches
  • Treat task_plan.md, progress.md, and the latest docs/project_lifecycle/run_records/... chain as the continuity trail

UI/operator runtime entrypoints

python scripts/seed_phase6_manual_uat.py
python scripts/operator_ui_server.py --host 127.0.0.1 --port 8765
  • Manual UI entry: http://127.0.0.1:8765/
  • Seeded manual UAT fixtures create:
    • phase6_manual_uat_derived
    • phase6_manual_uat_persisted

Required preflight

python scripts/llm_ping.py
  • Required env:
    • LLM_BASE_URL
    • LLM_API_KEY
    • LLM_MODEL
  • Do not start smoke runs or UI live-launch validation until llm_ping.py passes

Current truth sources

  • Runtime truth:
    • run_manifest.json
    • smoke_verify_<run_id>.json
    • smoke_issues.json
  • Operator/workspace truth:
    • data/operator_cards/<run_id>/operator_cards.jsonl
    • data/operator_reports/<run_id>/operator_summary.json
  • Governance continuity:
    • docs/project_lifecycle/run_records/...
    • task_plan.md
    • progress.md

Recommended next step

  • Finish or re-run human UI acceptance on the latest dashboard build
  • Address any follow-up UX/runtime defects found in manual UAT
  • Then open the next roadmap scope from fresh main

🚀 Pipeline Overview

Input CSV → Normalize → Translate → QA_Hard → Repair → Export
↓
Glossary (required)
StepScriptPurposeBlocking?
0llm_ping.py🔌 LLM connectivity checkYES
1normalize_guard.py🧊 Freeze placeholders → tokensYES
2-4extract_terms.pyglossary_compile.py📖 Build glossaryYES
5translate_llm.py🤖 AI TranslationYES
6qa_hard.py🛡️ Validate tokens/patternsYES
7repair_loop.py🔧 Auto-repair hard errors-
8soft_qa_llm.py🧠 Quality review-
10rehydrate_export.py💧 Restore tokens → placeholdersYES

📁 Project Structure

loc-mvr/
├── config/
│ ├── llm_routing.yaml # Model routing per step
│ └── pricing.yaml # Cost calculation
├── glossary/
│ ├── compiled.yaml # Active glossary (generated)
│ └── generic_terms_zh.txt # Blacklist for extraction
├── scripts/
│ ├── llm_ping.py # ★ Run first - connectivity check
│ ├── normalize_guard.py # Step 1: Placeholder freezing
│ ├── translate_llm.py # Step 5: Translation
│ ├── qa_hard.py # Step 6: Hard validation
│ ├── repair_loop.py # Step 7: Auto-repair
│ └── runtime_adapter.py # LLM client with routing
├── workflow/
│ ├── style_guide.md # Translation style rules
│ ├── forbidden_patterns.txt
│ └── placeholder_schema.yaml
└── docs/
└── WORKSPACE_RULES.md # ★ Hard constraints for agents

🔧 Quick Start (Human)

1. Setup

git clone https://github.com/Charpup/game-localization-mvr.git
cd game-localization-mvr
pip install pyyaml requests numpy pandas jieba

2. Configure LLM (推荐持久化)

# Windows PowerShell$env:LLM_BASE_URL="https://api.apiyi.com/v1"$env:LLM_API_KEY="sk-your-key"$env:LLM_MODEL="gpt-4.1-mini"

也可在本地持久化文件中配置(优先于环境变量自动读取):

# 在 main_worktree/.llm_credentials 创建
LLM_BASE_URL=https://api.apiyi.com/v1
LLM_API_KEY=sk-your-key

当前加载顺序:LLM_API_KEY_FILE -> ./.llm_credentials/./.llm_env/./config/llm_credentials.env/~/.game-localization-mvr/.llm_credentials -> LLM_API_KEY

4. Dependency + Environment Quick Check (before every smoke run)

python - <<'PY'import osimport importlibfor pkg in ["requests", "numpy", "yaml", "pandas"]: try: importlib.import_module(pkg) print(f"[OK] {pkg}") except Exception: print(f"[MISSING] {pkg}")for key in ["LLM_BASE_URL", "LLM_API_KEY", "LLM_MODEL"]: print(f"{key}={'SET' if os.getenv(key) else 'MISSING'}")PY

If any dependency shows MISSING or env variable shows MISSING, do not start smoke run yet.

PowerShell 快速检查:

$missing=@()
foreach ($min@("requests","numpy","yaml","pandas","jieba")) {
try {
python -c "import importlib.util; print(bool(importlib.util.find_spec('$m')))"Write-Host"[OK] $m"
} catch {
$missing+=$mWrite-Host"[MISSING] $m"
}
}
Write-Host"LLM_BASE_URL=$([bool]$env:LLM_BASE_URL)"Write-Host"LLM_API_KEY=$([bool]$env:LLM_API_KEY)"Write-Host"LLM_MODEL=$([bool]$env:LLM_MODEL)"

3. Run Pipeline

# Bootstrap tracked style assets once per clean worktree
python scripts/style_guide_bootstrap.py --dry-run
# Verify LLM
python scripts/llm_ping.py
# Normalize → Translate → QA → Export
python scripts/normalize_guard.py input.csv normalized.csv map.json workflow/placeholder_schema.yaml
python scripts/translate_llm.py --input normalized.csv --output translated.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml
python scripts/qa_hard.py translated.csv qa_report.json map.json
python scripts/rehydrate_export.py translated.csv map.json final.csv

3.1 Smoke Pipeline (Manifest + Issue Record)

# Full smoke pass with manifest output + issue recording
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US
# 可选:仅做预检
python scripts/run_smoke_pipeline.py --input "D:\\Dev_Env\\loc-mvr 测试文档\\test_input_200-row.csv" --target-lang en-US --verify-mode preflight

This command:

  • auto-bootstraps workflow/style_profile.generated.yaml if the clean worktree does not have one yet
  • runs llm_ping -> normalize_guard -> translate_llm -> qa_hard -> rehydrate_export
  • generates a run manifest: data/smoke_run_<timestamp>/run_manifest.json
  • runs smoke_verify --manifest ...
  • records issues to reports/smoke_issues_<run-id>.json and .jsonl
  • emits manifest.stage_artifacts with:
    • connectivity_log
    • normalize_log
    • translate_log
    • qa_hard_report
    • final_csv
    • smoke_verify_log
  • verify_mode supports preflight|full,默认 full(含行数/QA 统计)

建议每次冒烟固定检查以下产物:

  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\data\smoke_runs\<run>\run_manifest.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_issues_<run_id>.json
  • D:\Dev_Env\GPT_Codex_Workspace\game-localization-mvr\main_worktree\reports\smoke_verify_<run_id>.json

⚡ Key Features

  • Row Preservation: Empty rows kept with status=skipped_empty
  • Drift Guard: Refresh stage blocks non-placeholder text changes
  • Progress Reporting: --progress_every N for translation progress
  • Router-based Models: Configure per-step models in llm_routing.yaml
  • LLM Tracing: All calls logged to LLM_TRACE_PATH for billing

📋 Testing

# Unit tests
python scripts/test_normalize.py
python scripts/test_qa_hard.py
python scripts/test_rehydrate.py
# E2E test (small dataset)
python scripts/test_e2e_workflow.py
# Dry-run validation
python scripts/translate_llm.py --input input.csv --output out.csv --style workflow/style_guide.md --glossary glossary/compiled.yaml --style-profile workflow/style_profile.generated.yaml --dry-run

📄 License

MIT License. Built for game localization automation.


🔗 Links

About

Game localization workflow with placeholder freezing, QA validation, and export automation

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages