โก
CLI Tools
Powerful automation tools for text wrapping and translation management
Installation
npm install -D i18nexus-tools๐ง
i18n-wrapper
Auto Text Wrapping
Automatically wrap Korean text with t() and add imports
Basic Usage
# 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"๐
Before
export default function Welcome() {
return (
<div>
<h1>ํ์ํฉ๋๋ค</h1>
<p>i18nexus ์ฌ์ฉ๋ฒ</p>
</div>
);
}โจ
After
import { useTranslation } from "i18nexus";
export default function Welcome() {
const { t } = useTranslation();
return (
<div>
<h1>{t("ํ์ํฉ๋๋ค")}</h1>
<p>{t("i18nexus ์ฌ์ฉ๋ฒ")}</p>
</div>
);
}๐กSmart detection
- โDetect Korean text within JSX elements
- โDetect Korean within string literals
- โDetect Korean within template literals
- โSkip already wrapped text
- โPreserve code formatting
๐
i18n-extractor
Smart key extraction
Extract translation keys and intelligently merge with existing files
Basic Usage
# 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โจSmart merge feature
- โPreserve all existing translations
- โOnly add new keys from code
- โSort keys alphabetically
- โShow detailed statistics
๐
Google Sheets Integration
Team Collaboration
Sync translations with Google Sheets for team collaboration
๐คUpload
npx i18n-upload \
--spreadsheet-id "YOUR_ID" \
--credentials "./credentials.json"๐ฅDownload
npx i18n-download \
--spreadsheet-id "YOUR_ID" \
--credentials "./credentials.json"โ๏ธSetup Required
- Create Google Cloud Project
- Enable Google Sheets API
- Create Service Account
- Download credentials JSON
- Share Sheet with Service Account
Full Workflow
1
Wrap Korean Text
Automatically wrap hardcoded Korean strings in code
npx i18n-wrapper --pattern "app/**/*.tsx"2
Key Extraction
Generate translation files from wrapped text
npx i18n-extractor -p "app/**/*.tsx" -d "./lib/translations"3
Translation
Add English translations to en.json file
// lib/translations/en.json
{
"ํ์ํฉ๋๋ค": "Welcome",
"์์ํ๊ธฐ": "Get Started"
}4
Sync with Sheets (Optional)
Upload to Google Sheets for team translation
npx i18n-upload --spreadsheet-id "YOUR_ID"โ
Done!
Your app is now fully internationalized and ready to deploy