🌍📖 A readable, automated, and optimized (3 kb) internationalization for JavaScript
Documentation · Quickstart · Example
This project is an example of integration of Lingui with Next.js. It uses Next.js version 13.3.1 and Lingui version 4.2.0.
The purpose of this project is to test the integration of Lingui, a translation framework, with Next.js, a JavaScript framework based on React for web application development.
- Translation of text within the application using Lingui.
- Utilization of ROME as the linter and formatter to maintain code quality.
- Usage of Yarn Berry with hardlinks-local and nodeLinker node-modules to manage dependencies.
Before starting, make sure you have the following installed on your system:
- Node.js (version >=16.14.0)
- Yarn (version 3.5.1)
- Clone this GitHub repository to your local machine:
git clone https://github.com/votre-utilisateur/nom-du-repo.git
- Navigate to the project directory:
cd name-of-repo
- Install the project dependencies using Yarn:
yarn install
To configure Lingui, you need to follow these steps:
-
Create a
.env
file at the root of the project and add the necessary environment variables. Refer to the.env.example
file for the required variables. -
Modify the Lingui configuration files (
lingui.config.js
andnext.config.js
) to adjust the settings to your project.
To launch the application in development mode, run the following command:
yarn dev
This starts the Next.js development server, and you can access the application in your browser at the address http://localhost:3000
.
To generate an optimized version of the application for production, run the following command:
yarn build
This generates the application's build in the .next
directory, ready to be deployed to a server.
To run tests, use the following command:
yarn test
This project uses Yarn Berry with the features of hardlinks-local and nodeLinker node-modules to manage dependencies efficiently and optimally.
Yarn Berry is an enhanced version of Yarn that brings new features and improved performance. It replaces Yarn's traditional package manager with a new architecture based on Plug'n'Play (PnP). This enables faster, lighter, and deterministic dependency management.
Yarn Berry offers several advantages:
-
Faster dependency management: With the PnP architecture, Yarn Berry avoids costly dependency installations and resolutions, resulting in faster build and startup times for your application.
-
Deterministic dependency resolution: Yarn Berry ensures installation reproducibility by using a dependency resolution algorithm based on strict rules. This means each team member gets exactly the same dependency versions during installation.
-
Simplified version management: Yarn Berry makes it easy to update and lock dependency versions through simple commands and built-in tools.
This project uses Rome as the linter and formatter to maintain code quality. Rome is a development tool for JavaScript and TypeScript that provides advanced static analysis, linting, and formatting features.
Rome is an integrated toolchain for JavaScript and TypeScript development. It offers a modern approach to project management, providing features such as linting, formatting, compilation, and more.