Browse Source

Translate api-commands

DemoPark 8 years ago
parent
commit
ca55ad11cf
1 changed files with 51 additions and 48 deletions
  1. 51 48
      docs/api-commands.md

+ 51 - 48
docs/api-commands.md

@@ -1,130 +1,133 @@
----
-id: commands
-title: CLI Commands
----
+# CLI 命令
 
-Docusaurus provides a set of scripts to help you generate, serve, and deploy your website. These scripts can be invoked with the `run` command when using Yarn or npm. Some common commands are:
+Docusaurus提供了一组脚本来帮助您生成,运行和部署您的网站。 当使用 Yarn 或 npm 时,可以用 `run` 命令调用这些脚本。 一些常见的命令是:
 
-* [`yarn run start`](api-commands.md#docusaurus-start-port-number): build and serve the website from a local server
-* [`yarn run examples`](api-commands.md#docusaurus-examples): create example configuration files
+* [`yarn run start`](api-commands.md#docusaurus-start-port-number): 从本地服务器构建和运行网站
+* [`yarn run examples`](api-commands.md#docusaurus-examples): 创建示例配置文件
 
 
-## Running from the command line
+## 从命令行运行
 
-The scripts can be run using either Yarn or npm. If you've already gone through our Getting Started guide, you may already be familiar with the `start` command. It's the command that tells Docusaurus to run the `docusaurus-start` script which generates the site and starts up a server, and it's usually invoked like so:
+脚本可以使用 Yarn 或 npm 运行。 如果您已经阅读了入门指南,您可能已经熟悉 `start` 命令。 这个命令告诉 Docusaurus 运行生成站点并启动服务器的 `docusaurus-start` 脚本,通常这样调用它:
 
 ```
 yarn run start
 ```
 
-The same script can be invoked using npm:
+可以使用 npm 来调用相同的脚本:
 
 ```
 npm run start
 ```
 
-To run a particular script, just replace the `start` command in the examples above with the command associated with your script.
+要运行一个特定的脚本,只需将上面例子中的 `start` 命令替换为与脚本相关的命令即可。
 
-## Using arguments
+## 使用参数
 
-Some commands support optional arguments. For example, to start a server on port 8080, you can specify the `--port` argument when running `start`:
+有些命令支持可选参数。 例如,要在端口 8080 上启动服务器,可以在运行 `start` 时指定 `--port` 参数:
 
 ```
 yarn run start --port 8080
 ```
 
-If you run Docusaurus using npm, you can still use the command line arguments by inserting a `--` between `npm run <command>` and the command arguments:
+如果你使用 npm 运行 Docusaurus,你仍然可以通过在 `npm run <command>` 和命令参数之间插入 `--` 来使用命令行参数:
 
 ```
 npm run start -- --port 8080
 ```
 
-## Configuration
+## 配置
 
-These scripts are set up under the `"scripts"` key in your `website/package.json` file as part of the installation process. If you need help setting them up again, please refer to the [Installation guide](getting-started-installation.md).
+这些脚本是作为安装过程的一部分在 `website/package.json` 文件的 `"scripts"` 键下建立的。 如果您需要重新设置,请参考[安装指南](getting-started-installation.md)。
 
-Docusaurus provides some default mappings to allow you to run commands following Node conventions. Instead of typing `docusaurus-start` every time, you can type `yarn run start` or `npm start` to achieve the same.
+Docusaurus 提供了一些默认映射,允许您按照 node 惯例运行命令。 每次输入 `docusaurus-start`,你都可以输入 `yarn run start` 或 `npm start` 来达到同样的目的。
 
-## Commands
+## 命令
 
-<AUTOGENERATED_TABLE_OF_CONTENTS>
+* [docusaurus-build](#docusaurus-build)
+* [docusaurus-examples [feature]](#docusaurus-examples-feature)
+* [docusaurus-publish](#docusaurus-publish)
+* [docusaurus-rename-version <currentVersion> <newVersion>](#docusaurus-rename-version-currentversion-newversion)
+* [docusaurus-start [--port <number>]](#docusaurus-start-port-number)
+* [docusaurus-version <version>](#docusaurus-version-version)
+* [docusaurus-write-translations](#docusaurus-write-translations)
 
 -----
 
-## Reference
+## 参考
 
 ### `docusaurus-build`
-Alias: `build`.
+别名: `build`.
 
-Generates the static website, applying translations if necessary. Useful for building the website prior to deployment.
+生成静态网站,必要时应用翻译。 在部署之前用于构建网站。
 
-See also [`docusaurus-start`](api-commands.md#docusaurus-start-port-number).
+也可以参考 [`docusaurus-start`](api-commands.md#docusaurus-start-port-number).
 
 ---
 
 ### `docusaurus-examples [feature]`
-Alias: `examples`
+别名: `examples`
 
-When no feature is specified, sets up a minimally configured example website in your project. This command is covered in depth in the [Site Preparation guide](getting-started-preparation.md). Specify a feature `translations` or `versions` to generate the extra example files for that feature.
+如果没有指定功能,则在您的项目中设置一个最低限度配置的示例网站。这个命令更深入的内容在 [网站准备指南](getting-started-preparation.md)中。指定一个功能 `translations` 或 `versions` 来为该功能生成额外的示例文件。
 
 ---
 
 ### `docusaurus-publish`
-Alias: `publish-gh-pages`
+别名: `publish-gh-pages`
 
-[Builds](api-commands.md#docusaurus-build), then deploys the static website to GitHub Pages. This command is meant to be run during the deployment step in Circle CI, and therefore expects a few environment variables to be defined:
+[构建](api-commands.md#docusaurus-build),然后将静态网站部署到 GitHub 页面。 此命令在 Circle CI 的部署步骤中运行,因此需要定义一些环境变量:
 
-The following is generally set manually by the user in the CircleCI `config.yml` file.
+以下通常由用户在 CircleCI 的 `config.yml` 文件中手动设置。
 
- - `GIT_USER`: The git user to be associated with the deploy commit.
- - `USE_SSH`: Whether to use SSH instead of HTTPS for your connection to the GitHub repo.
+ - `GIT_USER`: 与部署提交相关联的 git 用户。
+ - `USE_SSH`: 是否使用 SSH 而不是 HTTPS 连接到 GitHub 仓库。
 
- e.g.,
+示例
 
  ```bash
  GIT_USER=docusaurus-bot USE_SSH=true yarn run publish-gh-pages
  ```
 
-The following are set by the [CircleCI environment](https://circleci.com/docs/1.0/environment-variables/) during the build process.
+以下是在构建过程中由 [CircleCI 环境](https://circleci.com/docs/1.0/environment-variables/) 设置的。
 
- - `CIRCLE_BRANCH`: The git branch associated with the commit that triggered the CI run.
- - `CI_PULL_REQUEST`: Expected to be truthy if the current CI run was triggered by a commit in a pull request.
+ - `CIRCLE_BRANCH`: 与触发 CI 运行的提交相关联的 git 分支。
+ - `CI_PULL_REQUEST`: 如果当前的 CI 运行是由提交请求中的提交触发的,那么预计会实现。
 
-The following should be set by you in `siteConfig.js` as `organizationName` and `projectName`, respectively. If they are not set in your site configuration, they fall back to the [CircleCI environment](https://circleci.com/docs/1.0/environment-variables/).
+你应该在 `siteConfig.js` 中分别设置为 `organizationName` 和 `projectName`。 如果它们未在您的站点配置中设置,则会回退到[CircleCI环境](https://circleci.com/docs/1.0/environment-variables/)。
 
- - `CIRCLE_PROJECT_USERNAME`: The GitHub username or organization name that hosts the git repo, e.g. "facebook".
- - `CIRCLE_PROJECT_REPONAME`: The name of the git repo, e.g. "Docusaurus".
+ - `CIRCLE_PROJECT_USERNAME`: 承载git仓库的 GitHub 用户名或组织名称,例如 "facebook"。
+ - `CIRCLE_PROJECT_REPONAME`: git repo的名字,例如 "Docusaurus"。
 
-You can learn more about configuring automatic deployments with CircleCI in the [Publishing guide](getting-started-publishing.md).
+您可以在[发布指南](getting-started-publishing.md)中了解更多关于使用 CircleCI 配置自动部署的信息。
 
 ---
 
 ### `docusaurus-rename-version <currentVersion> <newVersion>`
-Alias: `rename-version`
+别名: `rename-version`
 
-Renames an existing version of the docs to a new version name.
+将文档的现有版本重命名为新的版本名称。
 
-See the [Versioning guide](guides-versioning.md#renaming-existing-versions) to learn more.
+参考 [版本化指南](guides-versioning.md#重命名现有版本) 来学习更多.
 
 ---
 
 ### `docusaurus-start [--port <number>]`
-Alias: `start`.
+别名: `start`.
 
-This script will build the static website, apply translations if necessary, and then start a local server. The website will be served from port 3000 by default.
+该脚本将构建静态网站,必要时应用翻译,然后启动本地服务器。 该网站将默认从端口 3000 提供。
 
 ---
 
 ### `docusaurus-version <version>`
-Alias: `version`
+别名: `version`
 
-Generates a new version of the docs. This will result in a new copy of your site being generated and stored in its own versioned folder. Useful for capturing snapshots of API docs that map to specific versions of your software. Accepts any string as a version number.
+生成文档的新版本。 这将导致您的网站的新副本生成并存储在其自己的版本文件夹中。 用于捕获映射到特定版本的软件的 API 文档的快照。 接受任何字符串作为版本号。
 
-See the [Versioning guide](guides-versioning.md) to learn more.
+参考 [版本化指南](guides-versioning.md) 来学习更多.
 
 ---
 
 ### `docusaurus-write-translations`
-Alias: `write-translations`
+别名: `write-translations`
 
-Writes the English for any strings that need to be translated into an `website/i18n/en.json` file. The script will go through every file in `website/pages/en` and through the `siteConfig.js` file and other config files to fetch English strings that will then be translated on Crowdin. See the [Translation guide](guides-translation.md) to learn more.
+将需要翻译成 `website/i18n/en.json` 文件的字符串写入英文。 脚本将遍历 `website/pages/en` 中的每个文件,并通过 `siteConfig.js` 文件和其他配置文件读取英文字符串,然后在 Crowdin 上进行翻译。 请参阅[翻译指南](guides-translation.md)了解更多信息。