Languages
This module allows you to manage multiple languages.
Adding language
Define language in Directus
- Navigate to Content > Configuration > Languages.
- Create new item and fill required fields.
- Save item.
Add language in Nuxt
INFO
Without adding support in Nuxt you won't be able to see changes done in Directus
- Open nuxt.config.ts
- In
i18n.locales
add new entry in arrayts{ code: "[language-code]", files: ["[language-code].json", "cmsTranslations.ts"], isCatchallLocale: "[language-code]" === process.env.NUXT_DEFAULT_LOCALE_CODE, name: "[language-name]", }
- In
/i18n/locales
add new file[language-code].json
. This file will be merged with translations from CMS. - That's it 🎉.
Editing language
As you've already saw you cannot edit language as this can cause some unexpected errors. If you've made typo, remove wrong language and create new one.
Remove language
Remove language in Directus
- Navigate to Content > Configuration > Languages.
- Open language you wish to delete.
- Click trash icon.
DANGER
This will remove all your content that was setup for this language. This action can't be undone.
Remove language in Nuxt
- Open nuxt.config.ts.
- In
i18n.locales
remove entry with language that you would like to remove. - In
/i18n/locales
remove file with your language. - That's it 🎉.