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

@sonenta/i18n-core

v1.4.2

Published

Framework-agnostic Sonenta i18n engine: CDN bundles, surfaces, a11y, plurals, missing-key, language catalog. Powers the @sonenta framework bindings.

Readme

@sonenta/i18n-core

The framework-agnostic Sonenta i18n engine. It is the shared core under the official framework bindings — @sonenta/react-i18next, @sonenta/vue-i18n, @sonenta/svelte-i18n, and @sonenta/next — so they all resolve translations identically.

Most apps should install a binding (e.g. @sonenta/react-i18next), not this package directly. Use @sonenta/i18n-core only to build a custom binding or to drive translations from non-UI code.

npm install @sonenta/i18n-core i18next

What's in the core

Everything framework-neutral, extracted from @sonenta/react-i18next (the oracle — the core passes react-i18next's own engine test suite):

  • SonentaI18n — the engine: CDN bundle loading, sync offline construction from initialBundles, start(), t(), subscribe()/getSnapshot()/ refresh() (an external-store contract any framework can bind to).
  • Surface variants (#911)setSurface(), sparse {ns}.{surface}.json overlays, surfaceForWidth, breakpoints.
  • A11y surfaces (#989)aria()/alt()/a11y() + plain-language toggle; the key-type taxonomy (treatmentsFor, baseRoleFor).
  • Language catalog (#803)dir()/nativeName()/languageMeta().
  • Available languages — per-version manifest.
  • Missing-key streaming + gate, CLDR plurals, the on-screen key registry (feeds @sonenta/feedback), and the transport abstraction.

Framework-neutral by injection

The engine inits a vanilla i18next instance. A binding injects its own i18next plugin (e.g. initReactI18next) via the constructor:

import { SonentaI18n } from "@sonenta/i18n-core";
import { initReactI18next } from "react-i18next";

// React binding:
const i18n = new SonentaI18n(config, { plugins: [initReactI18next] });

// Vanilla / Vue / Svelte: no React plugin.
const i18n = new SonentaI18n(config);
await i18n.start();
i18n.t("home.title");

i18next is a peer dependency (>=23 <27) — bring your own.

fetchImpl — injecting your own fetch

start() takes the fetch the engine uses: await i18n.start(myFetch). It is stored on the instance (src/i18n.ts:154) and resolved at call time (:656-658), never captured at construction — so setLocale() and reload() keep using it. That matters for an authenticated fetch: an engine that resolved it once would silently fall back to the global fetch on the next language change and lose the caller's auth headers with no error anywhere.

Note it is a start() argument, not a field of SonentaConfig (src/types.ts:80 declares no fetchImpl). The bindings expose it as an option of their own setup call, which they forward to start(): @sonenta/vue-i18n (src/plugin.ts:13), @sonenta/svelte-i18n (src/index.ts:35), @sonenta/next (src/server.ts:32), and @sonenta/react-i18next as the fetchImpl prop of <SonentaProvider>.

It is a supported, public option — documented here because it shipped undocumented, which left callers unable to tell it apart from a private field that could be removed without notice.

License

MIT © Sonenta