npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sayyyat/smart-i18n-react

v3.0.1

Published

React/Next.js integration for smart-i18n with opinionated setup and automation scripts for managing translations.

Readme

⚠️ DEPRECATED

This package is no longer maintained. Please migrate to the new, next-generation CLI: @sayyyat/smart-i18next-cli

Why migrate?

  • 🚀 Pure TypeScript: The new CLI is built entirely in TypeScript for better stability.
  • ⚡️ AST Parsing: Uses i18next-cli (AST) instead of Regex/Gulp for smarter extraction.
  • 💎 Better Features: Full support for <Trans> components, stricter type generation, and faster execution.

@sayyyat/smart-i18n-react (Legacy)

npm version npm downloads License Node.js CI

The all-in-one CLI toolkit for smart-i18n in React & Next.js projects.

This package is the recommended way to use the smart-i18n system in React or Next.js applications.

It acts as a "superset" of the core @sayyyat/smart-i18n package, providing:

  1. All core commands (translate, sync, generate:types, watch, etc.) from the base package, inherited automatically.
  2. A modified init command that scaffolds React/Next.js-specific template files (like client.ts, server.ts, and a React-ready i18next.config.json).
  3. An optional --fsd flag for the init command to scaffold a config for Feature-Sliced Design.
  4. Bonus scaffolding commands like create-feature for FSD-structured projects.

With this package, you do not need to install @sayyyat/smart-i18n separately.


💾 Installation

Install this package as a development dependency:

# pnpm
pnpm add @sayyyat/smart-i18n-react -D

# yarn
yarn add @sayyyat/smart-i18n-react -D

# npm
npm install @sayyyat/smart-i18n-react --save-dev

⚙️ Usage & CLI Commands

All commands are available through the smart-i18n-react binary (or npx). We recommend adding shortcuts to your package.json:

{
  "scripts": {
    // Runs the main generation pipeline (config, namespaces, templates, types)
    "i18n": "smart-i18n-react",
    // Runs the auto-translation (killer feature)
    "i18n:translate": "smart-i18n-react generate-translations",
    // Runs in watch mode
    "i18n:watch": "smart-i18n-react watch",
    // Scaffolds a new FSD feature
    "i18n:feature": "smart-i18n-react create-feature"
  }
}

React-Specific Commands

npx smart-i18n-react init

Initializes your project. This command copies all necessary template files (src/i18n/...) and a config file (i18next.config.json) into your project root.

  • Default Mode: npx smart-i18n-react init Scaffolds a safe, minimal i18next.config.json that only scans src/app/ and src/components/. This is ideal for new or simple projects and avoids errors from missing folders.

  • FSD Mode: npx smart-i18n-react init --fsd Scaffolds a full, complex i18next.config.json with includePatterns for a complete Feature-Sliced Design (FSD) architecture (e.g., src/features/, src/core/, src/widgets/).

npx smart-i18n-react create-feature -n <feature-name>

A scaffolding tool that generates boilerplate for a new feature slice based on FSD principles.

  • -n, --name: The name of the new feature (e.g., my-new-feature). [required]
  • --js: Optionally generates JavaScript/JSX files instead of TypeScript/TSX.

npx smart-i18n-react generate-config

This command (which is also part of the default task) reads your i18next.config.json (the "Single Source of Truth") and regenerates the src/i18n/generated/config.ts file.

This React version ensures that React/Next.js-specific values (like cookieName) are included in the generated file.

Inherited Core Commands

All commands from the core @sayyyat/smart-i18n package are available and work the same way:

  • npx smart-i18n-react (Default task) Runs the main generation pipeline in order:

    1. generate-config (React version)
    2. generate-namespaces
    3. generate-templates
    4. generate-types
  • npx smart-i18n-react generate-translations

    • This is the "killer feature".
    • Finds all keys where key === value (meaning they are not translated yet).
    • Sends the text to RapidAPI for machine translation and caches the results to save API calls.
  • npx smart-i18n-react generate-templates

  • npx smart-i18n-react generate-namespaces

  • npx smart-i18n-react generate-types

  • npx smart-i18n-react watch

  • npx smart-i18n-react help

For details on what these core commands do, please refer to the Core Package Documentation.


🔗 Example Integration

A new Next.js 16 example application that uses this package (@sayyyat/smart-i18n-react) is included in this monorepo:

➡️ apps/next-i18n


⚖️ License

MIT © Sayat Raykul