JSPM

  • Created
  • Published
  • Downloads 24
  • Score
    100M100P100Q93257F
  • License MIT

Reusable Gulp-based i18n automation system for javascript/typescript projects.

Package Exports

  • @sayyyat/smart-i18n
  • @sayyyat/smart-i18n/lib

Readme

Smart-i18n

npm version npm downloads License Node.js CI

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


πŸ”— 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