Add Chinese support #13

Merged
lunny merged 13 commits from HesterG/gitea-docusaurus:add-chinese-support into main 2023-05-26 06:30:14 +00:00
Member

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 for reference. And also 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

  • Local Tests for en and zh-cn are separeted, run the following on local respectly to test them

    # 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:

Screen Shot 2023-05-26 at 13.49.34

Screen Shot 2023-05-26 at 13.49.49

# 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: ![Screen Shot 2023-05-26 at 13.49.34](/attachments/9eeb3d38-c309-457d-9015-053b9c5ca8d6) ![Screen Shot 2023-05-26 at 13.49.49](/attachments/fc348d17-ce4c-4c4d-9240-b69add4ef06e)
HesterG added 1 commit 2023-05-24 10:44:05 +00:00
HesterG added 1 commit 2023-05-25 01:55:28 +00:00
HesterG added 1 commit 2023-05-25 05:49:37 +00:00
HesterG added 1 commit 2023-05-25 06:23:13 +00:00
HesterG added 1 commit 2023-05-25 06:52:58 +00:00
HesterG added 1 commit 2023-05-25 12:20:39 +00:00
HesterG added 1 commit 2023-05-25 12:22:12 +00:00
HesterG added 1 commit 2023-05-25 13:15:13 +00:00
HesterG added 1 commit 2023-05-25 13:22:51 +00:00
HesterG added 1 commit 2023-05-26 05:20:42 +00:00
HesterG changed title from WIP: Add Chinese support to Add Chinese support 2023-05-26 05:34:42 +00:00
wxiaoguang approved these changes 2023-05-26 05:50:17 +00:00
wxiaoguang left a comment
Member

that's pretty hacky

that's pretty hacky
HesterG added 1 commit 2023-05-26 06:14:24 +00:00
HesterG added 1 commit 2023-05-26 06:15:44 +00:00
HesterG added 1 commit 2023-05-26 06:29:21 +00:00
lunny merged commit 20c970682b into main 2023-05-26 06:30:14 +00:00
lunny referenced this issue from a commit 2023-05-26 06:30:14 +00:00
HesterG deleted branch add-chinese-support 2023-05-26 06:38:44 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/gitea-docusaurus#13
No description provided.