i18next is a comprehensive and highly popular internationalization (i18n) framework designed for JavaScript environments, supporting browsers, Node.js, and Deno. It provides a robust core for handling translations, enabling features like flexible backend connections for loading translations (e.g., via XHR), optional caching, automatic user language detection, proper pluralization rules, translation context management, variable interpolation, and nested translations. The current stable version is 26.0.6, with a regular release cadence addressing bug fixes, type improvements, and occasional minor features, alongside major releases introducing breaking changes and significant enhancements. Its key differentiators include its extensibility through a rich plugin ecosystem and its framework-agnostic nature, allowing integration with React, Angular, Vue, and vanilla JavaScript applications. It focuses on providing a powerful core while allowing developers to choose their preferred building blocks.
npm install i18nextVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic i18next initialization, loading multiple language resources, and translating keys with interpolation, pluralization, and context. It also shows how to change the active language programmatically.
Replace `initImmediate: true` with `initAsync: true` in your i18next configuration. Ensure your initialization logic correctly handles asynchronous operations.
Migrate any custom formatting logic from the old `interpolation.format` function to either the built-in Formatter (if applicable) or by creating and registering a custom Formatter module using `i18next.use(myCustomFormatter)`.
Upgrade to v26.0.6 or newer. Review all instances where `escapeValue: false` is used, especially in conjunction with variable interpolation or nested options. Where possible, avoid `escapeValue: false` or carefully sanitize all interpolated values if it's strictly necessary.
Only set `escapeValue: false` if your environment or framework (like React) handles escaping automatically. Otherwise, manually sanitize any untrusted input before it is passed for interpolation. For most cases, the default `escapeValue: true` is recommended for safety.
Update your i18next configuration to use `initAsync: true` instead of `initImmediate: true`.
Upgrade i18next to version 26.0.5 or newer, which contains a fix for this specific race condition. Ensure you are awaiting the `changeLanguage` call if immediate updates are required.
Upgrade i18next to version 26.0.4 or newer. This version correctly resolves inline formatting options to their base format types.
Upgrade i18next to version 26.0.1 or newer. These issues were resolved, with the Formatter now returning `undefined`/`null` as-is and handling missing format specifiers gracefully.