Registry / devops / i18next-cli

i18next-cli

JSON →
library1.56.2jsnpmunverified

i18next-cli is a unified, high-performance command-line interface tool for the i18next internationalization ecosystem, currently at version 1.56.2. It leverages the Rust-based SWC parser for rapid static analysis, providing features such as automatic translation key extraction from JavaScript and TypeScript files, generation of TypeScript type definitions for improved developer experience, synchronization of locale files, and intelligent linting to detect hardcoded strings. The tool is designed to consolidate various i18next-related static analysis tasks into a single, cohesive workflow, replacing disparate scripts and older tools like `i18next-parser`. It also features a modern plugin architecture for extensibility to custom file types and workflows, and offers seamless integration with translation management platforms like Locize.

npm install i18next-cli
INSTALL
IMPORT
SIG · I18NEXT-CLI
I
i18next-cli
devopsjavascriptv1.56.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

defineConfig
import { defineConfig } from 'i18next-cli';
const defineConfig = require('i18next-cli').defineConfig;
Used for configuring the i18next-cli in an `i18next.config.ts` file. Primarily an ESM pattern for configuration.
CLI usage
npx i18next-cli <command>
import { run } from 'i18next-cli'; // Incorrect library usage
The package is primarily a CLI tool and is typically invoked via `npx` or a script defined in `package.json`.

Installs the CLI, sets up a basic TypeScript configuration file, and then demonstrates checking translation status and extracting keys.

npm install --save-dev i18next-cli // Create i18next.config.ts in your project root // This enables TypeScript support and robust configuration. // For zero-config quick testing, skip this step and run 'npx i18next-cli status'. import { defineConfig } from 'i18next-cli'; export default defineConfig({ locales: ['en', 'de'], extract: { input: ['src/**/*.{js,jsx,ts,tsx}'], output: 'public/locales/{{language}}/{{namespace}}.json', }, // For more complex setups, e.g., with React components in 'components' // and pages in 'pages', you might extend the input array. // lint: { ... }, // Add linting rules // sync: { ... }, // Add synchronization options }); // Check the current translation status of your project npx i18next-cli status // Extract translation keys based on your configuration npx i18next-cli extract
i18next --version
Debug
Known issues
breakingi18next-cli is a 'complete reimagining' of the i18next static analysis toolchain. Users migrating from older tools like `i18next-parser` or custom scripts will need to adopt a new configuration format and workflow. While it offers migration helpers, direct compatibility is not guaranteed.
fix
Utilize the `npx i18next-cli init` command to create a new configuration file, or refer to the `i18next.config.ts` documentation for the new format. Review existing i18next-parser configurations to translate them to the new `i18next-cli` config structure.
affects: >=1.0.0
gotchaKey extraction is limited by default to JavaScript and TypeScript files (.js, .jsx, .ts, .tsx). Simply adding other file extensions (e.g., .vue, .svelte, .pug) to the `extract.input` configuration array will NOT enable extraction from those formats.
fix
For non-JavaScript/TypeScript file types, a dedicated plugin is required. Check the documentation for available plugins or create a custom plugin to handle specific templating languages or frameworks.
affects: >=1.0.0
breakingThe package requires Node.js version 22 or higher. Older Node.js versions are not supported and will lead to execution failures.
fix
Upgrade your Node.js environment to version 22 or newer. Use a Node Version Manager (NVM) like `nvm install 22 && nvm use 22` to manage multiple Node.js versions.
affects: <1.56.2
Errors
Common errors & fixes
Error: Node.js version is too old. i18next-cli requires Node.js >= 22.
Attempting to run i18next-cli with an unsupported Node.js version.
fix
Update your Node.js environment to version 22 or newer. For example, using nvm: `nvm install 22 && nvm use 22`.
i18next-cli: No input files found for extraction. Please check your 'extract.input' configuration.
The `extract.input` configuration array does not correctly point to source files, or the specified files do not exist.
fix
Verify that the glob patterns in `i18next.config.ts` under `extract.input` correctly match your project's source files. Ensure file paths are relative to the config file's location.
i18next-cli: Could not extract keys from 'path/to/my-component.vue'. Only JS/TS files are supported by default.
Attempting to extract translation keys from a non-JavaScript/TypeScript file type without a specific plugin.
fix
Install or create a `i18next-cli` plugin for the specific file type (e.g., '.vue' files) you wish to extract keys from. Consult the 'Plugin System' section in the documentation.
Upgrade
Version history
1.56.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
i18next-cli — npm install i18next-cli · libregistry