Package Exports
- @sayyyat/smart-i18n
- @sayyyat/smart-i18n/lib
Readme
Smart-i18n
A Gulp-based CLI toolkit for modular, scalable i18n in JS/TS projects
Smart-i18n is a framework-agnostic internationalization (i18n) CLI toolkit that automates translation workflows in JavaScript and TypeScript projects. It is based on Gulp and designed to integrate seamlessly into apps built with Next.js, React, Vue, or other frontend/backend stacks.
π Features
- β Automatic namespace detection and key extraction
- π Seamless translation file merging with old keys preserved
- π On-demand machine translation via Deep Translate (RapidAPI)
- π Safe TypeScript typings for all i18n keys
- π§± Modular Gulp tasks for fully scriptable i18n pipelines
- π§° CLI-based, works via
yarn smart-i18n
,npx smart-i18n
, or direct Gulp
π¦ Installation
In your project root:
yarn add -D smart-i18n
yarn smart-i18n init
This will install the package and create the following files if they donβt exist:
i18next.config.json
β main config file.demo-env
β environment file with placeholder API key for translations
π οΈ Usage
After install, run tasks directly using yarn
or npx
:
yarn smart-i18n generate-namespaces
yarn smart-i18n generate-templates
yarn smart-i18n generate-types
yarn smart-i18n generate-translations -l ru
Or simply run all default tasks:
yarn smart-i18n
Available tasks:
Command | Description |
---|---|
smart-i18n |
Runs generate-namespaces β generate-templates β generate-types |
smart-i18n generate-namespaces |
Builds translation namespace map from file structure |
smart-i18n generate-templates |
Extracts new keys, updates locale JSON files |
smart-i18n generate-types |
Generates types.d.ts for i18n keys |
smart-i18n generate-translations |
Fills missing keys via Deep Translate API |
smart-i18n watch |
Watches files and regenerates as needed |
smart-i18n create-feature -n name |
Scaffold a new feature folder with boilerplate |
smart-i18n help |
Shows all commands and usage info |
π Documentation
- π Getting Started Guide β project setup and concepts
- π Gulp Scripts Structure β full CLI task and file layout overview
π Example Integration
Looking for a working example? Check out:
π next-i18n-auth β A full Next.js 14+ app using smart-i18n
with multi-language authentication, modular translation, and CLI-driven workflows.
βοΈ License
MIT Β© Sayat Raykul