多语言配置
约 1095 字大约 4 分钟
2024-03-02
这些选项用于配置与语言相关的文本。
如果你的站点是以非内置语言支持以外的其他语言提供服务的,你应该为每个语言设置这些选项来提供翻译。
内置语言支持
主题内置了以下语言支持,包括:
- 简体中文 (
zh-CN) -/zh/ - 繁体中文 (
zh-TW) -/zh-tw/ - 英语 (
en-US) -/en/ - 法语 (
fr-FR) -/fr/ - 德语 (
de-DE) -/de/ - 俄语 (
ru-RU) -/ru/ - 日语 (
ja-JP) -/ja/ - 韩语 (
ko-KR) -/ko/
配置
您应该将配置写入到 theme.locales 中。
您可以在 .vuepress/config.ts ,或者在 .vuepress/plume.config.ts 中进行配置:
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
locales: {
// 非内置语言的语言代码
'/xxx/': {
// 语言配置
}
}
})
})import { defineThemeConfig } from 'vuepress-theme-plume'
export default defineThemeConfig({
locales: {
// 非内置语言的语言代码
'/xxx/': {
// 语言配置
}
}
})详细配置方法请参考:国际化
appearanceText
- 类型:
string - 默认值:
'Appearance' - 详情: 导航栏中的主题切换按钮的文本。
selectLanguageName
类型:
string默认值:
''详情:
Locale 的语言名称。
该配置项 仅能在主题配置的 locales 的内部生效 。它将被用作 locale 的语言名称,展示在 选择语言菜单 内。
selectLanguageText
类型:
string默认值:
''详情:
选择语言菜单 的文本。
如果你在站点配置中设置了多个 locales ,那么 选择语言菜单 就会显示在导航栏中仓库按钮的旁边。
selectLanguageAriaLabel
类型:
string默认值:
''详情:
选择语言菜单 的
aria-label属性。它主要是为了站点的可访问性 (a11y) 。
homeText
类型:
string默认值:
'Home'详情: 主页链接的文本。
- 主题默认导航栏中的首页链接的文本。
- 面包屑导航中的首页链接的文本。
postsText
类型:
string默认值:
'Posts'详情: 文章列表页链接的文本。
- 主题默认导航栏中的文章列表页链接的文本。
- 面包屑导航中的文章列表页链接的文本。
tagText
类型:
string默认值:
'Tags'详情: 标签链接的文本。
- 主题默认导航栏中的标签链接的文本。
- 博客页中的标签链接的文本。
- 博客标签页中的标题。
categoryText
类型:
string默认值:
'Categories'详情: 分类链接的文本。
- 主题默认导航栏中的分类链接的文本。
- 博客页中的分类链接的文本。
- 博客分类页中的标题。
archiveText
类型:
string默认值:
'Archives'详情: 归档链接的文本。
- 主题默认导航栏中的归档链接的文本。
- 博客页中的归档链接的文本。
- 博客归档页中的标题。
archiveTotalText
- 类型:
string - 默认值:
'{count} articles' - 详情: 归档页中的总文章数的文本。
sidebarMenuLabel
类型:
string默认值:
'Menu'详情:
移动设备下的导航栏中 菜单选项的文本。
returnToTopLabel
类型:
string默认值:
'return to top'详情:
移动设备下的导航栏中返回顶部的文本。
outlineLabel
类型:
string默认值:
'On this page'详情:
移动设备下的导航栏中大纲标题的文本
editLinkText
- 类型:
string - 默认值:
'Edit this page' - 详情: 编辑链接文本
latestUpdatedText
- 类型:
string - 默认值:
'Latest Updated' - 详情: 最近更新时间 的文本
contributorsText
- 类型:
string - 默认值:
'Contributors' - 详情: 贡献者的文本
changelogText
- 类型:
string - 默认值:
'Changelog' - 详情: 变更记录的文本
changelogOnText
- 类型:
string - 默认值:
'On' - 详情: 单次变更记录的时间文本
changelogButtonText
- 类型:
string - 默认值:
'View All Changelog' - 详情: 变更记录的按钮文本
copyrightText
- 类型:
string - 默认值:
'Copyright' - 详情: 版权所有的文本
copyrightAuthorText
- 类型:
string - 默认值:
'Copyright Ownership:' - 详情: 版权所有者的文本
copyrightCreationOriginalText
- 类型:
string - 默认值:
'This article link:' - 详情: 本文链接的文本
copyrightCreationTranslateText
- 类型:
string - 默认值:
'This article translated from:' - 详情: 本文翻译的文本
copyrightCreationReprintText
- 类型:
string - 默认值:
'This article reprint from:' - 详情: 本文转载的文本
copyrightLicenseText
- 类型:
string - 默认值:
'License under:' - 详情: 版权许可证的文本
prevPageLabel
- 类型:
string - 默认值:
'Previous Page' - 详情: 上一页的文本
nextPageLabel
- 类型:
string - 默认值:
'Next Page' - 详情: 下一页的文本
notFound
- 类型:
NotFound | undefined - 默认值:
undefined - 详情: 404 页面配置
interface NotFound {
code?: string
title?: string
quote?: string
linkLabel?: string
linkText?: string
}贡献者
更新日志
4d236-feat(theme)!: add collections support (#704)于74dfa-docs: enable twoslash for code block于0fd6c-refactor(theme): improve types and flat config (#524)于e727f-docs: update docs于9906f-feat(theme): improve locales (#366)于0c53b-docs: improve docs (#332)于0142f-docs: update doc于822d8-docs: lint fix md于ca097-docs: lint fix于c56ba-feat: 全新的文档!于
