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

@lingo.dev/react-next

v1.26.0

Published

Lingo.dev for Next.js: @lingo.dev/react on the App Router (locale proxy, server Lingo, catalog provider, metadata, locale switcher) and the Pages Router.

Readme

@lingo.dev/react-next

Lingo.dev for Next.js: wires @lingo.dev/react into the App Router and the Pages Router. Translations live in locales/<locale>.jsonc, written by the lingo CLI, and are read on the server.

App Router

Requires Next.js 16 and React 19. On Next.js 16.0 to 16.2, set experimental: { rootParams: true } in next.config; from 16.3 next/root-params needs no setting. Every locale is served under a URL prefix (/en/pricing, /de/pricing), and the pages live under app/[locale]/.

// i18n.ts
export const locales = createLocaleRouter(["en", "de", "ja"] as const, { defaultLocale: "en", exclude: ["api"] });
// proxy.ts: a path without a prefix redirects to the browser's locale
export const proxy = lingoProxy(locales);
export const config = { matcher: ["/", "/((?!api|_next|.*\\..*).*)"] };
// app/[locale]/layout.tsx
export const generateStaticParams = () => lingoStaticParams(locales);

export default async function RootLayout({ children }: { children: ReactNode }) {
  const l = await getLingo();
  return (
    <html lang={l.locale} dir={l.direction}>
      <body>
        <LingoAppProvider locales={locales}>{children}</LingoAppProvider>
      </body>
    </html>
  );
}

// app/[locale]/page.tsx: a server component
export async function generateMetadata() {
  return lingoMetadata({ locales, pathname: "/", origin: "https://example.com" });
}

export default async function Home() {
  const l = await getLingo();
  return <h1>{l.text("Welcome", { context: "Heading of the start page" })}</h1>;
}

createLocaleRouter comes from @lingo.dev/locale-router; useLingo for client components from @lingo.dev/react.

| Entry | Exports | | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | @lingo.dev/react-next/app/server | getLingo(): the request's Lingo, for server components and generateMetadata. LingoAppProvider: gives client components useLingo() with the whole catalog of the locale. lingoMetadata({ locales, pathname, origin }): canonical, hreflang and Open Graph locale. lingoStaticParams(locales). | | @lingo.dev/react-next/app/client | useLocaleSwitch(locales): one { locale, label, href, current } per locale for a link-based switcher. | | @lingo.dev/react-next/app/proxy | lingoProxy(locales): a 301 to the canonical address for /DE or /pt-BR, a 307 to the negotiated locale for a bare path, undefined for everything else so it chains with the app's own proxy. |

The locale comes from the [locale] segment through next/root-params, so no page passes it on. That segment is the locale's tag in lowercase (/pt-br for pt-BR), so the router takes no slugs option. Internal links carry the prefix: locales.prefix("/pricing", locale).

In production the source locale ships no catalog to the browser; its text is the fallback. The catalogs are read with fs from the folder next runs from. Prerendered pages work anywhere; a page rendered on demand needs a Node.js runtime, not Cloudflare Workers or the Edge runtime.

Pages Router

Works on Next.js 13 and later. The next.config i18n locales match the .lingo/config.json locales.

// pages/_app.tsx
export default withLingoApp(function App({ Component, pageProps }: AppProps) {
  return <Component {...pageProps} />;
});

// pages/about.tsx
export const getStaticProps = withLingoProps({ route: "pages/about" });

| Entry | Exports | | ------------------------------------ | ----------------------------------------------------------------------------------------------------- | | @lingo.dev/react-next/pages/client | withLingoApp, LingoHead (hreflang links), useLocaleSwitch. | | @lingo.dev/react-next/pages/server | withLingoProps for getStaticProps or getServerSideProps, withLingoPaths for getStaticPaths. |

A page gets the strings of its own file and of every file outside pages/. A page without withLingoProps renders the source language.

With an agent

lingo agent-guide react-next-app and lingo agent-guide react-pages-router print the full setup for each router, from the installed package.