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

@lingui/react

v6.8.0

Published

React bindings for Lingui i18n: I18nProvider, Trans and useLingui, with compile-time macros and React Server Components support

Readme

License Version Downloads

@lingui/react

React bindings for Lingui i18n: I18nProvider, Trans and useLingui, with compile-time macros and React Server Components support

@lingui/react is part of Lingui. Lingui is a lightweight, open-source internationalization (i18n) library for JavaScript and TypeScript. It brings compile-time macros and a CLI for message extraction to React, React Native, Vue, SolidJS, Astro, Svelte, and Node.js.

The package has the following entry points:

  • @lingui/react exports I18nProvider, the Trans component and the useLingui hook. The provider puts an i18n instance from @lingui/core into React context.
  • @lingui/react/macro exports the Trans, Plural, Select and related macros, which generate the ICU message and its ID from JSX at build time, and a useLingui macro whose t translates strings outside JSX. Macros need the Babel or SWC plugin.
  • @lingui/react/server exports setI18n for React Server Components, where Trans and useLingui read that instance instead of context. The same component renders on the server and on the client.

Installation

npm install @lingui/core @lingui/react

@lingui/core provides the i18n instance passed to the provider. The installation guide covers the macro plugin and the lingui.config.js file.

Usage

import { i18n } from "@lingui/core"
import { I18nProvider } from "@lingui/react"
import { Trans, useLingui } from "@lingui/react/macro"
import { messages } from "./locales/en/messages"

i18n.load("en", messages)
i18n.activate("en")

function Welcome({ name }) {
  const { t } = useLingui()
  return (
    <>
      <img src="/logo.svg" alt={t`Lingui logo`} />
      <Trans>
        Welcome back, {name}. Read the <a href="/docs">documentation</a>.
      </Trans>
    </>
  )
}

export function App() {
  return (
    <I18nProvider i18n={i18n}>
      <Welcome name="Fred" />
    </I18nProvider>
  )
}

The Trans block becomes a single message, Welcome back, {name}. Read the <0>documentation</0>., where <0> stands for the link. lingui extract from @lingui/cli writes the messages into the catalogs and lingui compile produces the messages module imported above.

Continue with the React tutorial, the Next.js App Router tutorial for Server Components or the React Native tutorial. See the React reference and the macro reference for the full API.

License

This package is licensed under the MIT license.