Simple i18n NextSimple i18n Next

Overview

This is basically what the CLI does:

  1. The CLI will search for all the JSON files in the locales directory.
  2. It will then create TypeScript functions for each translation key.
  3. You use the generated functions in your components.

Example Directory Structure

locales/
|-- en/
|   |-- messages.json
|   |-- about.mdx
|   |-- client.json
|-- de/
|   |-- messages.json
|   |-- about.mdx
|   |-- client.json

In the example above, you provide two languages support, English (en) and German (de). Inside each language directory, you can have a default messages.json file that contains the translations for the language and other JSON files that contain translations for specific cases of your application. You can also have Markdown files that contain translations for specific cases of your application.