Skip to content
i18n-sync logo

i18n-sync - Bilingual Content Synchronization

i18n-sync

Bilingual content synchronization validator for young-personal-site. Ensures perfect zh-TW/en translation consistency.

SKILL.md

Full skill instructions

i18n-sync - Bilingual Content Synchronization

Purpose

Ensure perfect synchronization between Chinese (zh-TW) and English (en) translation files.

Prevents: Missing translations, inconsistent keys, type mismatches Ensures: Structural consistency, complete translations, deployment safety


Translation Files

messages/
  ├── zh-TW.json  (Chinese Traditional)
  └── en.json     (English)

Validation Workflow

1. File Existence & JSON Validity

# Check both files exist and are valid JSON
ls -la messages/
python3 -m json.tool messages/​zh-TW.json > /​dev/​null
python3 -m json.tool messages/​en.json > /​dev/​null

2. Key Structure Comparison

Checks:
  - All keys in zh-TW.json exist in en.json
  - All keys in en.json exist in zh-TW.json
  - Nested object keys match recursively

Reports:
  - Missing keys in either file
  - Path to each missing key (e.g., "projects.mediatek.media_coverage")

3. Value Type Validation

Checks:
  - String in zh-TW → String in en
  - Array in zh-TW → Array in en
  - Object in zh-TW → Object in en

Reports:
  - Type mismatches (e.g., array vs. string)
  - Path to each mismatch

4. Empty Translation Detection

Checks:
  - Empty strings ("")
  - Empty arrays ([])
  - Missing values

Reports:
  - Path to each empty translation
  - Which file (zh-TW or en)

Validation Severity Levels

❌ Critical (MUST Fix - Blocks Deployment)

  1. Missing translation files
  2. Invalid JSON syntax
  3. Missing top-level keys (navigation, projects, speaking, about)

⚠️ Warning (SHOULD Fix - Safe but Incomplete)

  1. Missing nested keys
  2. Empty translations
  3. Type mismatches

ℹ️ Info (NICE to Have)

  1. Key order inconsistency
  2. Translation length ratio differences
  3. Unused keys

Output Format

Success

✅ i18n Synchronization: PASS

📊 Results:
  ✅ Both files exist and valid
  ✅ All keys synchronized (zh-TW ↔ en)
  ✅ Type consistency verified
  ✅ No empty translations

🎉 Bilingual content perfectly synchronized!

Warnings

⚠️ i18n Synchronization: WARNINGS

📊 Results:
  ✅ Files valid
  ⚠️ 2 missing keys
  ⚠️ 1 empty translation

🔧 Issues:
  1. projects.newproject.media_coverage - Missing in en.json
  2. speaking.futuretalk.summary - Empty in zh-TW.json

💡 Fix before deployment

Failure

❌ i18n Synchronization: FAILED

🚨 Critical Issues:
  1. en.json - Invalid JSON syntax (line 45: Unexpected token })

⛔ DEPLOYMENT BLOCKED

Auto-Fix (Optional)

User confirms auto-fix:

Process:
  1. Missing keys in en.json:
     - Add with placeholder: "[TRANSLATION NEEDED]"
     - Preserve structure from zh-TW.json

  2. Missing keys in zh-TW.json:
     - Add with placeholder: "[需要翻譯]"
     - Preserve structure from en.json

  3. Empty translations:
     - Keep empty (requires human input)
     - Flag for manual completion

  4. Save:
     - Backup original files
     - Write formatted JSON
     - Preserve key order

Common Scenarios

New Project Added

1. Detect new key in zh-TW.json
2. Check if exists in en.json
3. If missing → Warn: "Missing English translation"
4. User adds translation
5. Validate → PASS

Content Update

1. Detect change in zh-TW.json
2. Remind: "Update English version too"
3. Validate after both updated
4. Report consistency

Bulk Refactor

1. Full JSON structure comparison
2. Report all differences
3. Suggest auto-fix or manual updates
4. Re-validate after fixes

Integration

With content-update:

content-update adds content → i18n-sync validates → Report issues → Fix → Re-validate

With deploy-check:

deploy-check → TypeScript check → i18n-sync → If PASS → Deploy, If FAIL → Block

Edge Cases

Nested Object Depth Mismatch

// zh-TW: { "details": { "version": "2.0" } }
// en: { "details": "Version 2.0" }
→ Type mismatch: object vs. string

Array Length Differences

// zh-TW: ["AI", "教育", "創新"]
// en: ["AI", "Education"]
→ Warning: Array length mismatch (3 vs. 2)

Special Character Encoding

// zh-TW: "AI 專家 • iOS 開發者"
// en: "AI Expert \u2022 iOS Developer"
→ Both valid (JSON handles encoding)

Troubleshooting

JSON Parse Error

# Validate JSON syntax
python3 -m json.tool messages/​zh-TW.json
# Fix syntax error on reported line

Too Many Missing Keys

1. Use auto-fix for placeholders
2. Prioritize critical sections (navigation, projects)
3. Schedule time to complete all translations

Cannot Read Files

# Check existence and permissions
ls -la messages/
chmod 644 messages/​*.json

Best Practices

  1. Run before every content change
  2. Fix issues immediately (avoid translation debt)
  3. Mirror key hierarchy in both files
  4. Keep same key order (easier review)
  5. Version control all changes

Version: v1.1 | Updated: 2025-12-31 Project: young-personal-site Integration: content-update, deploy-check

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View