⚡
CLI Tools
텍스트 래핑 및 번역 관리를 위한 강력한 자동화 도구
설치
npm install -D i18nexus-tools🔧
i18n-wrapper
자동 텍스트 래핑
한국어 텍스트를 자동으로 t()로 감싸고 import를 추가합니다
기본 사용법
# Wrap all Korean text in app directory
npx i18n-wrapper --pattern "app/**/*.tsx"
# Preview changes without modifying
npx i18n-wrapper --dry-run
# Target specific files
npx i18n-wrapper --pattern "app/page.tsx"📝
이전
export default function Welcome() {
return (
<div>
<h1>환영합니다</h1>
<p>i18nexus 사용법</p>
</div>
);
}✨
이후
💡스마트 감지
- ✓JSX 요소 내 한국어 텍스트 감지
- ✓문자열 리터럴 내 한국어 감지
- ✓템플릿 리터럴 내 한국어 감지
- ✓이미 래핑된 텍스트 건너뛰기
- ✓코드 포매팅 보존
🔍
i18n-extractor
스마트 키 추출
번역 키를 추출하고 기존 파일과 지능적으로 병합합니다
기본 사용법
# Extract and merge with existing translations
npx i18n-extractor -p "app/**/*.tsx" -d "./lib/translations"
# Generate specific language files
npx i18n-extractor -l "en,ko,ja"
# Preview without modifying
npx i18n-extractor --dry-run✨스마트 병합 기능
- ✓기존 번역 모두 보존
- ✓코드에서 새 키만 추가
- ✓알파벳 순으로 키 정렬
- ✓상세한 통계 표시
📊
Google Sheets 연동
팀 협업
팀 협업을 위해 Google Sheets와 번역을 동기화합니다
📤업로드
npx i18n-upload \
--spreadsheet-id "YOUR_ID" \
--credentials "./credentials.json"📥다운로드
npx i18n-download \
--spreadsheet-id "YOUR_ID" \
--credentials "./credentials.json"⚙️설정 필요
- Google Cloud 프로젝트 생성
- Google Sheets API 활성화
- 서비스 계정 생성
- 인증 정보 JSON 다운로드
- 서비스 계정과 시트 공유
전체 워크플로우
1
한국어 텍스트 감싸기
코드에 하드코딩된 한국어 문자열을 자동으로 감쌉니다
npx i18n-wrapper --pattern "app/**/*.tsx"2
키 추출
래핑된 텍스트에서 번역 파일을 생성합니다
npx i18n-extractor -p "app/**/*.tsx" -d "./lib/translations"3
번역
en.json 파일에 영어 번역을 추가합니다
// lib/translations/en.json
{
"환영합니다": "Welcome",
"시작하기": "Get Started"
}4
Sheets와 동기화 (선택사항)
팀 번역을 위해 Google Sheets에 업로드합니다
npx i18n-upload --spreadsheet-id "YOUR_ID"✓
완료!
앱이 완전히 국제화되었으며 배포할 준비가 되었습니다