Skip to main content

i18n 변환 도구

Android XML, iOS Strings, XLIFF, PO, JSON, YAML 등 32개 이상의 i18n 파일 형식을 서로 변환해요. 가능한 경우 무손실로 변환하고, 불가능한 경우 데이터 손실을 명확히 경고해요.

문제

플랫폼마다 번역 형식이 달라요. Android는 strings.xml, iOS는 .strings와 .stringsdict, 웹 앱은 JSON 또는 YAML을 사용해요. 번역가와 TMS 플랫폼은 XLIFF 또는 PO를 요구해요. 플랫폼 간에 문자열을 공유하려면 형식 사이에서 복사하고 붙여넣거나, 일회용 스크립트를 작성하거나, 파일을 직접 재구성하게 돼요. 번거롭고 오류가 발생하기 쉬우며 새 형식이 나타날 때마다 작동하지 않게 돼요.

모바일과 웹을 함께 사용하는 프로젝트 하나에서도 번역 파일 형식이 5개 이상 필요할 수 있어요. 이를 직접 동기화하는 것은 승산 없는 싸움이에요.

해결책

i18n-convert는 32개 이상의 i18n 파일 형식을 서로 변환하는 단일 CLI 도구예요. 입력 형식을 자동으로 감지하고 가능한 한 많은 구조를 유지하며, CSV의 복수형처럼 변환 과정에서 데이터가 손실될 때 경고해요.

Terminal
# Auto-detect input format, convert to Android XML
i18n-convert en.json --to android-xml -o strings.xml

# iOS Strings to Gettext PO
i18n-convert Localizable.strings --to po -o messages.po

# XLIFF to Rails YAML
i18n-convert translations.xliff --to yaml-rails -o en.yml

# Pipe to stdout
i18n-convert messages.po --to json

자동 감지

파일 확장자와 내용에서 입력 형식을 자동으로 감지해요. 플래그가 필요 없어요.

가능한 경우 무손실

대상 형식이 지원하면 메타데이터, 주석, 복수형을 유지해요.

데이터 손실 경고

변환 과정에서 정보가 손실될 경우 파일을 저장하기 전에 명확한 경고를 표시해요.

설치

가장 간단한 설정에는 npm을 사용하고, macOS에서는 Homebrew를 사용하거나 Cargo로 소스에서 빌드하세요.

Terminal
npm install -g @i18n-agent/i18n-convert
npm 패키지에는 macOS, Linux, Windows용으로 미리 빌드된 바이너리가 포함되어 있어요. Rust 도구 체인이 필요 없어요.

일반적인 변환

대부분의 팀은 모바일용 JSON에서 Android XML로, 웹용 PO에서 JSON으로, 번역가 전달용 XLIFF 왕복 변환처럼 몇 가지 변환을 반복해서 사용해요. 일반적인 패턴을 살펴보세요.

Batch conversion
# Convert all PO files to JSON
for f in locales/*.po; do
  i18n-convert "$f" --to json -o "${f%.po}.json"
done

# Convert entire directory
i18n-convert locales/ --to json --out-dir locales-json/

지원 형식

i18n-convert는 모바일, 웹, 현지화 표준, 데이터 교환 범주에서 32개 이상의 형식을 지원해요.

모바일

FormatExtensionFlag
Android XML.xml--to android-xml
iOS Strings.strings--to ios-strings
iOS Stringsdict.stringsdict--to ios-stringsdict
Flutter ARB.arb--to arb

FormatExtensionFlag
JSON (flat).json--to json
JSON (nested).json--to json-nested
YAML.yml--to yaml
YAML (Rails).yml--to yaml-rails
Properties.properties--to properties

현지화 표준

FormatExtensionFlag
XLIFF 1.2.xlf--to xliff
XLIFF 2.0.xlf--to xliff-2
Gettext PO.po--to po
Gettext POT.pot--to pot
TMX.tmx--to tmx
TBX.tbx--to tbx

데이터 교환

FormatExtensionFlag
CSV.csv--to csv
TSV.tsv--to tsv
Excel.xlsx--to xlsx

데이터 손실 경고

모든 형식이 같은 것은 아니에요. XLIFF는 메모, 문맥, 복수형을 지원하지만 CSV는 어느 것도 지원하지 않아요. 풍부한 형식에서 단순한 형식으로 변환하면 i18n-convert가 무엇이 손실되는지 정확히 알려 줘요.

Terminal
$ i18n-convert plurals.po --to csv
Data loss warnings:
  [ERROR] 3 entries use plurals (not supported by CSV)
Proceed? [y/N]

# Skip prompts
i18n-convert plurals.po --to csv --force

# Preview warnings without writing
i18n-convert plurals.po --to csv --dry-run
실제 서비스에서 더 단순한 형식으로 변환하기 전에는 항상 --dry-run을 사용하세요. 파일을 쓰지 않고 모든 경고를 확인할 수 있어요.

CI 통합

CI/CD 파이프라인에서 형식 동기화를 자동화하세요. 원문 번역 파일이 바뀌면 파생된 모든 형식을 자동으로 다시 생성해 모바일, 웹, 번역가용 파일을 동기화된 상태로 유지해요.

.github/workflows/format-sync.yml
# .github/workflows/format-sync.yml
name: Sync Translation Formats
on:
  push:
    branches: [main]
    paths: ['locales/en.json']

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

      - name: Install i18n-convert
        run: npm install -g @i18n-agent/i18n-convert

      - name: Convert JSON to Android XML
        run: i18n-convert locales/en.json --to android-xml -o android/res/values/strings.xml

      - name: Convert JSON to iOS Strings
        run: i18n-convert locales/en.json --to ios-strings -o ios/en.lproj/Localizable.strings

      - name: Commit synced formats
        run: |
          git config user.name "github-actions"
          git config user.email "[email protected]"
          git add android/ ios/
          git diff --cached --quiet || git commit -m "chore: sync translation formats"
          git push
CI 파이프라인에서 i18n-convert와 i18n-validate를 함께 사용하세요. 먼저 형식을 변환한 뒤 모든 대상 파일에 누락이 없고 형식이 올바른지 검증하세요.

지금 i18n Agent 사용해 보기

번역 파일을 여기에 드롭

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

또는 클릭하여 파일 선택

대상 언어

가입 불필요즉시 견적

자주 묻는 질문