This repo showcases an example of integrating the Linguijs library with Next.js 14 appdir and React Server Components for building multilingual applications.
- Full Integration of Linguijs with Next.js 14 appdir
- Linguijs
- Next.js 14
- React Server Components
For this example, we use the follow versions :
"dependencies": {
"@lingui/cli": "4.8.0",
"@lingui/core": "4.8.0",
"@lingui/react": "4.8.0",
"next": "14.1.0"
},
"devDependencies": {
"@lingui/cli": "4.8.0",
"@lingui/loader": "4.8.0",
"@lingui/macro": "4.8.0",
"@lingui/swc-plugin": "4.0.6"
}
SWC Plugin support is still experimental. Semver backwards compatibility between different next-swc
versions is not guaranteed.
Therefore, you need to select an appropriate version of the Lingui plugin to match compatible NextJs
version.
You also need to add the @lingui/swc-plugin
dependency with strict version without a range specifier.
{
"devDependencies": {
"@lingui/swc-plugin": "4.0.6"
}
}
For more information on compatibility, please refer to the Compatibility section.
- You should not have a babel config in the project, otherwise Next will turn off SWC compiler in favor of babel.
- The actual code is compiled with SWC + Lingui SWC plugin.
Node.js v16 or higher npm or yarn
git clone git@github.com:Clement-Muth/nextjs-appdir-linguijs-rsc.git
cd nextjs-appdir-linguijs-rsc
make up
Open your browser to http://localhost:3000/en.
Documentation Linguijs Documentation Next.js Documentation RSC
Try this repo and share your feedback with me! I would be delighted to receive your suggestions and contributions.
This repository is based on the Lingui's documentation