i18n.ts
Supported languages and the default language.
config/i18n.ts defines the site's supported languages and default language. The language switcher, page paths, localized text, multilingual SEO links, and the LanguageCode type all use this configuration.
languages
The language list must contain at least one entry, and each code must be unique. Uncommented objects are included in the list. Commented-out objects are alternative languages provided by the template and are included only after you uncomment them.
Prop
Type
The template provides the following language configurations. Only uncommented objects are included in the site's language list:
code | name | direction | Locale file |
|---|---|---|---|
en | English | ltr | locales/en.json |
es | Español | ltr | locales/es.json |
fr | Français | ltr | locales/fr.json |
de | Deutsch | ltr | locales/de.json |
it | Italiano | ltr | locales/it.json |
pt | Português | ltr | locales/pt.json |
ru | Русский | ltr | locales/ru.json |
ja | 日本語 | ltr | locales/ja.json |
ko | 한국어 | ltr | locales/ko.json |
zh-Hans | 简体中文 | ltr | locales/zh-Hans.json |
zh-Hant | 繁體中文 | ltr | locales/zh-Hant.json |
ar | العربية | rtl | locales/ar.json |
The template includes a JSON file for each language in the table, but some files are still empty placeholder objects. A file's existence does not mean its translations are complete. Complete and review the translations before enabling a language. To add another language, you also need to create locales/<code>.json. The LanguageCode type exported at the end of the configuration file includes only uncommented array entries. The template's default configuration produces this type:
type LanguageCode = 'en' | 'zh-Hans' | 'zh-Hant';defaultLanguage
Prop
Type
defaultLanguage must exactly match an entry in languages[].code. Page paths in the default language have no language prefix. Other languages use their code as the path prefix, such as /zh-Hans/docs.