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

@better-i18n/remix

v0.7.0

Published

Better i18n Remix/Hydrogen integration — CDN-powered i18n

Readme

@better-i18n/remix

CDN-powered i18n for Remix and Shopify Hydrogen.

npm

Features

  • CDN-First — Translations fetched from Better i18n CDN with in-memory TTL caching
  • Locale Detection — Parses Accept-Language header, matches against available locales
  • Singleton Pattern — Create once at module scope, reuse across all requests
  • Framework-Agnostic Messages — Returns raw JSON, compatible with i18next, react-intl, or custom solutions
  • Offline Fallback — Supports storage and staticData for resilience (via @better-i18n/core)

Installation

npm install @better-i18n/remix
# or
bun add @better-i18n/remix

Quick Start

1. Create i18n instance (singleton)

// app/i18n.server.ts
import { createRemixI18n } from "@better-i18n/remix";

export const i18n = createRemixI18n({
  project: "acme/hydrogen-store",
  defaultLocale: "en",
});

2. Use in loaders

// app/root.tsx
import { json, type LoaderFunctionArgs } from "@remix-run/node";
import { i18n } from "./i18n.server";

export async function loader({ request }: LoaderFunctionArgs) {
  const locale = await i18n.detectLocale(request);
  const locales = await i18n.getLocales();
  const messages = await i18n.getMessages(locale);

  return json({ locale, locales, messages });
}

3. With remix-i18next (recommended)

// app/i18next.server.ts
import { RemixI18Next } from "remix-i18next/server";
import { i18n } from "./i18n.server";

export const remixI18next = new RemixI18Next({
  detection: {
    supportedLanguages: await i18n.getLocales(),
    fallbackLanguage: "en",
  },
  i18next: {
    resources: {}, // loaded dynamically via Better i18n CDN
  },
});

4. Standalone (without i18next)

// Any loader
import { i18n } from "./i18n.server";

export async function loader({ request }: LoaderFunctionArgs) {
  const locale = await i18n.detectLocale(request);
  const messages = await i18n.getMessages(locale);
  // messages = { "common": { "hello": "Hello" }, "account": { ... } }

  return json({ locale, messages });
}

API

createRemixI18n(config)

Creates a singleton i18n instance with CDN-backed caching.

| Option | Type | Default | Description | |--------|------|---------|-------------| | project | string | — | Project identifier ("org/project") | | defaultLocale | string | — | Fallback locale | | cdnBaseUrl | string | "https://cdn.better-i18n.com" | CDN base URL | | debug | boolean | false | Enable debug logging | | storage | TranslationStorage | — | Persistent cache for offline support | | staticData | Record<string, Messages> | — | Bundled translations as last-resort fallback |

Instance Methods

| Method | Returns | Description | |--------|---------|-------------| | detectLocale(request) | Promise<string> | Detect locale from Accept-Language header | | getMessages(locale) | Promise<Messages> | Get all namespaced messages for a locale | | getLocales() | Promise<string[]> | Get available locale codes | | getLanguages() | Promise<LanguageOption[]> | Get languages with metadata |

Offline Fallback

For resilience in environments with unreliable network, provide storage and/or staticData:

export const i18n = createRemixI18n({
  project: "acme/store",
  defaultLocale: "en",
  // Persist translations to survive CDN outages
  storage: {
    get: (key) => cache.get(key),
    set: (key, value) => cache.set(key, value),
  },
  // Bundled translations as absolute last resort
  staticData: {
    en: { common: { hello: "Hello" } },
    tr: { common: { hello: "Merhaba" } },
  },
});

See @better-i18n/core for the full 5-layer fallback chain.

How It Works

  1. CDN-first — Translations are fetched from Better i18n CDN with in-memory TTL caching
  2. Locale detection — Parses Accept-Language header, matches against available locales
  3. Singleton pattern — Create once at module scope, reuse across all requests
  4. Framework-agnostic messages — Returns raw JSON messages — compatible with i18next, react-intl, or custom solutions

Documentation

Full documentation at docs.better-i18n.com/frameworks/remix

License

MIT © Better i18n