@m1racle/localekit
v1.0.2
Published
CLI tool to extract and auto-translate hardcoded strings in JS/TS/React projects
Maintainers
Readme
LocaleKit
Scan your JS/TS/React codebase, extract hardcoded strings, and auto-generate i18n translation files in seconds.
The Problem
Adding internationalization to an existing codebase is painful — you have to manually find every hardcoded string, create translation keys, and wire up a translation library. LocaleKit automates the extraction step so you can focus on shipping.
Features
| Feature | Free | Pro ($29) | |---|---|---| | Files per scan | 3 | Unlimited | | Source language extraction | ✅ | ✅ | | Auto-translate via DeepL | ❌ | ✅ | | CI/CD mode | ❌ | ✅ | | GitHub Actions generator | ❌ | ✅ | | Config file support | ❌ | ✅ |
Quick Start
npm install -g @m1racle/localekitThen in your project root:
# Step 1: Create config file
localekit init
# Step 2: Scan your source files
localekit scan --source src --verbose
# Step 3: Review your generated locales
cat locales/en.jsonSample output:
┌────────────────────────────────────────────┐
│ LocaleKit Scan Complete │
├────────────────────────────────────────────┤
│ Files scanned: 47 │
│ Strings found: 128 │
│ New keys added: 31 │
│ Languages: en, es, fr, de │
│ Time elapsed: 1240ms │
└────────────────────────────────────────────┘
Extracted strings:
+ sign_in_to_your_account = "Sign in to your account" (src/Login.tsx:12)
+ enter_your_email_address = "Enter your email address" (src/Login.tsx:18)
+ forgot_your_password = "Forgot your password?" (src/Login.tsx:24)
... 28 morePro License
A Pro license key looks like: LK-A1B2C3D4-E5F6-G7H8-I9J0
To activate, add it to your .localekitrc:
{
"licenseKey": "LK-XXXXXXXX-XXXX-XXXX-XXXX"
}Get a Pro license at gumroad.com/l/localekit.
Configuration
Full .localekitrc example:
{
"sourceDir": "src",
"outputDir": "locales",
"sourceLang": "en",
"targetLangs": ["es", "fr", "de", "ja"],
"deepLApiKey": "your-deepl-free-api-key-here",
"licenseKey": "LK-XXXXXXXX-XXXX-XXXX-XXXX",
"ignore": ["node_modules", "dist", "build", "*.test.*", "*.spec.*"],
"fileExtensions": [".js", ".jsx", ".ts", ".tsx"]
}| Option | Description | Default |
|---|---|---|
| sourceDir | Directory to scan | "src" |
| outputDir | Where locale files are written | "locales" |
| sourceLang | Source language code | "en" |
| targetLangs | Target languages to translate into | [] |
| deepLApiKey | Your DeepL Free API key | "" |
| licenseKey | Your LocaleKit Pro license key | "" |
| ignore | Glob patterns to skip | see above |
| fileExtensions | File types to scan | .js .jsx .ts .tsx |
Get a free DeepL API key at deepl.com/pro#developer.
Supported Languages
| Code | Language |
|---|---|
| en | English |
| es | Spanish |
| fr | French |
| de | German |
| ja | Japanese |
| zh | Chinese |
| pt | Portuguese (Brazilian) |
| it | Italian |
| nl | Dutch |
| pl | Polish |
| ru | Russian |
| ko | Korean |
| ar | Arabic |
| tr | Turkish |
| sv | Swedish |
| da | Danish |
| fi | Finnish |
| nb | Norwegian |
| cs | Czech |
| ro | Romanian |
CLI Reference
localekit scan [options] Scan and extract strings
-s, --source <dir> Source directory (default: "src")
-o, --output <dir> Output directory (default: "locales")
-l, --langs <langs> Target languages, comma-separated
--ci Exit code 1 if new strings found (Pro)
--dry-run Preview without writing files
--verbose Show all extracted strings
localekit init Create .localekitrc in current directory
localekit init-ci Generate GitHub Actions workflow
localekit validate Check all locale files are in syncContributing
LocaleKit is MIT-licensed. Pull requests are welcome — open an issue first for major changes so we can align on direction before you invest time writing code.
License
MIT — see LICENSE.
