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

@_apparatus_/intl-tools

v2.0.1

Published

A small set of tools to support application internationalization.

Downloads

55

Readme

@_apparatus_/intl-tools

bundle size

A small set of tools to support application internationalization.

Installation

npm install @_apparatus_/intl-tools

Features

  • 🌍 Dynamic loading - Load translations for different locales and modules on demand.
  • 🔌 Pluggable formatters - Integrate with external libraries like MessageFormat (ICU), Fluent, etc.
  • 🪆 Nesting - Reference translations within translations using <:nested.key/> syntax.
  • 🏷️ HTML-like Tags - Wrap content with tags for rich text formatting.
  • Type safety - Fully typed translation keys with TypeScript autocomplete.
  • 📦 Module system - Organize translations by feature modules for better code splitting.

Examples

Basic usage

import { createLocalizer } from '@_apparatus_/intl-tools'

// Define your translations structure
// A good idea is to import types from JSON
type Translations = {
    common: {
        greeting: string
        user: {
            welcome: string
        }
    }
    dashboard: {
        title: string
        stats: string
    }
}

// Create localizer instance
const localizer = createLocalizer<Translations>({
    load: async (locale, module) => {
        // Load translations synchronously or asynchronously
        const response = await fetch(`/locales/${locale}/${module}.json`)
        return response.json()
    },
})
const { t } = localizer

// Set active locale and modules
localizer.setLocales('en-US')
localizer.setModules('common', 'dashboard')

// Wait for pending locales and modules
await localizer.wait()

// Access typed translations
console.log(t.common.greeting())
console.log(t.common.user.welcome())
console.log(t.dashboard.title())

Switching locales

const localizer = createLocalizer(...)
const { t } = localizer

// Set default locale
localizer.setLocales('en-US')
localizer.setModules('common')
await localizer.wait()

console.log(t.common.greeting()) // "Hello"

// Switch to Portuguese
localizer.setLocales('pt-BR')
await localizer.wait()
console.log(t.common.greeting()) // "Olá"

// Locale fallbacks (tries first locale, falls back to second)
localizer.setLocales('pt-BR', 'en-US')

Translation nesting

// Translation files:
// common.json
{
    "app": "MyApp",
    "welcome": "Welcome to <:app/>!",
    "footer": "© 2024 <:app/>. All rights reserved.",
    "cross_module": "Check <:dashboard:title/> for details"
}

const { t } = localizer
t.common.welcome() // "Welcome to MyApp!"
t.common.footer() // "© 2024 MyApp. All rights reserved."
t.common.cross_module() // "Check Dashboard for details"

Custom formatters

import { createLocalizer } from '@_apparatus_/intl-tools'
import IntlMessageFormat from 'intl-messageformat'

const localizer = createLocalizer<Translations>({
    ...
    parse: (locale, module, key, raw) => {
        const formatter = new IntlMessageFormat(raw, locale)
        return values => formatter.format(values) as string
    },
})
const { t } = localizer

// "You have {count, plural, =0 {no messages} one {# message} other {# messages}}."
t.common.messages({ count: 0 }) // "You have no messages."
t.common.messages({ count: 1 }) // "You have 1 message."
t.common.messages({ count: 5 }) // "You have 5 messages."

HTML tags for rich Content

const localizer = createLocalizer<Translations, JSX.Element>({
    ...
    tag: (children, tag) => {
        // Fallback transform unmatched tags to elements
        return <Dynamic tag={tag}>{children}</Dynamic>
    },
})

// Translation: "Read our <b><a-terms>terms of service</a-terms></b>."
const { t } = localizer
const content = t.common.legal({}, { 'a-terms': c => <a href='/terms'>{c}</a> })
// Renders: "Read our <b><a href="/terms">terms of service</a></b>."

Hook into rendering libraries lifecycle

import { createSignal, createEffect, Show } from 'solid-js'
import { createLocalizer } from '@_apparatus_/intl-tools'

// Solid-js Suspense example
const localizer = createLocalizer<Translations>({
    notify: (_, __, promise) => createResource(() => promise)[0],
})
localizer.setLocales('en-US')
localizer.setModules('common', 'dashboard')
const { t } = localizer

const App = () => (
    <Skeleton fallback='loading...'>
        <div>
            <h1>{t.dashboard.title()}</h1>
            <p>{t.common.greeting()}</p>
        </div>
    </Skeleton>
)

Untyped keys

const { t } = localizer

// Typed access
const greetingType = getStrictUserPreferredGreeting() // 'formal' | 'informal'
t.common.greeting[greetingType]() // ✅ Type safe

// Key segment not known at compile time
const greetingType = getUserPreferredGreeting() // string
t.common.greeting[greetingType]() // ⛔ Type error
t.common.greeting[greetingType].$() // ⚠️ Bypass error

// Access deeply nested untyped keys
t.dashboard.user.profile.settings.$()