npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@djangocfg/i18n

v2.1.239

Published

Lightweight i18n library for @djangocfg packages with built-in translations for English, Russian, and Korean

Readme

@djangocfg/i18n

@djangocfg/i18n

Lightweight, type-safe i18n library for @djangocfg packages.

Features

  • 17 languages — en, ru, ko, ja, de, fr, zh, it, es, nl, ar, tr, pt-BR, pl, sv, no, da
  • Type-safe — Full TypeScript support with autocomplete
  • CLI included — Manage locales from the terminal
  • Works standalone — Components work without provider

Installation

pnpm add @djangocfg/i18n

Quick Start

import { I18nProvider, useT, ru } from '@djangocfg/i18n'

<I18nProvider locale="ru" translations={ru}>
  <App />
</I18nProvider>

function MyComponent() {
  const t = useT()
  return <span>{t('ui.form.save')}</span>
}

Subpath Imports (Server Components)

// ✅ Server-safe (no React Context)
import { en, ru, ko } from '@djangocfg/i18n/locales'
import { mergeTranslations } from '@djangocfg/i18n/utils'

// ❌ Client-only (has React Context)
import { I18nProvider, useT } from '@djangocfg/i18n'

| Path | Description | |------|-------------| | @djangocfg/i18n | Full package (client components) | | @djangocfg/i18n/locales | Locale data only (server-safe) | | @djangocfg/i18n/utils | Utilities like mergeTranslations (server-safe) |

CLI

# Check missing keys across locales
pnpm i18n check

# List / search keys
pnpm i18n list
pnpm i18n list tour        # filter by pattern
pnpm i18n list -v          # with values

# Add key to all locales at once
pnpm i18n add "tools.new" '{"en":"New","ru":"Новый"}'

# Work with app locales in another directory
pnpm i18n check -d ../../apps/hub/i18n/locales
pnpm i18n list -d ../../apps/hub/i18n/locales

Hooks

| Hook | Description | |------|-------------| | useT() | Returns translation function (recommended) | | useI18n() | Full context: { t, locale, setLocale, translations } | | useLocale() | Returns current locale string | | useTypedT<T>() | Type-safe with compile-time key validation |

useT()

function MyComponent() {
  const t = useT()
  return <button>{t('ui.form.save')}</button>
}

useI18n()

function LocaleSwitcher() {
  const { t, locale, setLocale } = useI18n()

  return (
    <select value={locale} onChange={(e) => setLocale(e.target.value)}>
      <option value="en">English</option>
      <option value="ru">Russian</option>
    </select>
  )
}

Type-safe next-intl Integration

Override useTranslations in your app's global.d.ts to get compile-time key validation.

// global.d.ts
type _Messages = import('@djangocfg/i18n').I18nTranslations &
  import('./i18n/locales/types').AppTranslations;

type _NSKeys = import('@djangocfg/i18n').NamespaceKeys<
  _Messages,
  import('@djangocfg/i18n').NestedKeyOf<_Messages>
>;

declare module 'next-intl' {
  export function useTranslations<NS extends _NSKeys>(
    namespace: NS,
  ): import('@djangocfg/i18n').IntlTranslator<_Messages, NS>;
}

Extending Translations

// Spread merge (recommended for next-intl)
import { en as baseEn } from '@djangocfg/i18n/locales'
const messages = { ...baseEn, ...appEn }

// Deep merge with overrides
import { mergeTranslations, ru } from '@djangocfg/i18n'
const customRu = mergeTranslations(ru, {
  ui: { select: { placeholder: 'Выберите...' } },
})

Interpolation

t('ui.pagination.showing', { from: 1, to: 10, total: 100 })
// => "1-10 of 100"

Translation Key Paths

ui.*         - UI components (select, form, dialog, table, pagination)
layouts.*    - Layout components (sidebar, auth, profile, theme)
api.*        - API/network messages
centrifugo.* - WebSocket monitoring
tools.*      - Heavy tools (tour, upload, code, image)

Works Without Provider

Components using useT() fall back to English defaults when used outside a provider.

License

MIT