tekir
All Packages
Utilitiesv0.1.4

@tekir/i18n

Internationalization with JSON locale files, interpolation, and pluralization.

Installation

$bun add @tekir/i18n

Features

  • Auto-loads JSON locale files from resources/lang/
  • Interpolation with {{ param }} syntax
  • Pluralization with _zero, _one, _other suffixes
  • Fallback locale support
  • HttpContext integration: ctx.t(), ctx.locale

Quick Example

TypeScript
import { I18n } from '@tekir/i18n'

const i18n = new I18n({ defaultLocale: 'en' })
await i18n.ready()

i18n.t('messages.welcome', { name: 'Ali' })
i18n.plural('items', 3)

Changelog

v0.1.4LatestSeptember 16, 2026
  • Published output now uses the shared Node-targeted ESM bundle pipeline with external dependencies and generated TypeScript declarations, while Bun consumers keep the native source export.
v0.1.3July 23, 2026
  • Package metadata now follows the shared compatible 0.1.x dependency range used by this coordinated Tekir release.
v0.1.2July 16, 2026
  • Accept-Language negotiation now honors quality weights, exclusions (q=0), wildcard fallback, and deterministic preference ordering.
v0.1.1June 13, 2026
  • Locale loading and t() lookups now reject __proto__, constructor, and prototype keys and build their maps on null-prototype objects, closing a prototype pollution vector.
  • Locale files are now confirmed to resolve to a file under the locale directory, so a symlink or separator trick cannot pull translations from outside the tree.
  • t() output is not HTML-escaped; the docs now state explicitly that callers must escape translated strings before rendering them into HTML.
  • Found and fixed with Fable.
v0.1.0April 1, 2026
  • Initial release

Other Utilities packages