Skip to main content

Overview

This guide shows how to integrate Unlingo with Next.js applications using next-intl.

Prerequisites

  • Next.js 13+ application
  • Basic knowledge of Next.js
  • An Unlingo project with translations

Installation

Install the required dependencies:

Project Structure

Set up your Next.js project structure for internationalization:

Routing Configuration

Configure your locales and routing:

Request Configuration

Create a request configuration that fetches translations from Unlingo:

Environment Variables

Add your Unlingo credentials to your environment file:
.env.local

Middleware Configuration

Set up middleware to handle locale detection and routing:

Next.js Configuration

Update your next.config.js to include the internationalization plugin:

Root Layout

Set up the root layout:

Locale Layout

Create a layout for your localized pages:

Using Translations in Server Components

Basic Usage

With Interpolation

Using Translations in Client Components

For client components, use the useTranslations hook:

Advanced Features

Multiple Namespaces

Configure multiple namespaces in your request configuration:

Next Steps

i18next

Integrate applications using i18next

Get Translation

Explore the API reference