Skip to main content
Open Source CLI Tool

ตัวตรวจสอบ i18n

ลินต์ไฟล์แปลเพื่อหาคีย์ที่หายไป ตัวยึดตำแหน่งเสียหาย และพหูพจน์ไม่สอดคล้อง คำสั่งเดียว การตรวจสอบ 9 รายการ รูปแบบ 32 ชนิด ไม่ต้องกำหนดค่า

9 checks 32 formats Zero config Native Rust binary

ปัญหา

ปัญหาคำแปลมองไม่เห็นจนกว่าผู้ใช้จะเจอ คีย์ที่หายไปแสดงพาธดิบอย่าง “settings.billing.title” แทนข้อความจริง ตัวยึดตำแหน่งที่เสียหายเรนเดอร์ “{price}” เป็นข้อความตามตัวอักษรแทน “$9.99” และพหูพจน์ผิดรูปทำให้แอปหยุดทำงานเมื่อจำนวนเป็นศูนย์ ข้อบกพร่องเหล่านี้หลุดผ่านการตรวจทานโค้ด เพราะไม่มีใครเปรียบเทียบไฟล์ภาษา 15 ไฟล์ด้วยตนเอง

🔑

Missing keys

Blank text or key paths shown to users

🔗

Broken placeholders

{price} displays as literal text instead of $9.99

📁

Orphaned files

Outdated translations confuse the build system

💥

Malformed files

Runtime crashes when users switch languages

เครื่องมือตรวจสอบส่วนใหญ่รองรับเฉพาะรูปแบบ เช่น JSON เท่านั้นหรือ YAML เท่านั้น และต้องเขียนโค้ดทดสอบเองในแต่ละโปรเจกต์ มักพบข้อบกพร่องด้านคำแปลเมื่อรันจริงและผู้ใช้เห็น UI ที่เสียหายแล้ว

วิธีแก้

i18n-validate สแกนไฟล์แปลทั้งหมดในรอบเดียว โดยตรวจหาโครงสร้างไดเรกทอรีและรูปแบบไฟล์อัตโนมัติ เปรียบเทียบทุกภาษากับไฟล์อ้างอิง แล้วรายงานอย่างเจาะจงว่าผิดอะไรและอยู่ที่ใด ไม่ต้องใช้ปลั๊กอิน การกำหนดค่า หรือโค้ดทดสอบแบบกำหนดเอง

CheckSeverityWhat it catches
missing-keyserrorKey exists in reference but is absent in a translation
extra-keyserrorKey exists in translation but not in the reference
placeholderserror{price}, {{name}}, %s differ between languages
plural-structureerrorPlural forms are malformed or missing required categories
missing-languageserrorExpected language has no files or directory
orphaned-languageserrorLanguage files exist but are not in the expected list
parse-errorserrorFile fails to parse (broken JSON, XML, YAML, etc.)
empty-valueswarningKey is present but the translation is an empty string
untranslatedwarningTranslation is identical to the reference language
Terminal output
i18n-validate v0.1.0 — validating ./locales

  Reference: en (2 files: translation.json, apiTester.json)
  Languages: de, ja, fr, es, zh-Hans, pt-BR, ko (7 found, 7 expected)
  Layout   : directory (auto-detected)
  Formats  : i18next JSON (auto-detected)

────────────────────────────────────────────────

ERRORS (5)

  ✗ missing-keys │ translation.json
    Key "settings.billing.title"
      missing in: ja, ko

  ✗ placeholders │ translation.json
    Key "pricing.total" — expected: {price}, {currency}
      de:  found {price} only — missing {currency}

────────────────────────────────────────────────

WARNINGS (2)

  ⚠ empty-values │ translation.json
    Key "onboarding.step3.hint"
      empty in: de, fr

────────────────────────────────────────────────

  5 errors, 2 warnings across 7 languages
  ✗ Validation failed

การติดตั้ง

ติดตั้งเป็นเครื่องมือ CLI ส่วนกลางด้วยตัวจัดการแพ็กเกจที่คุณต้องการ แพ็กเกจ npm รวมไบนารี Rust โดยตรง จึงไม่ต้องคอมไพล์หรือใช้การพึ่งพาขณะรัน

Terminal
npm install -g @i18n-agent/i18n-validate
แพ็กเกจ npm รวมไบนารีโดยตรงที่คอมไพล์ไว้แล้วสำหรับ macOS, Linux และ Windows โดยไม่ต้องใช้ชุดเครื่องมือ Rust

การใช้งาน

ชี้เครื่องมือไปยังไดเรกทอรีภาษา แล้วระบบจะตรวจหาภาษาอ้างอิง โครงสร้างไดเรกทอรี และรูปแบบไฟล์โดยอัตโนมัติ โปรเจกต์ส่วนใหญ่ไม่ต้องกำหนดค่า

Terminal
# Zero-config validation
i18n-validate ./locales

# JSON output for scripting
i18n-validate ./locales --format json | jq '.summary'

# CI/CD with JUnit XML
i18n-validate ./locales --format junit -o i18n-report.xml

การเชื่อมต่อ CI/CD

เพิ่มการตรวจสอบคำแปลลงในไปป์ไลน์ pull request เครื่องมือสร้าง JUnit XML ที่เชื่อมต่อกับตัวรายงานการทดสอบของ GitHub Actions อาร์ติแฟกต์ GitLab CI และระบบ CI ทุกชนิดที่รองรับ JUnit

.github/workflows/validate-i18n.yml
name: Validate Translations
on:
  pull_request:
    paths: ['locales/**', 'public/locales/**']

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Validate translations
        run: npx @i18n-agent/i18n-validate ./locales --format junit -o i18n-report.xml

      - uses: dorny/test-reporter@v1
        if: always()
        with:
          name: i18n validation
          path: i18n-report.xml
          reporter: java-junit
The tool exits with code 1 when errors are found, so it naturally fails CI. Use --strict to also fail on warnings.

รูปแบบที่รองรับ

ตัวตรวจสอบขับเคลื่อนด้วย i18n-convert และรองรับไฟล์ i18n 32 รูปแบบตั้งแต่เริ่มใช้งาน ไม่ต้องใช้ปลั๊กอินหรือการกำหนดค่าเฉพาะรูปแบบ เครื่องมือจะตรวจหารูปแบบจากนามสกุลและเนื้อหาไฟล์โดยอัตโนมัติ

Mobile & Desktop

Android XML, Xcode String Catalog, iOS Strings, iOS Stringsdict, Flutter ARB, Qt Linguist

Web & Frameworks

Structured JSON, i18next JSON, JSON5, HJSON, YAML (Rails), YAML (Plain), JavaScript, TypeScript, PHP/Laravel, NEON

Standards & Exchange

XLIFF 1.2, XLIFF 2.0, Gettext PO, TMX, .NET RESX, Java Properties

Data & Other

CSV, Excel (.xlsx), TOML, INI, SRT Subtitles, Markdown, Plain Text

การกำหนดค่า

โปรเจกต์ส่วนใหญ่ใช้งานได้โดยไม่ต้องกำหนดค่า เมื่อต้องการควบคุม เช่น แทนที่ระดับความรุนแรงของการตรวจสอบ กำหนดภาษาที่คาดหวัง หรือไม่รวมภาษาที่กำลังพัฒนา ให้สร้างไฟล์ .i18n-validate.toml ที่รากโปรเจกต์

.i18n-validate.toml
# .i18n-validate.toml
ref = "en"
expect = ["de", "ja", "fr", "es", "zh-Hans", "pt-BR", "ko"]

[checks]
missing-keys = "error"
extra-keys = "error"
placeholders = "error"
empty-values = "warning"
untranslated = "warning"

[languages.ko]
missing-keys = "warning"    # Korean is WIP

[languages.ar]
skip = true                 # Exclude from validation

ลองใช้ i18n Agent ตอนนี้

ลากและวางไฟล์แปลของคุณที่นี่

JSON, YAML, PO, XML, CSV, Markdown, Properties

หรือคลิกเพื่อเลือกไฟล์

ภาษาเป้าหมาย

ไม่ต้องลงทะเบียนประเมินราคาได้ทันที

คำถามที่พบบ่อย