- First, create a
docs
folder for your GitHub project to store documentation in different language versions. - Create two subfolders within the
docs
folder: one for English documentation (en
) and another for Chinese documentation (zh
). In each of these folders, create a README file for the respective language, such asREADME-en.md
andREADME-zh.md
. - In the root directory of the project, create a default
README.md
file to display the main information of the project and provide links to switch between languages. Add the following code at the beginning of the file:
[English](./docs/en/README-en.md) | [中文](./docs/zh/README-zh.md)
This code will create two links, one for English and one for Chinese documentation. You can adjust the link text and file paths as needed.
- In the beginning of the English documentation file
README-en.md
, add similar switch links:
[English](./README-en.md) | [中文](../zh/README-zh.md)
In the beginning of the Chinese documentation file README-zh.md
, add:
[English](../en/README-en.md) | [中文](./README-zh.md)
- Next, you need to add the project introduction and usage instructions in the respective language to
README-en.md
andREADME-zh.md
.
After completing these steps, users will be able to switch between English and Chinese documentation by clicking on the corresponding links.