From 0c5ecc9ff2680fd44b4bec850f1ae48d9f13ef4b Mon Sep 17 00:00:00 2001 From: "hexo-crowdin[bot]" <159447924+hexo-crowdin[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 01:03:52 +0000 Subject: [PATCH] l10n(zh-CN): New translations from Crowdin --- source/zh-cn/api/box.md | 13 +- source/zh-cn/api/console.md | 9 +- source/zh-cn/api/deployer.md | 3 +- source/zh-cn/api/events.md | 2 +- source/zh-cn/api/filter.md | 21 +-- source/zh-cn/api/generator.md | 14 +- source/zh-cn/api/helper.md | 5 +- source/zh-cn/api/index.md | 11 +- source/zh-cn/api/injector.md | 2 +- source/zh-cn/api/locals.md | 1 - source/zh-cn/api/migrator.md | 3 +- source/zh-cn/api/posts.md | 8 +- source/zh-cn/api/processor.md | 3 +- source/zh-cn/api/renderer.md | 7 +- source/zh-cn/api/rendering.md | 11 +- source/zh-cn/api/router.md | 4 +- source/zh-cn/api/tag.md | 31 +--- source/zh-cn/api/themes.md | 1 - source/zh-cn/docs/asset-folders.md | 1 + source/zh-cn/docs/commands.md | 50 +++--- source/zh-cn/docs/configuration.md | 97 +++++------ source/zh-cn/docs/contributing.md | 18 +- source/zh-cn/docs/data-files.md | 2 +- source/zh-cn/docs/front-matter.md | 57 ++++--- source/zh-cn/docs/generating.md | 4 +- source/zh-cn/docs/github-pages.md | 28 ++-- source/zh-cn/docs/gitlab-pages.md | 28 ++-- source/zh-cn/docs/helpers.md | 177 ++++++++++---------- source/zh-cn/docs/index.md | 12 +- source/zh-cn/docs/internationalization.md | 8 +- source/zh-cn/docs/migration.md | 8 +- source/zh-cn/docs/one-command-deployment.md | 74 ++++---- source/zh-cn/docs/permalinks.md | 4 +- source/zh-cn/docs/plugins.md | 6 +- source/zh-cn/docs/server.md | 8 +- source/zh-cn/docs/setup.md | 9 +- source/zh-cn/docs/syntax-highlight.md | 10 +- source/zh-cn/docs/tag-plugins.md | 19 +-- source/zh-cn/docs/templates.md | 16 +- source/zh-cn/docs/themes.md | 14 +- source/zh-cn/docs/troubleshooting.md | 25 ++- source/zh-cn/docs/variables.md | 32 ++-- source/zh-cn/docs/writing.md | 6 +- source/zh-cn/index.md | 8 +- 44 files changed, 396 insertions(+), 474 deletions(-) diff --git a/source/zh-cn/api/box.md b/source/zh-cn/api/box.md index 14576dda81..03af844118 100644 --- a/source/zh-cn/api/box.md +++ b/source/zh-cn/api/box.md @@ -2,28 +2,25 @@ title: Box --- -Box is a container used for processing files in a specified folder. 「Box」是 Hexo 用来处理特定文件夹中的文件的容器,在 Hexo 中有两个 Box,分别是 `hexo.source` 和 `hexo.theme`,前者用于处理 `source` 文件夹,而后者用于处理主题文件夹。 The former is used to process the `source` folder and the latter to process the `theme` folder. +Box 是 Hexo 用来处理特定文件夹中的文件的容器。 在 Hexo 中有两个 Box,分别是 `hexo.source` 和 `hexo.theme`。 前者用于处理 `source` 文件夹,后者用于处理 `theme` 文件夹。 ## 加载文件 -Box 提供了两种方法来加载文件:`process`, `watch`,前者用于加载文件夹内的所有文件;而后者除了执行 `process` 以外,还会继续监视文件变动。 `process` loads all files in the folder. `watch` does the same, but also starts watching for file changes. +Box 提供了两种方法来加载文件:`process` 和 `watch`。 `process` 加载文件夹中的所有文件。 `watch` 做了与前者相同的操作,但还会开始监视文件的更改。 ```js -box.process().then(function () { - // ... box.process().then(function () { // ... }); box.watch().then(function () { - // 之后可调用 box.unwatch(),停止监视文件 -}); + // 之后可调用 box.unwatch(),停止监视文件。 }); ``` ## 比对路径 -Box provides many ways for path matching. Box 提供了多种比对路径的模式,您可以以使用正则表达式(regular expression)、函数、或是 Express 风格的模式字符串,例如: For example: +Box 提供了多种比对路径的模式。 您可以以使用正则表达式(regular expression)、函数、或是 Express 风格的模式字符串。 例如: ```plain posts/:id => posts/89 @@ -34,7 +31,7 @@ posts/*path => posts/2015/title ## 处理器(Processor) -处理器(Processor)是 Box 中非常重要的元素,它用于处理文件,您可以使用上述的路径对比来限制该处理器所要处理的文件类型。 You can use path matching as described above to restrict what exactly the processor should process. 使用 `addProcessor` 来添加处理器。 +处理器(Processor)是 Box 中非常重要的元素,它用于处理文件。 您可以使用上述的路径对比来限制该处理器所要处理的文件类型。 使用 `addProcessor` 来添加处理器。 ```js box.addProcessor("posts/:id", function (file) { diff --git a/source/zh-cn/api/console.md b/source/zh-cn/api/console.md index f12ff274a3..90c614c7f3 100644 --- a/source/zh-cn/api/console.md +++ b/source/zh-cn/api/console.md @@ -10,10 +10,9 @@ title: 控制台(Console) hexo.extend.console.register(name, desc, options, function (args) { // ... }); -}); ``` -| Argument | 描述 | +| 参数 | 描述 | | --------- | -- | | `name` | 名称 | | `desc` | 描述 | @@ -25,7 +24,7 @@ An argument `args` will be passed into the function. This is the argument that u ### 用法 -The usage of a console command. For example: +The usage of a console command. 例如: ```js { @@ -36,7 +35,7 @@ The usage of a console command. For example: ### arguments -控制台各个参数的说明,例如: For example: +控制台各个参数的说明。 例如: ```js { @@ -49,7 +48,7 @@ The usage of a console command. For example: ### options -控制台的各个选项的说明,例如: For example: +控制台的各个选项的说明。 例如: ```js { diff --git a/source/zh-cn/api/deployer.md b/source/zh-cn/api/deployer.md index e14d6c64f0..bec9baa643 100644 --- a/source/zh-cn/api/deployer.md +++ b/source/zh-cn/api/deployer.md @@ -10,7 +10,6 @@ title: 部署器(Deployer) hexo.extend.deployer.register(name, function (args) { // ... }); -}); ``` -在函数中会传入 `args` 参数,该参数包含了 `_config.yml` 中的 `deploy` 参数值,以及开发者在终端中所传入的参数。 It contains the `deploy` value set in `_config.yml`, as well as the exact input users typed into their terminal. +在函数中会传入 `args` 参数。 该参数包含了 `_config.yml` 中设置的 `deploy` 值,以及用户在终端中输入的内容。 diff --git a/source/zh-cn/api/events.md b/source/zh-cn/api/events.md index b48044851a..47c90d215e 100644 --- a/source/zh-cn/api/events.md +++ b/source/zh-cn/api/events.md @@ -2,7 +2,7 @@ title: 事件 --- -Hexo 继承了 [EventEmitter][],您可以用 `on` 方法监听 Hexo 所发布的事件,也可以使用 `emit` 方法对 Hexo 发布事件,更详细的说明请参阅 Node.js 的 API。 Use the `on` method to listen for events emitted by Hexo, and use the `emit` method to emit events. For more information, refer to the Node.js API documentation. +Hexo 继承了 [EventEmitter][]。 您可以用 `on` 方法监听 Hexo 所发布的事件,也可以使用 `emit` 方法对 Hexo 发布事件。 更详细的说明请参阅 Node.js 的 API。 ### deployBefore diff --git a/source/zh-cn/api/filter.md b/source/zh-cn/api/filter.md index 27d8c89556..e9c362e430 100644 --- a/source/zh-cn/api/filter.md +++ b/source/zh-cn/api/filter.md @@ -16,16 +16,10 @@ hexo.extend.filter.register(type, function() { const { config: themeCfg } = this.theme; if (themeCfg.fancybox) // do something... -}, priority); - - // Theme configuration - const { config: themeCfg } = this.theme; - if (themeCfg.fancybox) // do something... - }, priority); ``` -You can define the `priority`. Lower `priority` means that it will be executed first. 您可以指定过滤器的优先级 `priority`,`priority` 值越低,过滤器会越早执行,默认的 `priority` 是 10。 我们建议提供配置选项如 `hexo.config.your_plugin.priority`、让用户自行决定过滤器的优先级。 +您可以指定过滤器的优先级 `priority`。 `priority` 值越低,过滤器会越早执行。 默认的 `priority` 是 10。 我们建议提供配置选项如 `hexo.config.your_plugin.priority`、让用户自行决定过滤器的优先级。 ## 执行过滤器 @@ -39,7 +33,7 @@ hexo.extend.filter.execSync(type, data, options); | `context` | Context | | `args` | 参数。 必须为数组。 | -`data` 会作为第一个参数传入每个过滤器,而您可以在过滤器中通过返回值改变下一个过滤器中的 `data`,如果什么都没有返回的话则会保持原本的 `data`。 The `data` passed into the next filter can be modified by returning a new value. If nothing is returned, the data remains unmodified. 您还可以使用 `args` 指定过滤器的其他参数。 举例来说: +`data` 会作为第一个参数传入每个过滤器。 而您可以在过滤器中通过返回值改变下一个过滤器中的 `data`。 如果什么都没有返回的话则会保持原本的 data。 您还可以使用 `args` 指定过滤器的其他参数。 举例来说: ```js hexo.extend.filter.register("test", function (data, arg1, arg2) { @@ -145,7 +139,6 @@ hexo.extend.filter.register("before_exit", function () { hexo.extend.filter.register("before_generate", function () { // ... }); -}); ``` ### after_generate @@ -156,7 +149,6 @@ Executed after generation finishes. hexo.extend.filter.register("after_generate", function () { // ... }); -}); ``` ### template_locals @@ -180,7 +172,6 @@ hexo.extend.filter.register("template_locals", function (locals) { hexo.extend.filter.register("after_init", function () { // ... }); -}); ``` ### new_post_path @@ -191,7 +182,6 @@ hexo.extend.filter.register("after_init", function () { hexo.extend.filter.register("new_post_path", function (data, replace) { // ... }); -}); ``` ### post_permalink @@ -202,20 +192,19 @@ Used to determine the permalink of posts. hexo.extend.filter.register("post_permalink", function (data) { // ... }); -}); ``` ### after_render -Executed after rendering finishes. 在渲染后执行,您可以参考 [渲染](rendering.html#after-render-过滤器) 以了解更多信息。 +在渲染后执行。 您可以参考 [渲染](rendering.html#after-render-过滤器) 以了解更多信息。 ### after_clean Executed after generated files and cache are removed with `hexo clean` command. ```js -hexo.extend.filter.register("before_exit", function () { - // ... +hexo.extend.filter.register("after_clean", function () { + // remove some other temporary files }); ``` diff --git a/source/zh-cn/api/generator.md b/source/zh-cn/api/generator.md index ccfed5c2cb..5c94a5c91c 100644 --- a/source/zh-cn/api/generator.md +++ b/source/zh-cn/api/generator.md @@ -7,11 +7,12 @@ title: 生成器(Generator) ## 概要 ```js -hexo.extend.generator.register(name, function (locals) {}); +hexo.extend.generator.register(name, function (locals) { + // ... }); ``` -`locals` 参数会被传递到此函数,其中包含 [网站变量](../docs/variables.html#网站变量),请尽量利用此参数取得网站数据,避免直接访问数据库。 You should use this argument to get the website data, thereby avoiding having to access the database directly. +`locals` 参数会被传递到此函数,其中包含 [网站变量](../docs/variables.html#网站变量)。 请尽量利用此参数取得网站数据,避免直接访问数据库。 ## 更新路由 @@ -37,13 +38,13 @@ hexo.extend.generator.register("test", function (locals) { | `data` | 数据 | | `layout` | 布局。 Specify the layouts for rendering. The value can be a string or an array. If it's ignored then the route will return `data` directly. | -在原始文件更新时,Hexo 会执行所有生成器并重建路由,**请直接回传数据,不要直接操作路由**。 **Please return the data and do not access the router directly.** +在原始文件更新时,Hexo 会执行所有生成器并重建路由。 **请直接回传数据,不要直接访问路由。** ## 示例 ### 归档页面 -Create an archive page at `archives/index.html`. We pass all posts as data to the templates. 在 `archives/index.html` 建立一归档页面,把所有文章当作数据传入模板内,这个数据也就等同于模板中的 `page` 变量。 +在 `archives/index.html` 建立一归档页面。 把所有文章当作数据传入模板内。 这个数据也就等同于模板中的 `page` 变量。 Next, set the `layout` attribute to render with the theme templates. We're setting two layouts in this example: if the `archive` layout doesn't exist, the `index` layout will be used instead. @@ -51,7 +52,7 @@ Next, set the `layout` attribute to render with the theme templates. We're setti hexo.extend.generator.register("archive", function (locals) { return { path: "archives/index.html", - data: locals.posts, + data: locals, layout: ["archive", "index"], }; }); @@ -65,7 +66,8 @@ hexo.extend.generator.register("archive", function (locals) { var pagination = require("hexo-pagination"); hexo.extend.generator.register("archive", function (locals) { - return pagination("archives/index.html", locals.posts, { + // hexo-pagination makes an index.html for the /archives route + return pagination("archives", locals.posts, { perPage: 10, layout: ["archive", "index"], data: {}, diff --git a/source/zh-cn/api/helper.md b/source/zh-cn/api/helper.md index 98ea2ecd55..82d9e89463 100644 --- a/source/zh-cn/api/helper.md +++ b/source/zh-cn/api/helper.md @@ -2,7 +2,7 @@ title: 辅助函数(Helper) --- -辅助函数帮助您在模板中快速插入内容,建议您把复杂的代码放在辅助函数而非模板中。 We recommend using helpers instead of templates when you're dealing with more complicated code. +辅助函数帮助您在模板中快速插入内容。 建议您把复杂的代码放在辅助函数而非模板中。 辅助函数不能从 `source` 的文件中访问。 @@ -12,7 +12,6 @@ title: 辅助函数(Helper) hexo.extend.helper.register(name, function () { // ... }); -}); ``` ## 示例 @@ -44,7 +43,7 @@ hexo.extend.helper.register("lorem", function (path) { }); ``` -### 如何在其他插件中使用已经注册的 helper? +### 如何在另一个扩展(例如过滤器、注入器)中使用注册的helper? `hexo.extend.helper.get` 会返回一个指定名字的 helper,但是你还需要一个 `bind(hexo)`,就像这样: diff --git a/source/zh-cn/api/index.md b/source/zh-cn/api/index.md index 30c489dd47..74cbf4b951 100644 --- a/source/zh-cn/api/index.md +++ b/source/zh-cn/api/index.md @@ -8,7 +8,7 @@ title: API ## 初始化 -First, we have to create a Hexo instance. 首先,我们必须建立一个 Hexo 实例(instance),第一个参数是网站的根目录,也就是 `base_dir`,而第二个参数则是初始化的选项。 接着执行 `init` 方法后,Hexo 会加载插件及配置文件。 +首先,我们必须建立一个 Hexo 实例(instance)。 一个新的实例需要两个参数:网站根目录 `base_dir`,以及包含初始化选项的对象。 接着执行 `init` 方法后,Hexo 会加载插件及配置文件。 ```js var Hexo = require("hexo"); @@ -17,10 +17,9 @@ var hexo = new Hexo(process.cwd(), {}); hexo.init().then(function () { // ... }); -}); ``` -| Option | 描述 | 默认值 | +| 选项 | 描述 | 默认值 | | ------------------ | --------------------------------------------------------------- | ----------------------------------- | | `debug` | 开启调试模式。 在终端中显示调试信息,并在根目录中存储 `debug.log` 日志文件。 | `false` | | `safe` | 开启安全模式。 不加载任何插件。 | `false` | @@ -30,13 +29,11 @@ hexo.init().then(function () { ## 加载文件 -Hexo 提供了两种方法来加载文件:`load`, `watch`,前者用于加载 `source` 文件夹内的所有文件及主题资源;而后者除了执行 `load` 以外,还会继续监视文件变动。 `load` is used for loading all files in the `source` folder as well as the theme data. `watch` does the same things `load` does, but will also start watching for file changes continuously. +Hexo 提供了两种方法来加载文件:`load` 和 `watch`。 `load` 用于加载 `source` 文件夹中的所有文件以及主题数据。 `watch` 执行与 `load` 相同的操作,但还会开始连续监视文件更改。 Both methods will load the list of files and pass them to the corresponding processors. After all files have been processed, they will call upon the generators to create the routes. ```js -hexo.load().then(function () { - // ... hexo.load().then(function () { // ... }); @@ -44,7 +41,6 @@ hexo.load().then(function () { hexo.watch().then(function () { // 之后可以调用 hexo.unwatch(),停止监视文件 }); -}); ``` ## 执行指令 @@ -55,7 +51,6 @@ Any console command can be called explicitly using the `call` method on the Hexo hexo.call("generate", {}).then(function () { // ... }); -}); ``` ```js diff --git a/source/zh-cn/api/injector.md b/source/zh-cn/api/injector.md index 6296cdfa53..7d70fb6d7f 100644 --- a/source/zh-cn/api/injector.md +++ b/source/zh-cn/api/injector.md @@ -71,7 +71,7 @@ hexo.extend.injector.register("body_end", () => { }); ``` -上述代码将会把 `APlayer.min.css`(`` 标签)和 `APlayer.min.js` (`