Skip to content

Translation

Bartosz Sułkowski edited this page Nov 29, 2024 · 1 revision

Tip

We're covering you how to change translation in /setup process!

Note

To handle all texts, library next-intl was used

All texts used in this project (without /setup page) are saved in a translation file to personalise the app easily. In default, you can find the translation file in messages/pl.json

Change app language code

  1. Go to i18n/request.ts and change locale variable
import { getRequestConfig } from 'next-intl/server'

export default getRequestConfig(async () => {
-    const locale = 'pl'
+    const locale = 'en'

    return {
        locale,
        messages: (await import (`@/messages/${locale}.json`)).default
    }
})
  1. Change the file name from messages/pl.json to your language code

Warning

Project supports only one language (it means, there's no translation option for the user aka. no i18n routing).

❗ Known issues

App won't build at first setup, because of translation

Check if you have language file in the correct path. If file doesn't exist, project probably won't build.

Clone this wiki locally