Skip to content

showyourlucky/open-web-ui-docs-zh

 
 

Repository files navigation

翻译步骤

大致流程

1. 配置:在 docusaurus.config.js 中声明默认语言环境和替代语言环境

	i18n: {
		defaultLocale: "zh-CN",
		locales: ["en", "zh-CN"],
		localeConfigs: {
			en: {
				label: "English",
			},
			"zh-CN": {
				label: "简体中文",
			},
		},
	}

2. 翻译:将翻译文件放在正确的文件系统位置

部署项目

执行
yarn
yarn run start --locale zh-CN

1. 翻译React 代码和插件数据

执行
yarn write-translations --locale zh-CN
翻译
i18n\zh-CN\code.json

JSON 用于翻译:

  • React 代码:src/pages 中的独立 React 页面或其他组件
  • 通过 themeConfig 提供的布局标签:导航栏、页脚
  • 通过插件选项提供的布局标签:文档侧边栏类别标签、博客侧边栏标题...

2. Markdown 文件

  1. 创建目录
mkdir -p i18n/zh-CN/docusaurus-plugin-content-docs/current
mkdir -p i18n/zh-CN/docusaurus-plugin-content-blog
  1. 复制文件
cp -r docs/** i18n/zh-CN/docusaurus-plugin-content-docs/current
cp -r blog/** i18n/zh-CN/docusaurus-plugin-content-blog
  1. 翻译json文件的内容
i18n\zh-CN\docusaurus-plugin-content-docs\current.json
i18n\zh-CN\code.json
  1. 翻译md, mdx文件
node .\i18n\translate-docs.js

i18n\zh-CN\docusaurus-plugin-content-docs\current\getting-started\advanced-topics\env-configuration.md , 文件比较大, 优先手动翻译
  1. 使用显式标题 ID(可选)
yarn write-heading-ids i18n/zh-CN/docusaurus-plugin-content-docs/current
  1. 增加搜索功能
添加依赖
yarn add docusaurus-lunr-search
yarn add @node-rs/jieba
构建
yarn add docusaurus-lunr-search
运行
serve build

Website

This website is built using Docusaurus, a modern static website generator.

Installation

npm ci

Local Development

npm start

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

Build

npm run build

This command generates static content into the build directory and can be served using any static contents hosting service.

Deployment

Using SSH:

USE_SSH=true npm run deploy

Not using SSH:

GIT_USER=<Your GitHub username> npm run deploy

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the gh-pages branch.

About

官方文档:https://docs.openwebui.com 本项目是openwebui官方文档的中文翻译, 国际为zh_CN

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • MDX 86.1%
  • CSS 6.5%
  • TypeScript 4.7%
  • Python 2.2%
  • JavaScript 0.5%