Dead simple i18n middleware for Express REST APIs. Version 1.0.1 provides lightweight, dependency-free internationalization with nested message support and automatic locale detection via query, header, or cookie. No build tools, no extra dependencies; simply define messages in JSON and use the `t()` method on `req` or `res`. Unlike heavier i18n libraries, it focuses solely on REST APIs with a minimal footprint. Released as stable, with no active development but no known issues.
npm install express-rest-i18nNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an i18n middleware, registers it, and uses the t() method in a route.
Ensure app.use(i18n.middleware) comes after app.use(bodyParser.json()) or similar.
Use res.i18n.t('key') or req.i18n.t('key') instead of res.t('key') or req.t('key').Check if the returned value equals the key to detect missing translations.
Ensure only one locale source is used or understand the priority: query > header > cookie > defaultLocale.
Set allowFallback: false if you want strict locale enforcement.
Ensure app.use(i18n.middleware) is called after body-parser and before routes.
Use req.i18n.t('key') or res.i18n.t('key').Use const i18nCreate = require('express-rest-i18n'); or add "type": "module" to package.json.Use default import (import i18nCreate from ...) or const i18nCreate = require(...).