LinguiJS

A readable, automated, and optimized (3 kb) internationalization for JavaScript
GitHub
4.76k
Created 8 years ago, last commit 6 days ago
222 contributors
2.5k commits
Stars added on GitHub, month by month
12
1
2
3
4
5
6
7
8
9
10
11
2023
2024
Stars added on GitHub, per day, on average
Yesterday
+4
Last week
+5.0
/day
Last month
+4.5
/day
Last 12 months
+2.0
/day
npmPackage on NPM
Monthly downloads on NPM
12
1
2
3
4
5
6
7
8
9
10
11
2023
2024
README

Linguijs

🌍📖 A readable, automated, and optimized (3 kb) internationalization for JavaScript


Main Suite Release Workflow Testing Code Coverage PRs Welcome Join the community on Discord

Documentation · Quickstart · Example · Support · Contribute · License

Internationalization is the design and development of a product, application or document content that enables easy localization for target audiences that vary in culture, region, or language.

--- W3C Web Internationalization FAQ

Lingui is an easy yet powerful internationalization (i18n) framework for global projects.

  • Clean and readable - Keep your code clean and readable, while the library uses battle-tested and powerful ICU MessageFormat under the hood.

  • Universal - Use it everywhere. @lingui/core provides the essential intl functionality which works in any JavaScript project while @lingui/react offers components to leverage React rendering, including React Server Components (RSC) support.

  • Full rich-text support - Use React components inside localized messages without any limitation. Writing rich-text messages is as easy as writing JSX.

  • Powerful tooling - Manage your intl workflow with the Lingui CLI, Vite Plugin, and ESLint Plugin. The CLI extracts, compiles and validates messages, while the Vite plugin compiles catalogs on the fly, and the ESLint plugin helps catch common usage errors.

  • Unopinionated - Integrate Lingui into your existing workflow. It supports message keys as well as auto-generated messages. Translations are stored either in JSON or standard PO files, which are supported in almost all translation tools.

  • Lightweight and optimized - Core library is less than 3 kB gzipped, React components are additional 1.4 kB gzipped.

  • Active community - Join the growing community of developers who are using Lingui to build global products.

  • Compatible with react-intl - Low-level React API is very similar to react-intl and the message format is the same. It's easy to migrate an existing project.

Quickstart

  1. Introduction
  2. Installation and Setup

Tutorials

Example

Short example how i18n looks with JSX:

import { Trans } from "@lingui/react/macro"

function App() {
  return (
    <Trans id="msg.docs" /* id is optional */>
      Read the <a href="https://lingui.dev">documentation</a>
      for more info.
    </Trans>
  )
}

Message from this component will be extracted in following format:

msgid "msg.docs"
msgstr "Read the <0>documentation</0> for more info."

For more example see the Examples directory.

Support

If you are having issues, please let us know.

  • Join us on Discord to chat with the community.
  • Ask questions on StackOverflow and mark it with the linguijs tag.
  • If something doesn't work as documented, documentation is missing or if you just want to suggest a new feature, create an issue.
  • You can also Ask Lingui JS Guru, it is a Lingui JS focused AI to answer your questions.

Contribute

Contribution to open-source project is everything from spreading the word, writing documentation to implement features and fixing bugs.

  • Do you use Lingui in production site? Let us know!
  • Have you seen any interesting talk or article about i18n? Share it!
  • Have you found a bug or do you want to suggest a new feature? Create an issue!
  • Do you want to improve the docs and write some code? Read the contributors guide and send a PR!

Contributors

This project exists thanks to all the people who contribute. [Contribute].

License

The project is licensed under the MIT license.