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/next

v0.10.0

Published

Better-i18n Next.js integration

Readme

@better-i18n/next

Next.js integration for Better i18n. Provides seamless next-intl integration with CDN-powered translation fetching.

Features

  • Zero-Config Sync - Connects to your project via i18n.config.ts
  • Edge-Ready Caching - Built-in ISR support for manifest and messages
  • Type-Safe - Full TypeScript support
  • next-intl First - Designed as a message provider for next-intl

Installation

npm install @better-i18n/next next-intl
# or
bun add @better-i18n/next next-intl

Quick Start

1. Create i18n config

// i18n.config.ts
import { createI18n } from "@better-i18n/next";

export const i18n = createI18n({
  project: "your-org/your-project", // Format: "org-slug/project-slug"
  defaultLocale: "en",
});

2. Setup request config

// src/i18n/request.ts
import { i18n } from "../i18n.config";

export default i18n.requestConfig;

3. Add middleware

// middleware.ts
import { i18n } from "./i18n.config";

export default i18n.middleware;

export const config = {
  matcher: ["/((?!api|_next|.*\\..*).*)"],
};

4. Use translations

// app/page.tsx
import { useTranslations } from "next-intl";

export default function Home() {
  const t = useTranslations("common");
  return <h1>{t("welcome")}</h1>;
}

Advanced Middleware

For more control, use createBetterI18nMiddleware:

import { createBetterI18nMiddleware, composeMiddleware } from "@better-i18n/next/middleware";

const i18nMiddleware = createBetterI18nMiddleware({
  project: "org/project",
  defaultLocale: "en",
  detection: {
    cookie: true,
    browserLanguage: true,
    cookieName: "locale",
    cookieMaxAge: 31536000, // 1 year
  },
});

// Compose with other middleware
export default composeMiddleware(i18nMiddleware, authMiddleware);

Client Hook

"use client";

import { useManifestLanguages } from "@better-i18n/next/client";

export function LanguageSwitcher() {
  const { languages, isLoading, error } = useManifestLanguages({
    project: "your-org/your-project",
    defaultLocale: "en",
  });

  if (isLoading) return <span>Loading...</span>;
  if (error) return <span>Error: {error.message}</span>;

  return (
    <select>
      {languages.map((lang) => (
        <option key={lang.code} value={lang.code}>
          {lang.nativeName || lang.name || lang.code}
        </option>
      ))}
    </select>
  );
}

Server Utilities

import {
  getMessages,
  getLocales,
  getManifestLanguages,
} from "@better-i18n/next/server";

const config = { project: "org/project", defaultLocale: "en" };

const locales = await getLocales(config);
const messages = await getMessages(config, "tr");
const languages = await getManifestLanguages(config);

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | project | string | required | Project identifier (org/project format) | | defaultLocale | string | required | Default/fallback locale code | | cdnBaseUrl | string | auto | CDN base URL (auto-detected) | | localePrefix | "as-needed" | "always" | "never" | "as-needed" | URL locale prefix behavior | | cookieName | string | "locale" | Cookie name for locale persistence | | manifestRevalidateSeconds | number | 3600 | Next.js ISR revalidation for manifest | | messagesRevalidateSeconds | number | 30 | Next.js ISR revalidation for messages | | storage | TranslationStorage | undefined | Persistent cache for offline fallback (see @better-i18n/core) | | staticData | Record \| () => Promise | undefined | Bundled translations as last-resort fallback | | fetchTimeout | number | 10000 | CDN fetch timeout in ms | | retryCount | number | 1 | Retry attempts on CDN failure | | debug | boolean | false | Enable debug logging | | logLevel | LogLevel | "warn" | Logging verbosity |

Debug Logging

Enable with environment variables:

  • BETTER_I18N_DEBUG=1
  • BETTER_I18N_LOG_LEVEL=debug|info|warn|error|silent

Documentation

Full documentation available at docs.better-i18n.com/next

License

MIT © Better i18n