i18n-t is a minimalist internationalization (i18n) utility for JavaScript, offering a straightforward API to manage translations. Its current stable version is 1.0.1, last released in June 2016. The library focuses on simplicity, allowing developers to set a default locale, load translation messages from local files or pre-loaded JavaScript objects, and perform basic string translation with variable interpolation. Unlike more comprehensive and actively maintained solutions such as `i18next` or `i18n-js`, `i18n-t` explicitly avoids framework-specific integrations or advanced features like pluralization rules, context-sensitive translations, or backend loading mechanisms. Its key differentiator was its 'dumb' and easy-to-use nature, making it suitable for very basic i18n needs without external dependencies or complex configurations. However, due to its long-term abandonment, it lacks modern features like ESM support, TypeScript typings, and ongoing security updates.
npm install i18n-tVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `i18n-t`, load locales from a directory and pre-loaded objects, and then translate strings using the `t` method, including interpolation for variables and indexed placeholders.
Migrate to a actively maintained internationalization library like `i18next`, `i18n-js`, or `node-i18n` for better long-term support, features, and security.
Continue using `const I18n = require('i18n-t');` in CommonJS contexts. For projects requiring ESM, consider using a different, modern i18n library that explicitly supports ESM.Create a `declare module 'i18n-t' { ... }` block with appropriate types for the `I18n` class and its methods, or migrate to a TypeScript-first i18n library.Implement custom logic to check for translation existence before calling `i18n.t` or wrap `i18n.t` with a function that provides desired fallback behavior. Ensure all required keys exist in your locale files.
Instantiate the I18n class using the `new` keyword: `const i18n = new I18n({ defaultLocale: 'en' });`This package is CommonJS. Ensure you are using `const I18n = require('i18n-t');` and that your project is configured for CommonJS, or migrate to an i18n library that supports ESM.Run `npm install i18n-t` to ensure the package is installed. If in an ESM project, consider using a different i18n library or a CJS-to-ESM wrapper if absolutely necessary, though migration is recommended.
No dependency data recorded yet.