mirror of
https://gitea.com/gitea/docs.git
synced 2026-06-28 07:04:40 +00:00
Add Chinese support (#13)
# Main changes and Some notices - Chines Docs should be put into corresponding versions' folders under `i18n/zh-cn/docusaurus-plugin-content-docs`. See [translate-markdown-files](https://docusaurus.io/docs/i18n/tutorial#translate-markdown-files) for reference. And also [srs-docs](https://github.com/ossrs/srs-docs) is a project that can be used as a reference. So changed the related paths in `loop_docs*` scripts. - The markdown files under `docs/<version>` and `i18n/zh-cn/docusaurus-plugin-content-docs/<version>` must have the same name to be referred as translated. Files inside docs are corresponding to `current` version. For example, `docs/administration/mail-templates.md` and `i18n/zh-cn/docusaurus-plugin-content-docs/current/administration/mail-templates.md`. Filename of `mail-templates.md` must be the same (cannot be `mail-templates.zh-cn.md` and `mail-templates.us-en.md`) So trim the `.en-us.md` and `.zh-cn.md` to `.md` to ensure the same names inside `loop_docs*` scripts. - Used `npx docusaurus write-translations --locale zh-cn` to do sidebar, footer, and header translations, so no need to keep `sideBarCN` anymore. [reference](https://docusaurus.io/docs/cli#docusaurus-write-translations-sitedir) - Local Tests for `en` and `zh-cn` are separeted, run the following on local respectly to test them ```bash # test en version npm run start # test zh-cn version npm run start -- --locale zh-cn ``` - If wants to test `en` and `zh-cn` both at the same time, run build and serve ``` npm run build npm run serve ``` - Added some indexed page, for example:   Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/13 Co-authored-by: HesterG <hestergong@gmail.com> Co-committed-by: HesterG <hestergong@gmail.com>
This commit is contained in:
131
sidebars.js
131
sidebars.js
@@ -1,146 +1,87 @@
|
||||
module.exports = {
|
||||
defaultSidebar: [
|
||||
docs: [
|
||||
{
|
||||
type: 'link',
|
||||
type: 'doc',
|
||||
id: 'intro',
|
||||
label: 'What is Gitea?',
|
||||
href: '/next/'
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Installation',
|
||||
link: {
|
||||
"type": "generated-index"
|
||||
},
|
||||
items: [
|
||||
{
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'installation',
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Administration',
|
||||
link: {
|
||||
"type": "generated-index"
|
||||
},
|
||||
items: [
|
||||
{
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'administration',
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Usage',
|
||||
link: {
|
||||
"type": "generated-index"
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'usage',
|
||||
}
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'usage',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Development',
|
||||
link: {
|
||||
"type": "generated-index"
|
||||
},
|
||||
items: [
|
||||
{
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'development',
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Contributing',
|
||||
link: {
|
||||
"type": "generated-index"
|
||||
},
|
||||
items: [
|
||||
{
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'contributing',
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Help',
|
||||
link: {
|
||||
"type": "generated-index"
|
||||
},
|
||||
items: [
|
||||
{
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'help',
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
]/*,
|
||||
siderBarCN: [
|
||||
{
|
||||
type: 'link',
|
||||
label: 'Gitea是什么?',
|
||||
href: 'zh-cn/next/'
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: '安装',
|
||||
items: [
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'zh-cn/installation',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: '管理',
|
||||
items: [
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'zh-cn/administration',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: '使用',
|
||||
items: [
|
||||
{
|
||||
type: 'category',
|
||||
label: '软件包管理',
|
||||
items: [
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'zh-cn/usage/packages',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'zh-cn/usage',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: '开发',
|
||||
items: [
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'zh-cn/development',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: '贡献',
|
||||
items: [
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'zh-cn/contributing',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: '帮助',
|
||||
items: [
|
||||
{
|
||||
type: 'autogenerated',
|
||||
dirName: 'zh-cn/help',
|
||||
}
|
||||
]
|
||||
},
|
||||
],*/
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user