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

@flyingrobots/bijou-i18n

v7.2.0

Published

In-memory localization runtime for Bijou — catalogs, locale direction, and runtime-safe lookups.

Readme

@flyingrobots/bijou-i18n

The in-memory localization runtime for Bijou.

@flyingrobots/bijou-i18n provides:

  • namespaced catalogs
  • locale and direction
  • message lookup
  • generic resource lookup
  • runtime-safe references
  • locale-aware formatting seams
  • explicit fallback catalogs
  • injectable missing-localization message formatting
  • async locale loader support for runtime-integrated catalog activation
  • an application-facing LocalizationPort that resolves structured localized objects
  • isJsonShapedLocalizedValue() for adapter-side resource/data payload conformance checks

This package is intentionally runtime-only. Spreadsheet workflows, stale detection, pseudo-localization, and catalog compilation belong in @flyingrobots/bijou-i18n-tools.

Loader Seam

Use createI18nRuntime() for fully preloaded catalogs, or createI18nRuntimeAsync() when catalogs need to be loaded lazily:

import { createI18nRuntimeAsync, type I18nCatalogLoader } from '@flyingrobots/bijou-i18n';

const loader: I18nCatalogLoader = async (locale) => {
  const module = await import(`./catalogs/${locale}.js`);
  return module.catalogs;
};

const runtime = await createI18nRuntimeAsync({
  locale: 'fr',
  direction: 'ltr',
  loader,
});

When runtime payloads are generated as pure per-locale catalogs, load the source or fallback catalog separately:

import { createI18nRuntime } from '@flyingrobots/bijou-i18n';

const runtime = createI18nRuntime({
  locale: 'fr',
  direction: 'ltr',
  fallbackLocale: 'en',
  fallbackCatalogs: [englishCatalog],
  catalogs: [frenchCatalog],
});

Production apps can use fallback catalogs for readable missing translations. Development apps can inject missingMessage to render a loud marker instead of quietly falling back when the selected locale is missing a string:

const runtime = createI18nRuntime({
  locale: 'fr',
  direction: 'ltr',
  fallbackLocale: 'en',
  fallbackCatalogs: [englishCatalog],
  missingMessage: ({ key }) => `<MISSING LOC STRING KEY=${key.namespace}:${key.id}>`,
});

The same loader seam also supports file-backed locale bundles through @flyingrobots/bijou-i18n-tools-node:

import { createI18nRuntimeAsync } from '@flyingrobots/bijou-i18n';
import { createCatalogBundleFileLoader } from '@flyingrobots/bijou-i18n-tools-node';

const runtime = await createI18nRuntimeAsync({
  locale: 'fr',
  direction: 'ltr',
  loader: createCatalogBundleFileLoader({
    resolvePath: (locale) => `./i18n/${locale}.json`,
  }),
});

Once created, the runtime can preload and activate locales explicitly:

await runtime.preloadLocale('de');
await runtime.setLocale('de');

Localization Port

Use LocalizationPort at application and view boundaries when callers need a localized object instead of a concrete runtime:

import {
  createI18nRuntime,
  createRuntimeLocalizationPort,
} from '@flyingrobots/bijou-i18n';

const runtime = createI18nRuntime({
  locale: 'fr',
  direction: 'ltr',
  fallbackLocale: 'en',
  fallbackCatalogs: [englishCatalog],
  catalogs: [frenchCatalog],
});
const localization = createRuntimeLocalizationPort(runtime);

const title = localization.resolve({
  key: { namespace: 'app', id: 'title' },
});

resolve() returns a frozen localized object with the key, locale, direction, entry kind, translated/fallback/missing status, value, issues, and facts. That keeps rendering code away from catalog loading, filesystem paths, CSV data, and runtime mutation details while preserving enough state for tooling and lower modes.

Resource And Data Payloads

Message entries resolve to strings. resource and data entries resolve to portable structured values, and the runtime freezes those values before handing them to callers.

Keep resource/data payloads JSON-shaped:

  • strings, numbers, booleans, null, and undefined
  • arrays with indexed entries only
  • plain objects with enumerable data properties only

Do not use:

  • class instances or built-ins such as Date
  • symbol-keyed properties
  • non-enumerable properties
  • accessor properties
  • cyclic object graphs
  • functions, symbols, or bigint values

Unsupported shapes are rejected at the localization boundary rather than being silently normalized. This keeps generated catalogs, runtime loader adapters, and view code honest: adapters must produce portable data, and consumers can trust that localized resource/data values are immutable snapshots rather than mutable runtime handles.

Adapters can check payloads before building catalogs:

import { isJsonShapedLocalizedValue } from '@flyingrobots/bijou-i18n';

if (!isJsonShapedLocalizedValue(payload)) {
  throw new Error('i18n resource/data payload must be JSON-shaped');
}

Valid resource/data payloads are dense, plain data:

const validResource = {
  label: 'Counter',
  range: { min: 0, max: 10 },
  marks: ['empty', 'half', 'full'],
};

Invalid payloads are rejected instead of being silently normalized:

class CounterResource {
  readonly label = 'Counter';
}

const sparse = new Array<string>(2);
sparse[1] = 'full';

const accessor = Object.defineProperty({}, 'label', {
  enumerable: true,
  get() {
    return 'Counter';
  },
});

isJsonShapedLocalizedValue(new CounterResource()); // false
isJsonShapedLocalizedValue(sparse); // false
isJsonShapedLocalizedValue(accessor); // false

Documentation

See the Bijou repo for the full documentation map, architecture guide, and design system.