โšก

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

  1. Create Google Cloud Project
  2. Enable Google Sheets API
  3. Create Service Account
  4. Download credentials JSON
  5. 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