Skip to content

Commit

Permalink
Merge pull request #1871 from lingui/next
Browse files Browse the repository at this point in the history
chore: sync `next` to `main`
  • Loading branch information
andrii-bodnar authored Nov 28, 2024
2 parents 8cfcc7d + d1e56b5 commit 14fa4d7
Show file tree
Hide file tree
Showing 335 changed files with 19,589 additions and 10,701 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ["16", "18", "19", "20"]
node: ["20", "22"]
os: [ubuntu-latest, windows-latest]

steps:
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ coverage/
website/
.github
examples
/.nx/workspace-data
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [5.0.0](https://github.com/lingui/js-lingui/compare/v4.14.1...v5.0.0) (2024-11-28)

We are pleased to announce the release of Lingui 5.0! This release is a **major milestone** for the project and includes a number of new features, improvements and bug fixes.

Check out the links below for more details:

- [Blog Post: Announcing Lingui 5.0](https://lingui.dev/blog/2024/11/28/announcing-lingui-5.0)
- [Migration Guide from 4.x to 5.x](https://lingui.dev/releases/migration-5)
- [Full Changelog](https://github.com/lingui/js-lingui/compare/v4.14.1...v5.0.0)

## [4.14.1](https://github.com/lingui/js-lingui/compare/v4.14.0...v4.14.1) (2024-11-28)

### Bug Fixes
Expand Down
85 changes: 24 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,56 @@
[![Join the community on Discord][Badge-Discord]][Discord]

[**Documentation**][Documentation] · [**Quickstart**](#quickstart) · [**Example**](#example) · [**Support**](#support) · [**Contribute**](#contribute) · [**License**](#license)

</div>

> 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](https://www.w3.org/International/questions/qa-i18n)
Lingui is an easy yet powerful internationalization (i18n) framework for global projects.

Lingui is an easy yet powerful internationalization 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.
- **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.
- **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.
- **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 the whole intl workflow using Lingui [CLI][RefCLI]. It
extracts messages from source code, validates messages coming from translators and
checks that all messages are translated before shipping to production.
- **Powerful tooling** - Manage your intl workflow with the Lingui [CLI](https://lingui.dev/ref/cli), [Vite Plugin](https://lingui.dev/ref/vite-plugin), and [ESLint Plugin](https://lingui.dev/ref/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.
- **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 only [1.5 kB gzipped][BundleCore],
React components are an additional [1.3 kBs gzipped][BundleReact]. That's less than Redux
for a full-featured intl library.
- **Lightweight and optimized** - Core library is less than [3 kB gzipped](https://bundlephobia.com/result?p=@lingui/core), React components are additional [1.4 kB gzipped](https://bundlephobia.com/result?p=@lingui/react).

- **Active community** - Join us on [Discord][Discord] to discuss the latest development.
At the moment, Lingui is the most active intl project on GitHub.
- **Active community** - Join the growing [community of developers](https://lingui.dev/community) 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.
- **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

### Install

- [React projects][TutorialSetupReact]
- [Vite project][SetupVite]
1. [Introduction](https://lingui.dev/introduction)
2. [Installation and Setup](https://lingui.dev/installation)

### Tutorials

- [React][TutorialReact]
- [React Native][TutorialReactNative]
- [Plain JavaScript][TutorialJavaScript]
- [Working with Command Line Tool][CLI]

### Plugins

- [SWC Plugin][SWCPlugin]
- [Vite Plugin][VitePlugin]
- [ESLint Plugin](ESLintPlugin)

If you're a react-intl user, check out [a comparison of react-intl and Lingui](https://lingui.dev/misc/react-intl).
- [React](https://lingui.dev/tutorials/react)
- [React Server Components](https://lingui.dev/tutorials/react-rsc)
- [React Native](https://lingui.dev/tutorials/react-native)
- [JavaScript](https://lingui.dev/tutorials/javascript)

## Example

Short example how i18n looks with JSX:

```js
import { Trans } from "@lingui/macro"
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>
<Trans id="msg.docs" /* id is optional */>
Read the <a href="https://lingui.dev">documentation</a>
for more info.
</Trans>
)
}
```
Expand All @@ -95,14 +73,14 @@ msgid "msg.docs"
msgstr "Read the <0>documentation</0> for more info."
```

For more example see the [Examples][Examples] directory.
For more example see the [Examples](https://github.com/lingui/js-lingui/tree/main/examples) directory.

## Support

If you are having issues, please let us know.

- Join us on [Discord](https://discord.gg/gFWwAYnMtA) to chat with the community.
- Ask questions on [StackOverflow](https://stackoverflow.com/questions/ask?tags=linguijs) and mark it with [Lingui](https://stackoverflow.com/questions/tagged/linguijs) tag.
- Join us on [Discord][Discord] to chat with the community.
- Ask questions on [StackOverflow](https://stackoverflow.com/questions/ask?tags=linguijs) and mark it with the [`linguijs`](https://stackoverflow.com/questions/tagged/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][Issues].
- You can also [Ask Lingui JS Guru](https://gurubase.io/g/lingui-js), it is a Lingui JS focused AI to answer your questions.

Expand All @@ -124,31 +102,16 @@ This project exists thanks to [all the people][Contributors] who contribute. [[C
The project is licensed under the [MIT][License] license.

[Documentation]: https://lingui.dev
[TutorialReact]: https://lingui.dev/tutorials/react
[TutorialReactNative]: https://lingui.dev/tutorials/react-native
[TutorialJavaScript]: https://lingui.dev/tutorials/javascript
[CLI]: https://lingui.dev/ref/cli
[TutorialSetupReact]: https://lingui.dev/tutorials/setup-react
[SetupVite]: https://lingui.dev/tutorials/setup-vite
[RefCLI]: https://lingui.dev/ref/cli
[Examples]: https://github.com/lingui/js-lingui/tree/main/examples

[SWCPlugin]: https://lingui.dev/ref/swc-plugin
[VitePlugin]: https://lingui.dev/ref/vite-plugin
[ESLintPlugin]: https://lingui.dev/ref/eslint-plugin

[Badge-MainSuite-GithubCI]: https://github.com/lingui/js-lingui/workflows/main-suite/badge.svg
[Badge-ReleaseWorkflowTesting-GithubCI]: https://github.com/lingui/js-lingui/workflows/release-workflow-test/badge.svg
[Badge-Coverage]: https://img.shields.io/codecov/c/github/lingui/js-lingui/main.svg
[Badge-PRWelcome]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[Badge-Discord]: https://img.shields.io/discord/974702239358783608.svg?label=Discord&logo=Discord&colorB=7289da&style=flat-square
[Contributors]: https://github.com/lingui/js-lingui/graphs/contributors

[Coverage]: https://codecov.io/gh/lingui/js-lingui
[License]: https://github.com/lingui/js-lingui/blob/main/LICENSE
[Contributing]: https://github.com/lingui/js-lingui/blob/main/CONTRIBUTING.md
[Issues]: https://github.com/lingui/js-lingui/issues/new/choose
[PRWelcome]: http://makeapullrequest.com
[BundleReact]: https://bundlephobia.com/result?p=@lingui/react
[BundleCore]: https://bundlephobia.com/result?p=@lingui/core
[Discord]: https://discord.gg/gFWwAYnMtA
5 changes: 2 additions & 3 deletions examples/create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@
]
},
"devDependencies": {
"@lingui/cli": "^4.1.2",
"@lingui/loader": "^4.1.2",
"@lingui/macro": "^4.1.2",
"@lingui/cli": "^4.11.2",
"@lingui/loader": "^4.11.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
Expand Down
5 changes: 2 additions & 3 deletions examples/create-react-app/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import React from "react"
import { getByText, render, act } from "@testing-library/react"
import { i18n } from "@lingui/core"
import { I18nProvider } from "@lingui/react"

import App from "./App"

i18n.load({
en: {
ZXBDaP: "Language switcher example:",
"zg/nOF": "Language switcher example: ",
},
cs: {
ZXBDaP: "Příklad přepínače jazyků:",
"zg/nOF": "Příklad přepínače jazyků: ",
},
})

Expand Down
2 changes: 1 addition & 1 deletion examples/create-react-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "./App.css"
import React, { useState } from "react"
import { Trans, Plural } from "@lingui/macro"
import { Trans, Plural } from "@lingui/react/macro"

import { locales, dynamicActivate } from "./i18n"
import { useLingui } from "@lingui/react"
Expand Down
26 changes: 13 additions & 13 deletions examples/create-react-app/src/locales/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#: src/App.tsx:31
#: src/App.tsx:43
msgid "{count, plural, zero {There are no books} one {There's one book} other {There are # books}}"
msgstr "{count, plural, zero {Nejsou žádné knihy} one {Je tu jedna kniha} other {Existuje # knih}}"

#: src/App.tsx:37
#: src/App.tsx:50
msgid "Date formatter example:"
msgstr "Příklad formátovače data:"

#: src/App.tsx:28
#: src/App.tsx:40
msgid "Decrement"
msgstr "Úbytek"

#: src/App.tsx:45
#: src/App.tsx:59
msgid "I have a balance of {0}"
msgstr "Mám zůstatek {0}"

#: src/App.tsx:25
#: src/App.tsx:37
msgid "Increment"
msgstr "Přírůstek"

#: src/App.tsx:14
msgid "Language switcher example:"
msgstr "Příklad přepínače jazyků:"
#: src/App.tsx:19
msgid "Language switcher example: "
msgstr "Příklad přepínače jazyků: "

#: src/App.tsx:43
#: src/App.tsx:56
msgid "Number formatter example:"
msgstr "Příklad formátovače čísel:"

#: src/App.tsx:22
msgid "Plurals example:"
msgstr "Příklad množného čísla:"
#: src/App.tsx:33
msgid "Plurals example: "
msgstr "Příklad množného čísla: "

#: src/App.tsx:39
#: src/App.tsx:53
msgid "Today is {0}"
msgstr "Dnes je {0}"
26 changes: 13 additions & 13 deletions examples/create-react-app/src/locales/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,38 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"

#: src/App.tsx:31
#: src/App.tsx:43
msgid "{count, plural, zero {There are no books} one {There's one book} other {There are # books}}"
msgstr "{count, plural, zero {There are no books} one {There's one book} other {There are # books}}"

#: src/App.tsx:37
#: src/App.tsx:50
msgid "Date formatter example:"
msgstr "Date formatter example:"

#: src/App.tsx:28
#: src/App.tsx:40
msgid "Decrement"
msgstr "Decrement"

#: src/App.tsx:45
#: src/App.tsx:59
msgid "I have a balance of {0}"
msgstr "I have a balance of {0}"

#: src/App.tsx:25
#: src/App.tsx:37
msgid "Increment"
msgstr "Increment"

#: src/App.tsx:14
msgid "Language switcher example:"
msgstr "Language switcher example:"
#: src/App.tsx:19
msgid "Language switcher example: "
msgstr "Language switcher example: "

#: src/App.tsx:43
#: src/App.tsx:56
msgid "Number formatter example:"
msgstr "Number formatter example:"

#: src/App.tsx:22
msgid "Plurals example:"
msgstr "Plurals example:"
#: src/App.tsx:33
msgid "Plurals example: "
msgstr "Plurals example: "

#: src/App.tsx:39
#: src/App.tsx:53
msgid "Today is {0}"
msgstr "Today is {0}"
Loading

0 comments on commit 14fa4d7

Please sign in to comment.