How to Localize JSON i18n Files, .SRT Subtitles & Bilingual Docs with LLMs Without Breaking Variables (5 Free Prompts)

2026-11-28来源 dev.toEnglish

If you have ever tried localizing a web app's en.json, translating .SRT video subtitles, or writing bilingual English–Vietnamese documentation with ChatGPT, Claude, or Gemini, you have probably hit the same 3 headaches:

  1. Broken syntax & mutated placeholders: {limit}, %s, or {{username}} gets accidentally translated or stripped.
  2. UI overflow: A crisp 2-word English button (Save draft) expands into a 7-word phrase that wrecks your mobile navbar.
  3. Stiff "translationese" & broken pronouns: Literal idioms (like translating "meet halfway" into Vietnamese as "gặp nhau ở nửa đường") and inconsistent Vietnamese pronouns (bạn in paragraph 1, quý khách in paragraph 3).

Below is the 5-part R.C.A.G.O. prompting structure I use across localization workflows, plus 5 production-ready prompts you can copy and run right now.

The R.C.A.G.O. Precision Translation Framework

Instead of typing "Translate this to Vietnamese/English", lock five constraints upfront:

Element What It Prevents Example Constraint
R — Role Generic vocabulary "Act as a senior Software Localization (L10n) Engineer."
C — Context Wrong noun/verb sense "Context: Mobile fintech checkout toast message."
A — Audience & Register Pronoun drift "Vietnamese: Bạn (user) / Chúng tôi (brand). Concise UX."
G — Guardrails Broken tags & AI clichés "Never touch keys or {vars}. Keep <= +15% EN length."
O — Output Post-processing pain "Return valid JSON only—zero markdown commentary."

5 Production-Ready Copy-Paste Prompts

1. Strict JSON / YAML i18n Localizer (Zero Broken Keys)

You are a senior software localization engineer (L10n). Translate ONLY the string VALUES in the JSON file below into [TARGET_LANGUAGE]. NON-NEGOTIABLE RULES: 1. NEVER translate, rename, or reorder keys. 2. Preserve ALL placeholders verbatim: {count}, {{username}}, %s, %d, $1, <0>...</0>, \n. 3. Maintain valid JSON syntax (escaped quotes, zero trailing commas). 4. Keep UI button/tab strings concise (within +15% of English character length). 5. Output ONLY the valid JSON block. UI CONTEXT: [e.g., B2B SaaS analytics dashboard] SOURCE JSON: [PASTE JSON HERE] 

Real Before/After (EN -> VI):

  • Source: {"btn_save_draft": "Save draft", "err_quota": "You reached {limit} exports this month. Upgrade to continue."}
  • Naive prompt: {"btn_save_draft": "Lưu bản nháp tài liệu của bạn", "err_quota": "Bạn đã đạt đến giới hạn xuất trong tháng này..."} (dropped {limit} & overflowed button!)
  • R.C.A.G.O. prompt: {"btn_save_draft": "Lưu nháp", "err_quota": "Bạn đã dùng hết {limit} lượt xuất tháng này. Nâng cấp để tiếp tục."}

2. Timecode-Safe .SRT Subtitle Translator

You are a broadcast-standard audiovisual subtitle translator. Translate the .SRT subtitle block below from [SOURCE_LANGUAGE] to [TARGET_LANGUAGE]. STRICT RULES: 1. NEVER modify sequence numbers or timestamps (00:00:00,000 --> 00:00:00,000). 2. Max 2 lines per cue, <= 42 characters per line (~17-20 CPS reading speed). 3. Break lines at natural grammatical clauses. 4. Translate spoken dialogue idiomatically (Speaker pronouns: [SPECIFY]). 5. Output ONLY the clean .SRT block. 

3. The "De-AI-ify" Natural Vietnamese Polisher

You are a master Vietnamese editor. Rewrite the translated Vietnamese draft below so it reads naturally like native prose while keeping 100% factual fidelity to the English source. Eliminate: - Unnecessary passive calques ("được thực hiện bởi...", "bị ảnh hưởng bởi...") - Bloated AI clichés ("Trong bối cảnh ngày nay...", "yếu tố thay đổi cuộc chơi", "mở khóa tiềm năng") - Redundant "của bạn / một" copied literally from English. Output: (1) Polished Native Vietnamese, (2) Top 4 stiff phrases fixed and why. 

4. Line-by-Line Omission & Number Auditor

Act as a zero-tolerance factual auditor comparing SOURCE and TRANSLATION. Do NOT rewrite style—ONLY report factual defects: 1. Omissions (any dropped clause, bullet, or caveat) 2. Hallucinations (claims not present in source) 3. Numeric, date, currency, or proper-name mismatches 4. Negation flips (missing "not", "except", "unless"). If clean, output: PASS — ZERO FACTUAL DEFECTS DETECTED. 

5. Two-Pass Self-Critique Translation Chain

Execute a strict 3-step pipeline from [SOURCE_LANGUAGE] to [TARGET_LANGUAGE]: STEP 1 — FAITHFUL DRAFT: Translate capturing 100% of facts. STEP 2 — CRITICAL SELF-AUDIT: List 3-5 weaknesses in Step 1 (literal calques, awkward collocations, pronoun drift). STEP 3 — FINAL VERSION: Rewrite fixing every critique from Step 2. Display ONLY Step 2 (briefly) and Step 3 labeled FINAL TRANSLATION. 

Free Sample & Full Toolkit Resources

I compiled this system across 10 real-world localization categories (Business/Trade, E-Commerce, Software UI/JSON, Legal Drafting Support, Academic/IMRAD, .SRT Subtitles, Literary, Finance IFRS/VAS, MTPE QA, and Prompt Systems):

Transparency Note: All LingoBridge Studio toolkits are 100% original works developed with AI-assisted drafting and bilingual human curation. Feel free to drop your toughest localization edge case in the comments!

原文:https://www.a8q9.cn/en/article/how-to-localize-json-i18n-files-srt-subtitles-bilingual-docs-with-llms-without-b-9af26f.html

相关文章