@localey/cli
v0.1.26
Published
**Localization that feels like TypeScript.**
Readme
🧩 Localey
Localization that feels like TypeScript.
Localey is a high-precision, component-centric localization engine designed for modern web and mobile apps. It automates the extraction of hardcoded strings, generates semantic translation keys using AI, and ensures 100% type safety.
🚀 Recent Features (v0.1.21)
🎯 High-Precision Extraction
- Technical Noise Filtering: Automatically skips HEX colors (
#ffffff), CSS units (10px,1rem), numbers, and technical constants. - Smart Scoping: Automatically generates component-scoped keys (e.g.,
LoginForm.SUBMIT). - Context-Aware Fallbacks: Intelligently uses semantic folder names for Next.js/Expo routes (skipping generic names like
apporindex).
🛠️ Developer Control
ignoreAttributes: Blacklist custom props from extraction in yourlocaley.config.json./* localey-ignore */: Skip specific lines or elements with a simple comment.- Type-Safe Injection: Automatically adds
as anytot()calls in JSX props to satisfy strict TypeScript union types.
🤖 AI-Powered Workflow
ai.auto: Enable AI in your config, and Localey will automatically use it for every extraction.- Improved Context: Uses JSX parent components (like
Button,Text) to decide on prefixes (BTN_,LBL_). - Diagnostic Logging: Clear feedback in the console if your AI configuration is missing or invalid.
📦 Installation
npm install -g @localey/cli🛠️ Getting Started
1. Initialize
localey setupThis generates localey.config.json and sets up your i18n infrastructure.
2. Configure (Optional)
Add your AI key and custom exclusions to localey.config.json:
{
"frameworks": ["react"],
"ignoreAttributes": ["rightIcon", "headerLeft"],
"ai": {
"provider": "openai",
"apiKey": "sk-...",
"auto": true
}
}3. Extract & Sync
localey extract --dir ./srcOr use the real-time watcher:
localey dev --dir ./src📜 Manual Control
Want to skip a specific string?
<Text>{/* localey-ignore */}Not for translation</Text>
<div className="bg-[#ea580c]" /> // Automatically skipped📄 License
MIT
