Languages
How the theme publishes more than one language, and how to switch the whole layer off.
What ships
English at /, Simplified Chinese at /zh/, Traditional Chinese at /zh-Hant/. Each language is a full set of routes, not a runtime translation.
yaml
i18n:
enabled: true
defaultLanguage: en # en | zh | zh-hant
languages: [en, zh, zh-hant]
detectBrowserLanguage: falseenabled: falseturns the layer off: other-language pages emitnoindexplus a redirect stub, and the switcher disappears.languagesdecides what is published; drop one and its routes are not offered by the switcher orhreflang.detectBrowserLanguagesends a first visit from a Chinese browser to/zh-Hant/(zh-TW/HK/MO) or/zh/. A manual pick is remembered and detection stops.
Adding a language
- Add an entry to
src/lib/langs.ts— key, prefix, BCP-47 tag, content suffix. - Create
src/i18n/locales/<key>.tswith the UI dictionary and add it tot(). - Mirror the pages under
src/pages/<prefix>/, passinglang. - Content collections follow the suffix:
posts/,posts-zh/,posts-zh-hant/.
hreflang is emitted only for pairs that really exist, so a Chinese-only article never claims an English twin.
Naming
Simplified is zh-Hans, Traditional is zh-Hant — never a region code like zh-TW, which is where a reader lives, not which script they read.