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

@i18nez/react

v1.3.0

Published

React hooks and components for the i18nez translation API

Downloads

68

Readme

@i18nez/react

React hooks and components for the i18nez translation API.

Drop-in i18n for React apps. Wrap your tree once, write English in your JSX, and i18nez translates on the fly into every locale you target. Translations are cached per-tenant and distributed to every user of your app, you pay for the translation once, not once per user.

npm install @i18nez/react @i18nez/core

Quickstart

import { I18nezProvider, T } from "@i18nez/react";

export default function App() {
  return (
    <I18nezProvider
      apiKey={process.env.NEXT_PUBLIC_I18NEZ_KEY!}
      defaultLocale="en"
    >
      <h1><T>Welcome to our store</T></h1>
      <p><T>Browse thousands of products.</T></p>
    </I18nezProvider>
  );
}

On first render i18nez fetches the translation bundle for the active locale. Missing strings are queued, batched, and sent to the API. The returned translation is cached locally and (optionally) persisted so every subsequent render is instant.

API

<I18nezProvider>

<I18nezProvider
  apiKey="tlv_pub_..."         // public key (safe in client)
  defaultLocale="en"
  fallbackLocale="en"          // optional, used when target has no translation
  apiUrl="https://api.i18nez.dev"  // optional override
  preloadLocales={["it","fr"]} // optional, warm caches at boot
  context="e-commerce product page"  // optional, guides the LLM
  tone="friendly"
  persistence={localStorageAdapter}  // optional, persist bundles across reloads
/>

useTranslation()

const { t, locale, setLocale, isLoading } = useTranslation();

return <button>{t("Add to cart")}</button>;
// with params
return <span>{t("Hello, {name}!", { params: { name: user.name } })}</span>;

<T> component

<T>Sign up free</T>
<T params={{ count }}>You have {count} items</T>
<T context="call-to-action">Get started</T>

Animations

<T> ships four zero-dep CSS presets that play whenever the translation changes (e.g. on locale switch). Default is "none".

<T animate="fade">Welcome back</T>           {/* 220ms cross-fade   */}
<T animate="blur">Settings</T>               {/* 280ms blur → sharp */}
<T animate="slide">Your cart</T>             {/* 240ms fade + up    */}
<T animate="typewriter">Generating…</T>      {/* char-by-char       */}

{/* Override duration (ms) per instance */}
<T animate="slide" duration={400}>Checkout</T>

Dynamic content

Pass dynamic for runtime-variable strings (product names, user-generated content, CMS bodies). These are translated on demand and cached in Redis for the session, but never persisted to the locale bundle, so your bundle stays lean even on apps with hundreds of thousands of unique strings.

<T dynamic>{product.name}</T>
<T dynamic>{product.description}</T>

useLocale()

const [locale, setLocale] = useLocale();

<LocaleSwitcher>

<LocaleSwitcher locales={["en", "it", "fr", "es"]} />

<TranslationBoundary>

<TranslationBoundary fallback={<SourceText />}>
  <T>Anything that might fail</T>
</TranslationBoundary>

How it works

  1. First render, <T>Welcome</T> emits the source text; i18nez hashes it, checks the local cache, shows the source as fallback, and enqueues a translation request.
  2. Response arrives, cache is updated, the tree re-renders with the translated text.
  3. Next session, the persisted bundle is loaded synchronously; translations appear without any network round-trip.

Dynamic content (user-generated, backend data) is hashed and translated on-demand the first time it's seen; all subsequent users of your app get the cached translation from the edge.

SSR / Next.js

Wrap the root layout; the provider is a client component.

// app/layout.tsx
import { Providers } from "./providers";

export default function RootLayout({ children }) {
  return <html><body><Providers>{children}</Providers></body></html>;
}

// app/providers.tsx
"use client";
import { I18nezProvider } from "@i18nez/react";
export function Providers({ children }) {
  return (
    <I18nezProvider apiKey={process.env.NEXT_PUBLIC_I18NEZ_KEY!} defaultLocale="en">
      {children}
    </I18nezProvider>
  );
}

License

MIT