Skip to content

next-intl

next-intl lets a Next.js app show translated messages and format dates, numbers and quantities for the selected locale.

Visit next-intl

How does a Next.js screen choose the right messages?

In a Next.js App Router project, give next-intl the locale and its messages for the current request. A locale is a language and sometimes a region, such as US English or German for Germany. Your screen uses a stable message name to look up the right text.

You can keep message files in your project. For a language in the URL, set up locale-based routing and check how someone switches language without losing the page they were on.

What happens to numbers, dates and quantities?

Give the formatter the actual number or date and choose how to display it. For example, a decimal can appear as 12.5 in US English and 12,5 in German. A date formatter also needs the right time zone when the time matters.

Use a complete message for the quantity. Let the message select the form for one seat or several seats. A currency format changes how a price appears. Choosing another language does not convert the amount.

What if the German message is missing?

By default, next-intl can show the message name when it cannot resolve the text. It documents ways to customize that result. Decide which important labels must be present before release and what readable fallback visitors should see for a missing label.

For a booking error, either supply the reviewed translation or show an approved fallback that still tells the visitor what they can do. Catch the gap before people see an internal key.

How can you sketch both versions of one screen?

Draw an English and a German booking confirmation on paper. Give both the same test date, price and seat counts. Keep the locale and booking time zone explicit.

  1. Follow the same message name
    Write the confirmation heading in both boxes. Cross out the German heading and write the exact fallback you expect people to see.
  2. Check two quantities
    Write what the count of one and the count of two should say in each language. Ask a reader of each language to check the complete sentence if you take the exercise further.
  3. Keep the message files
    Keep both locale files and the rule for choosing the locale with the project. next-intl is MIT-licensed. A translation workflow or hosting service may have separate costs.