Overview
This is basically what the CLI does:
- The CLI will search for all the JSON files in the
locales
directory. - It will then create TypeScript functions for each translation key.
- 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.