|
|
@@ -1,27 +1,24 @@
|
|
|
----
|
|
|
-id: versioning
|
|
|
-title: Versioning
|
|
|
----
|
|
|
+# 版本化
|
|
|
|
|
|
-You can use the `version` script to cut a new documentation version based on the latest content in the `docs` folder. That specific set of documentation will then be preserved and accessible even as the documentation in the `docs` folder changes moving forward.
|
|
|
+您可以使用 `version` 脚本根据 `docs` 文件夹中的最新内容来剪切新的文档版本。 即使 `docs` 文件夹中的文档发生变化,该特定的文档集也将保留并可访问。
|
|
|
|
|
|
-## How to Create New Versions
|
|
|
+## 如何创建新版本
|
|
|
|
|
|
-Run the following script to generate a starter versions page listing all the site versions:
|
|
|
+运行以下脚本以生成并列出所有网站版本的初始版本页面:
|
|
|
|
|
|
```
|
|
|
yarn examples versions
|
|
|
```
|
|
|
|
|
|
-This creates the following file:
|
|
|
+这将创建以下文件:
|
|
|
|
|
|
```
|
|
|
pages/en/versions.js
|
|
|
```
|
|
|
|
|
|
-You can edit this file later on to customize how you display the versions.
|
|
|
+您稍后可以编辑此文件以自定义如何显示版本。
|
|
|
|
|
|
-Add the following script to your `package.json` file if it doesn't already exist:
|
|
|
+如果脚本不存在,请将以下脚本添加到 `package.json` 文件中:
|
|
|
|
|
|
```json
|
|
|
...
|
|
|
@@ -31,45 +28,45 @@ Add the following script to your `package.json` file if it doesn't already exist
|
|
|
...
|
|
|
```
|
|
|
|
|
|
-Run the script with a command line argument of the version you wish to create. e.g.,
|
|
|
+用您希望创建的版本的命令行参数运行脚本。 例如:
|
|
|
|
|
|
```bash
|
|
|
yarn run version 1.0.0
|
|
|
```
|
|
|
|
|
|
-This will preserve all documents currently in the `docs` folder and make them available as documentation for version `1.0.0`.
|
|
|
+这将保留当前在 `docs` 文件夹中的所有文档,并使它们作为版本 `1.0.0` 的文档提供。
|
|
|
|
|
|
-If, for example, you ran the version script with 1.0.0 as the version number, version 1.0.0 is considered the latest release version for your project. The site will display the version number next to the title in the header. This version number links to a versions page that you created earlier.
|
|
|
+例如,如果您使用1.0.0作为版本号运行版本脚本,则版本1.0.0将被视为您项目的最新版本。 该站点将显示标题旁标题的版本号。 此版本号链接到您之前创建的版本页面。
|
|
|
|
|
|
-Documents in the `docs` folder will be considered part of version `next` and they are available, for example, at the url `docs/next/doc1.html`. Documents from the latest version use the url `docs/doc1.html`.
|
|
|
+`docs` 文件夹中的文档将被认为是 `next` 版本的一部分,并使它们可用。例如在 URL `docs/next/doc1.html` 处,最新版本的文档使用 url `docs/doc1.html`。
|
|
|
|
|
|
-Running the script again with `yarn run version 2.0.0` will create a version `2.0.0`, making version 2.0.0 the most recent set of documentation. Documents from version `1.0.0` will use the url `docs/1.0.0/doc1.html` while `2.0.0` will use `docs/doc1.html`.
|
|
|
+用 `yarn run version 2.0.0` 再次运行脚本将会创建一个 `2.0.0` 版本,使得2.0.0版本成为最新版本的文档。 来自`1.0.0`版本的文档将使用 URL `docs/1.0.0/doc1.html`,而 `2.0.0` 将使用 `docs/doc1.html`。
|
|
|
|
|
|
-## Versioning Patterns
|
|
|
+## 版本化模式
|
|
|
|
|
|
-You can create version numbers in whatever format you wish, and a new version can be created with any version number as long as it does not match an existing version. Version ordering is determined by the order in which versions are created, independently of how they are numbered.
|
|
|
+您可以以任何您想要的格式创建版本号,只要与现有版本不匹配,就可以使用任何版本号创建新版本。 版本排序由创建版本的顺序决定,与编号的方式无关。
|
|
|
|
|
|
-## Storing Files for Each Version
|
|
|
+## 存储每个版本的文件
|
|
|
|
|
|
-Versioned documents are placed into `website/versioned_docs/version-${version}`, where `${version}` is the version number you supplied the `version` script.
|
|
|
+版本化的文档被放置在 `website/versioned_docs/version-${version}` 中,其中 `${version}` 是你提供 `version` 脚本的版本号。
|
|
|
|
|
|
-The markdown header for each versioned doc is altered by renaming the id frontmatter field to `original_id`, then using `"version-${version}-${original_id}"` as the value for the actual `id` field.
|
|
|
+每个版本化文档的 markdown 标题都会通过将 id frontmatter 字段重命名为 `original_id`,然后使用 `"version-${version}-${original_id}"` 作为实际的 `id` 字段的值来更改。
|
|
|
|
|
|
-Versioned sidebars are copied into `website/versioned_sidebars` and are named as `version-${version}-sidebars.json`.
|
|
|
+版本化的边栏被复制到 `website/versioned_sidebars` 中,并被命名为 `version-${version}-sidebars.json`。
|
|
|
|
|
|
-A `website/versions.json` file is created the first time you cut a version and is used by Docusaurus to detect what versions exist. Each time a new version is added, it gets added to the `versions.json` file.
|
|
|
+一个 `website/versions.json` 文件是在您第一次剪切版本时创建的,并被 Docusaurus 用来检测存在的版本。 每次添加新版本时,都会将其添加到 `versions.json` 文件中。
|
|
|
|
|
|
-If you wish to change the documentation for a past version, you can access the files for that respective version.
|
|
|
+如果您希望更改以前版本的文档,则可以访问相应版本的文件。
|
|
|
|
|
|
-## Fallback Functionality
|
|
|
+## 回退功能
|
|
|
|
|
|
-Only files in the `docs` folder and sidebar files that differ from those of the latest version will get copied each time a new version is specified. If there is no change across versions, Docusaurus will use the file from the latest version with that file.
|
|
|
+每次指定新版本时,只有 `docs` 文件夹和侧边栏文件中与最新版本文件不同的文件才会被复制。 如果版本之间没有变化,Docusaurus 将使用该文件的最新版本的文件。
|
|
|
|
|
|
-For example, a document with the original id `doc1` exists for the latest version, `1.0.0`, and has the same content as the document with the id `doc1` in the `docs` folder. When a new version `2.0.0` is created, the file for `doc1` will not be copied into `versioned_docs/version-2.0.0/`. There will still be a page for `docs/2.0.0/doc1.html`, but it will use the file from version `1.0.0`.
|
|
|
+例如,具有原始 id `doc1` 的文档存在于最新版本 `1.0.0` 中,并且具有与 `docs` 文件夹中具有id `doc1` 的文档相同的内容。 当创建一个新版本 `2.0.0` 时,`doc1` 文件不会被复制到 `versioned_docs/version-2.0.0/` 中。 仍然会有一个 `docs/2.0.0/doc1.html` 的页面,但它将使用版本为 `1.0.0` 的文件。
|
|
|
|
|
|
-## Renaming Existing Versions
|
|
|
+## 重命名现有版本
|
|
|
|
|
|
-To rename an existing version number to something else, first make sure the following script is in your `package.json` file:
|
|
|
+要将现有版本号重命名为其他内容,请首先确保以下脚本位于 `package.json` 文件中:
|
|
|
|
|
|
```json
|
|
|
...
|
|
|
@@ -79,12 +76,12 @@ To rename an existing version number to something else, first make sure the foll
|
|
|
...
|
|
|
```
|
|
|
|
|
|
-Run the script with command line arguments of first, the current version name, then second, the new version name. e.g.,
|
|
|
+使用命令行参数运行脚本,当前版本名称,然后是新版本名称。 例如:
|
|
|
|
|
|
```bash
|
|
|
yarn run rename-version 1.0.0 1.0.1
|
|
|
```
|
|
|
|
|
|
-## Versioning and Translations
|
|
|
+## 版本化和翻译
|
|
|
|
|
|
-If you wish to use versioning and translations features, the `crowdin.yaml` file should be set up to upload and download versioned documents to and from Crowdin for translation. Translated, versioned files will go into the folder `translated_docs/${language}/version-${version}/`. For more information, check out the [translations guide](guides-translation.md).
|
|
|
+如果你想使用版本化和翻译功能,应该设置 `crowdin.yaml` 文件来上传和下载来自 Crowdin 的版本化文档以进行翻译。 翻译后的版本化文件将进入文件夹`translated_docs/${language}/version-${version}/`。 有关更多信息,请查看[翻译指南](guides-translation.md)。
|