Said KSI

Localizer - localization TS/JS apps

by
Contribute to SaidKSI/localizer-cli development by creating an account on GitHub.

Add a comment

Replies

Best
Said KSI
Maker
📌
I was building a SaaS app and needed to support French and Spanish. I thought it would be simple—just extract strings, translate them, update the code. It wasn't. The process was brutal: 1. Manually hunt through 50+ components for hardcoded text 2. Create semantic keys (naming is *hard*—is it `header_title` or `page_header_title`?) 3. Copy strings to a translation tool (Translators are expensive—$200+ per language) 4. Manually rewrite every JSX element to use t('key') 5. Hope I didn't miss any strings For a 50-page app, this took 2 weeks. For a single-page update, it takes 2 hours. So I built Localizer—a CLI that automates all of this. **Before (Manual):** ```jsx function LoginForm() { return (

Welcome to Our App

Email Address Sign In
); } ``` **After running `localizer run --yes`:** ```jsx function LoginForm() { const { t } = useTranslation('login'); return (

{t('login.welcome_title')}

{t('login.email_label')} {t('login.submit_button')}
); } ``` **Generated translation files:** ```json // messages/en/login.json { "login": { "welcome_title": "Welcome to Our App", "email_label": "Email Address", "email_placeholder": "Enter your email", "submit_button": "Sign In" } } // messages/fr/login.json { "login": { "welcome_title": "Bienvenue dans notre application", "email_label": "Adresse e-mail", "email_placeholder": "Entrez votre e-mail", "submit_button": "Se connecter" } } ``` Took 3 seconds. No manual key naming. No translation costs. The AI generated semantic keys, translated to French/Spanish/German, and rewrote the code automatically. **What's under the hood:** - AST scanning (ts-morph for TypeScript, Babel for JS) to find hardcoded strings - AI key generation (Claude or GPT) for semantic naming - Smart collision detection (two Header.tsx files → auto-assigns header, header_1) - Automatic code rewriting with i18next/react-i18next integration **Open source on GitHub and npm.** Core library + CLI, both free forever. Eventually building a SaaS dashboard for teams (translation memory, collaboration, glossaries), but the CLI will always be free. GitHub: https://github.com/SaidKSI/local... npm: https://www.npmjs.com/package/@s... Feedback welcome. Let me know what breaks or what you'd want to see next.