国际化支持
幻梦主题内置完整的国际化支持,默认提供中文和英文翻译。
翻译文件
所有用户可见的文本都集中在 i18n/ 目录下的 YAML 文件中:
# i18n/zh-CN.yaml
sitetitle:
other: "爱则心痛 · azxt"
hometitle:
other: "首页"
searchtitle:
other: "搜索"
readmore:
other: "阅读全文"
在模板中使用
<button aria-label="{{ i18n "searchtitle" }}">
<i class="fas fa-search"></i>
</button>
添加新语言
只需创建新的翻译文件即可添加语言支持。例如添加日语支持:
# i18n/ja-JP.yaml
sitetitle:
other: "愛則心痛 · azxt"
searchtitle:
other: "検索"
主题配置
defaultContentLanguage = 'zh'
defaultContentLanguageInSubdir = false
国际化设计让幻梦主题可以轻松服务于多语言受众。