complete the translation of Contributing and feedback guidelines

This commit is contained in:
GeorgeHu 2024-05-08 15:31:48 +08:00
commit 9e4f60ab2e
4 changed files with 160 additions and 109 deletions

View file

@ -3,7 +3,6 @@
# This file is distributed under the same license as the Pelican package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2023.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Pelican 4\n"
@ -21,7 +20,7 @@ msgstr ""
#: ../../contribute.rst:2
msgid "Contributing and feedback guidelines"
msgstr ""
msgstr "项目贡献与意见反馈"
#: ../../contribute.rst:4
msgid ""
@ -29,43 +28,46 @@ msgid ""
"documentation, add missing features, and fix bugs (or just report them). "
"You can also help out by reviewing and commenting on `existing issues "
"<https://github.com/getpelican/pelican/issues>`_."
msgstr ""
msgstr "有很多渠道可以参与到贡献项目中来例如帮助改进文档、添加缺失的特性、修复与报告bug。"
"可以从查看 `已有 issues <https://github.com/getpelican/pelican/issues>`_ 开始。"
#: ../../contribute.rst:9
msgid ""
"Don't hesitate to fork Pelican and submit an issue or pull request on "
"GitHub. When doing so, please consider the following guidelines."
msgstr ""
msgstr "随时随地都可以fork Pelican或是在GitHub上提交issue或PR。"
#: ../../../CONTRIBUTING.rst:2
msgid "Filing issues"
msgstr ""
msgstr "提出issue"
#: ../../../CONTRIBUTING.rst:4
msgid "Before you submit a new issue, try `asking for help`_ first."
msgstr ""
msgstr "在你提交一个新的issue之前可以先尝试 `请求他人帮助`_ 。"
#: ../../../CONTRIBUTING.rst:5
msgid ""
"If determined to create a new issue, first search `Pelican Discussions`_ "
"and `existing issues`_ (open and closed) to see if your question has "
"already been answered previously."
msgstr ""
msgstr "当你决定要创建新的issue时先在 `Pelican的讨论版`_ 和 `已有issues`_ 中搜索一下,"
"开放关闭的issue都搜一下来看看你的问题是不是有人之前已经提出过。"
#: ../../../CONTRIBUTING.rst:14
msgid "How to get help"
msgstr ""
msgstr "如何获取帮助"
#: ../../../CONTRIBUTING.rst:16
msgid "Before you ask for help, please make sure you do the following:"
msgstr ""
msgstr "在寻求帮助之前,请先尝试如下步骤:"
#: ../../../CONTRIBUTING.rst:18
msgid ""
"Read the documentation_ thoroughly. If in a hurry, at least use the "
"search field that is provided at top-left on the documentation_ pages. "
"Make sure you read the docs for the Pelican version you are using."
msgstr ""
msgstr "完整阅读 documentation_ 。如果你很急,至少先在 documentation_ 页面左上角的搜索栏中尝试搜索。"
"确保你阅读的文档和使用的Pelican版本相匹配。"
#: ../../../CONTRIBUTING.rst:21
msgid ""
@ -73,23 +75,24 @@ msgid ""
"to your problem. Someone may have already found a solution, perhaps in "
"the form of a ':pelican-doc:`plugins` or a specific combination of "
"settings."
msgstr ""
msgstr "使用搜索引擎(例如 DuckDuckGo、Google搜索遇到问题的解决方案。互联网上可能已经有人遇到过"
"相同的问题,解决方法可能包括使用某些 :pelican-doc:`插件` 或配置一系列的设置选项。"
#: ../../../CONTRIBUTING.rst:25
msgid "Try reproducing the issue in a clean environment, ensuring you are using:"
msgstr ""
msgstr "尝试在一个干净的环境中重现问题,确保以下内容:"
#: ../../../CONTRIBUTING.rst:27
msgid "latest Pelican release (or an up-to-date Git clone of Pelican master)"
msgstr ""
msgstr "使用最新版本的Pelican或是用Git克隆Pelican的master分支"
#: ../../../CONTRIBUTING.rst:28
msgid "latest releases of libraries used by Pelican"
msgstr ""
msgstr "将Pelican使用的库升级到最新版本"
#: ../../../CONTRIBUTING.rst:29
msgid "no plugins or only those related to the issue"
msgstr ""
msgstr "此环境中没有使用插件或是只使用和问题相关的插件"
#: ../../../CONTRIBUTING.rst:31
msgid ""
@ -99,7 +102,8 @@ msgid ""
"following steps to generate your site, then the problem is almost "
"certainly with one of the above-listed elements (and not Pelican "
"itself)::"
msgstr ""
msgstr "**注意:** 最常见的问题基本上都产生于主题、插件、设置文件和自动化工具 ``make``/``invoke`` 中。"
"如果按照下述步骤生成站点后无法复现之前的问题那么几乎可以肯定问题出在这四个地方而不在Pelican本身"
#: ../../../CONTRIBUTING.rst:41
msgid ""
@ -108,7 +112,8 @@ msgid ""
"therefore please consider reaching out to the maintainers of the "
"plugins/theme you are using instead of raising the topic with the Pelican"
" core community."
msgstr ""
msgstr "如果按照上述步骤能够正常生成站点那么你的问题不太可能是由Pelican本身导致的请考虑联系对应插件/主题"
"的维护者而不是在Pelican内核的社区中提出问题。"
#: ../../../CONTRIBUTING.rst:46
msgid ""
@ -116,7 +121,8 @@ msgid ""
"sure to include in your inquiry the following information, preferably in "
"the form of links to content uploaded to a `paste service`_, GitHub "
"repository, or other publicly-accessible location:"
msgstr ""
msgstr "经过上面这些努力,若您仍无法解决问题,确保你的提问中包括如下信息,可以以 `paste service`_ 链接、"
"GitHub仓库或者其他可公开获取的形式提供"
#: ../../../CONTRIBUTING.rst:51
msgid ""
@ -124,7 +130,8 @@ msgid ""
"--version`` or the HEAD commit hash if you cloned the repo) and how "
"exactly you installed it (the full command you used, e.g. ``python -m pip"
" install pelican``)."
msgstr ""
msgstr "描述正在运行的Pelican版本信息可以通过 ``pelican --version`` 命令得到如果clone的源仓库"
"则可以查看HEAD commit的哈希值以及你是如何安装Pelican的要包括使用到的命令例如 ``python -m pip install pelican``"
#: ../../../CONTRIBUTING.rst:54
msgid ""
@ -132,7 +139,8 @@ msgid ""
"description of what the end result should look like (preferably in the "
"form of an image or a mock-up page) and explain in detail what you have "
"done so far to achieve it."
msgstr ""
msgstr "如果你希望产生某种最终结果,请详细描述此最终结果是什么样的(最好以图片或者伪页面的形式),"
",并且细致讲述你做了哪些尝试。"
#: ../../../CONTRIBUTING.rst:58
msgid ""
@ -140,31 +148,33 @@ msgid ""
"how to reproduce the problem. If the issue cannot be easily reproduced, "
"it cannot be debugged by developers or volunteers. Describe only the "
"**minimum steps** necessary to reproduce it (no extra plugins, etc.)."
msgstr ""
msgstr "如果你在尝试解决某些问题,请详细描述如何复现此问题。如果问题很难被复现,其他开发者和志愿者就很难进行调试。"
"尽量只写出复现该问题的 **最少步骤** (无额外插件)。"
#: ../../../CONTRIBUTING.rst:62
msgid ""
"Upload your settings file or any other custom code that would enable "
"people to reproduce the problem or to see what you have already tried to "
"achieve the desired end result."
msgstr ""
msgstr "上传你的设置文件以及所有自定义过的代码,这可以使得大家能够重现问题或者看到你已经做出的尝试。"
#: ../../../CONTRIBUTING.rst:65
msgid ""
"Upload detailed and **complete** output logs and backtraces (remember to "
"add the ``--debug`` flag: ``pelican --debug content [...]``)"
msgstr ""
msgstr "上传详细 **完备** 的输出日志以及回溯信息记得在执行pelican命令时加上 ``--debug`` 标记: "
"``pelican --debug content [...]`` "
#: ../../../CONTRIBUTING.rst:71
msgid ""
"Once the above preparation is ready, you can post your query as a new "
"thread in `Pelican Discussions`_. Remember to include all the information"
" you prepared."
msgstr ""
msgstr "一旦做好了上述准备,就可以在 `Pelican Discussions`_ 中发起你的请求了。记得在请求中附上收集好的信息。"
#: ../../../CONTRIBUTING.rst:75
msgid "Contributing code"
msgstr ""
msgstr "贡献代码"
#: ../../../CONTRIBUTING.rst:77
msgid ""
@ -173,7 +183,8 @@ msgid ""
"rejected for a known reason. Consider also whether your new feature might"
" be better suited as a ':pelican-doc:`plugins` — you can `ask for help`_"
" to make that determination."
msgstr ""
msgstr "在提交代码修改前,请先询问是否需要此修改,以免你做的工作因为已知原因而被拒绝。想想要添加的"
"新特性是否更适合以 :pelican-doc:`插件` 形式完成。可以通过 `如何获取帮助`_ 来帮助你作出决定。"
#: ../../../CONTRIBUTING.rst:82
msgid ""
@ -181,17 +192,18 @@ msgid ""
"which there is no existing issue, there is no need to create a new issue "
"and then immediately submit a pull request that closes it. You can submit"
" the pull request by itself."
msgstr ""
msgstr "另外如果你的PR是为了解决一个目前没有在issue中出现过的问题那么就没有必要先创建一个新的"
"issue而是可以直接提起PR。"
#: ../../../CONTRIBUTING.rst:87
msgid "Using Git and GitHub"
msgstr ""
msgstr "使用Git与GitHub"
#: ../../../CONTRIBUTING.rst:89
msgid ""
"`Create a new branch`_ specific to your change (as opposed to making your"
" commits in the master branch)."
msgstr ""
msgstr "`创建一个新的分支`_ 来标志你做的修改(而不是直接在主分支中提交)。"
#: ../../../CONTRIBUTING.rst:91
msgid ""
@ -201,20 +213,23 @@ msgid ""
"branch and pull request** for the bugfix. Similarly, any proposed changes"
" to code style formatting should be in a completely separate pull "
"request."
msgstr ""
msgstr "**不要把多个无关联的修复/特性修改放在同一个分支/拉去请求中。** 如果当你在做新特性的时候"
"发现了一个bug可以修复但修复这个bug *不需要用到* 这个新特性, **那么请另外创建一个分支并拉取请求。** "
"类似的,任何对代码风格的格式化都应该在单独的请求中拉取。"
#: ../../../CONTRIBUTING.rst:96
msgid ""
"Add a ``RELEASE.md`` file in the root of the project that contains the "
"release type (major, minor, patch) and a summary of the changes that will"
" be used as the release changelog entry. For example::"
msgstr ""
msgstr "在项目根目录下添加 ``RELEASE.md`` 文件在其中包含release的类型主要、次要、补丁"
"以及对项目改变的概述这些内容会作为该release发布日志的一部分。下面是一个例子"
#: ../../../CONTRIBUTING.rst:104
msgid ""
"Check for unnecessary whitespace via ``git diff --check`` before "
"committing."
msgstr ""
msgstr "在提交前使用 ``git diff --check`` 来检查是否有无意义的空白字符。"
#: ../../../CONTRIBUTING.rst:105
msgid ""
@ -224,19 +239,22 @@ msgid ""
" If the commit *completely fixes* an existing bug report, please use "
"``Fixes #585`` or ``Fix #585`` syntax (so the relevant issue is "
"automatically closed upon PR merge)."
msgstr ""
msgstr "commit信息的第一行应该以现在时动词开头并且第一行尽量保持在50字以下并且包含相关联"
"issue的编号如果有的话。 例如: ``Ensure proper PLUGIN_PATH behavior. Refs #428.`` "
"如果此项提交 *完全修复* 了某项已报告的bug请使用例如 ``Fixes #585`` 或 ``Fix #585`` 的语法"
"这样的话相关的issue会在PR合并后自动关闭。"
#: ../../../CONTRIBUTING.rst:110
msgid ""
"After the first line of the commit message, add a blank line and then a "
"more detailed explanation (when relevant)."
msgstr ""
msgstr "在第一行commit信息后添加一行空白行再进行更多相关的细节描述。"
#: ../../../CONTRIBUTING.rst:112
msgid ""
"`Squash your commits`_ to eliminate merge commits and ensure a clean and "
"readable commit history."
msgstr ""
msgstr "`压缩commit`_ 来消除合并commits确保你的commit历史记录是干净可读的。"
#: ../../../CONTRIBUTING.rst:114
msgid ""
@ -245,45 +263,49 @@ msgid ""
" for code style compliance. If any of these checks fail, you should fix "
"them. (If tests fail on the CI system but seem to pass locally, ensure "
"that local test runs aren't skipping any tests.)"
msgstr ""
msgstr "在你发出拉取请求后持续集成CI系统会在所有支持的Python版本上运行测试套件并且"
"检查代码风格的合规性。如果出现了错误你应该将其修复。如果没有通过CI系统上的测试但是本地测试"
"通过了请再检查一下确保在本地进行了所有CI系统中的检查"
#: ../../../CONTRIBUTING.rst:121
msgid "Contribution quality standards"
msgstr ""
msgstr "贡献质量标准"
#: ../../../CONTRIBUTING.rst:123
msgid ""
"Adhere to the project's code style standards. See: `Development "
"Environment`_"
msgstr ""
msgstr "坚持项目的代码风格标准。详见 `开发环境`_"
#: ../../../CONTRIBUTING.rst:124
msgid ""
"Ensure your code is compatible with the `officially-supported Python "
"releases`_."
msgstr ""
msgstr "确保你的代码可以兼容 `python的官方发布版本`_"
#: ../../../CONTRIBUTING.rst:125
msgid ""
"Add docs and tests for your changes. Undocumented and untested features "
"will not be accepted."
msgstr ""
msgstr "请为你修改的内容添加文档与测试。未注有文档或没有对应测试的特性会被拒绝。"
#: ../../../CONTRIBUTING.rst:127
msgid ""
":pelican-doc:`Run all the tests <contribute>` **on all versions of Python"
" supported by Pelican** to ensure nothing was accidentally broken."
msgstr ""
msgstr "**在Pelican支持的所有Python版本上** :pelican-doc:`执行所有测试 <contribute>` ,以确保"
"没有意外的问题。"
#: ../../../CONTRIBUTING.rst:130
msgid ""
"Check out our `Git Tips`_ page or `ask for help`_ if you need assistance "
"or have any questions about these guidelines."
msgstr ""
msgstr "若需要帮助或对以上指南有任何疑惑,还可以查看我们的 `Git提示`_ 页面和 `请求帮助`_ 部分。"
#: ../../contribute.rst:15
msgid "Setting up the development environment"
msgstr ""
msgstr "配置开发环境"
#: ../../contribute.rst:17
msgid ""
@ -292,59 +314,61 @@ msgid ""
" managing virtual environments for separate Python projects that are "
"isolated from one another, so you can use different packages (and package"
" versions) for each."
msgstr ""
msgstr "在配置开发环境时往往有很多种方式,但下面的指南会使用 Pip_ 和 PDM_ 完成配置。这两个工具"
"都可以用于管理虚拟环境使得不同的Python项目相互隔离这样就可以很方便的在不同的项目中使用不同的库以及不同的库版本。"
#: ../../contribute.rst:22
msgid "Please note that Python |min_python| is required for Pelican development."
msgstr ""
msgstr "请注意要进行Pelican的开发至少需要Python |min_python|"
#: ../../contribute.rst:24
msgid ""
"*(Optional)* If you prefer to `install PDM "
"<https://pdm.fming.dev/latest/#installation>`_ once for use with multiple"
" projects, you can install it via::"
msgstr ""
msgstr "*(可选)* 若您想要 `安装PDM <https://pdm.fming.dev/latest/#installation>`_ ,可以使用下面这条命令:"
#: ../../contribute.rst:29
msgid ""
"Point your web browser to the `Pelican repository`_ and tap the **Fork** "
"button at top-right. Then clone the source for your fork and add the "
"upstream project as a Git remote::"
msgstr ""
msgstr "在Web浏览器中进入 `Pelican的代码仓库`_ ,点击右上角的 **Fork** 按钮。然后克隆你自己的这份fork最后添加项目的"
"原仓库为远程仓库upstream"
#: ../../contribute.rst:38
msgid ""
"While PDM can dynamically create and manage virtual environments, we're "
"going to manually create and activate a virtual environment::"
msgstr ""
msgstr "通过下面的命令可以手动创建并激活一个虚拟环境:"
#: ../../contribute.rst:45 ../../contribute.rst:145
msgid "Install the needed dependencies and set up the project::"
msgstr ""
msgstr "安装必需的依赖并配置项目:"
#: ../../contribute.rst:50
msgid "Your local environment should now be ready to go!"
msgstr ""
msgstr "现在,你的本地开发环境就配置完成了!"
#: ../../contribute.rst:57
msgid "Development"
msgstr ""
msgstr "开发"
#: ../../contribute.rst:59
msgid ""
"Once Pelican has been set up for local development, create a topic branch"
" for your bug fix or feature::"
msgstr ""
msgstr "在配置好Pelican的本地开发环境后请先为你的bug修复或特性增加创建一个分支"
#: ../../contribute.rst:64
msgid ""
"Now you can make changes to Pelican, its documentation, and/or other "
"aspects of the project."
msgstr ""
msgstr "在切换到新建的分支后就可以开始对Pelican的文档或其他内容做更改了。"
#: ../../contribute.rst:68
msgid "Running the test suite"
msgstr ""
msgstr "运行测试套件"
#: ../../contribute.rst:70
msgid ""
@ -352,20 +376,21 @@ msgid ""
"regarding tests: check that the existing tests pass, and add tests for "
"any new features or bug fixes. The tests are located in "
"``pelican/tests``, and you can run them via::"
msgstr ""
msgstr "每次对Pelican做出修改后在测试方面需要做两个工作检查是否能通过已有的测试、为新增特性或bug修复"
"创建测试。请将自动化测试文件放在 ``pelican/tests`` 中,接着执行以下命令:"
#: ../../contribute.rst:77
msgid ""
"(For more on Invoke, see ``invoke -l`` to list tasks, or "
"https://pyinvoke.org for documentation.)"
msgstr ""
msgstr "(执行 ``invoke -l`` 会列出可以调用的测试任务,关于此的更多文档请参阅 https://pyinvoke.org "
#: ../../contribute.rst:80
msgid ""
"In addition to running the test suite, it is important to also ensure "
"that any lines you changed conform to code style guidelines. You can "
"check that via::"
msgstr ""
msgstr "除了运行测试套件外,还要确保修改了的部分遵循代码风格指南。可以通过下面的命令检查代码风格:"
#: ../../contribute.rst:85
msgid ""
@ -373,7 +398,8 @@ msgid ""
"lines and re-run the above lint command until they have all been fixed. "
"You do not need to address style violations, if any, for code lines you "
"did not touch."
msgstr ""
msgstr "如果在你修改过的代码中有地方违反了代码风格规范,请纠正并再次运行上述命令,直到全部纠正。"
"但是若是发现违反代码风格的地方并不是你修改的,请忽略之,不要进行纠正。"
#: ../../contribute.rst:89
msgid ""
@ -385,7 +411,9 @@ msgid ""
"update the output used by the functional tests. To do so, **make sure you"
" have both** ``en_EN.utf8`` **and** ``fr_FR.utf8`` **locales installed**,"
" and then run the following command::"
msgstr ""
msgstr "在修改完代码,运行测试的过程中,你可能会看到测试失败中有提到 \"some generated files differ from the expected "
"functional tests output.\" 。这可能是由于你对代码的修改影响到了Pelican的HTML输出若输出的结果确实是你想要的"
"请更新功能测试所用的输出用例。请确保你安装了 ``en_EN.utf8`` 和 ``fr_FR.utf8`` ,然后执行下述命令:"
#: ../../contribute.rst:99
msgid ""
@ -393,7 +421,8 @@ msgid ""
"(e.g., Pandoc) is not installed. This does not automatically mean that "
"these tests have passed; you should at least verify that any skipped "
"tests are not affected by your changes."
msgstr ""
msgstr "你还可能会发现有一些测试由于缺少依赖(例如 Pandoc而被跳过。这并不意味着通过了这些测试请至少确保对代码的修改"
"不会影响到这些被跳过的测试。"
#: ../../contribute.rst:104
msgid ""
@ -401,17 +430,18 @@ msgid ""
"Python. This is best done by creating a separate Python environment for "
"each version. Tox_ is a useful tool to automate running tests inside "
"``virtualenv`` environments."
msgstr ""
msgstr "你应该在支持的所有Python版本下运行测试套件。一般会通过为每一个Python版本创建一个虚拟环境来实现这一点。"
"Tox_ 是一个用于在 ``virtualenv`` 环境中自动运行测试的工具。"
#: ../../contribute.rst:112
msgid "Building the docs"
msgstr ""
msgstr "构建文档"
#: ../../contribute.rst:114
msgid ""
"If you make changes to the documentation, you should build and inspect "
"your changes before committing them::"
msgstr ""
msgstr "若你对文档进行过修改请在commit前完成构建和检查"
#: ../../contribute.rst:119
msgid ""
@ -419,24 +449,26 @@ msgid ""
"While the above task is running, any changes you make and save to the "
"documentation should automatically appear in the browser, as it live-"
"reloads when it detects changes to the documentation source files."
msgstr ""
msgstr "执行上述命令后请在Web浏览器中打开 http://localhost:8000 来查看文档。在上述命令执行时,对文档做的任何修改"
"应该会自动表现在浏览器中。"
#: ../../contribute.rst:125
msgid "Plugin development"
msgstr ""
msgstr "插件开发"
#: ../../contribute.rst:127
msgid ""
"To create a *new* Pelican plugin, please refer to the `plugin template`_ "
"repository for detailed instructions."
msgstr ""
msgstr "要创建一个 *新的* Pelican插件请参阅 `插件模板`_ 仓库以获得更为详细的指导。"
#: ../../contribute.rst:130
msgid ""
"If you want to contribute to an *existing* Pelican plugin, follow the "
"steps above to set up Pelican for local development, and then create a "
"directory to store cloned plugin repositories::"
msgstr ""
msgstr "若你想在 *已有* Pelican插件中做贡献请先按前文所述步骤配置Pelican的本地开发环境然后创建一个"
"文件夹来存放克隆下来的插件仓库:"
#: ../../contribute.rst:136
msgid ""
@ -444,34 +476,36 @@ msgid ""
"would first browse to the `Simple Footnotes`_ repository on GitHub and "
"tap the **Fork** button at top-right. Then clone the source for your fork"
" and add the upstream project as a Git remote::"
msgstr ""
msgstr "假设想要为一个Simple Footnotes插件做贡献你应该先查看并fork `Simple Footnotes`_ 的Github仓库"
"然后克隆你自己fork的那一份再添加原仓库作为Git远程仓库upstream"
#: ../../contribute.rst:149
msgid "Create a topic branch for your plugin bug fix or feature::"
msgstr ""
msgstr "同样地为你想要进行的bug修复或特性添加创建一个分支"
#: ../../contribute.rst:153
msgid ""
"After writing new tests for your plugin changes, run the plugin test "
"suite and check for code style compliance via::"
msgstr ""
msgstr "完成修改并添加测试后,运行测试套件,并检查代码风格:"
#: ../../contribute.rst:159
msgid ""
"If style violations are found, many of them can be addressed "
"automatically via::"
msgstr ""
msgstr "若存在不合规范风格的代码,大多数情况下可以通过下述命令自动纠正:"
#: ../../contribute.rst:163
msgid ""
"If style violations are found even after running the above auto-"
"formatters, you will need to make additional manual changes until "
"``invoke lint`` no longer reports any code style violations."
msgstr ""
msgstr "如果在自动格式化后仍存在代码风格上的问题,请手动修正这些问题,直到执行 ``invoke lint`` "
"时不再报告问题。"
#: ../../contribute.rst:171
msgid "Submitting your changes"
msgstr ""
msgstr "提交更改"
#: ../../contribute.rst:173
msgid ""
@ -479,29 +513,30 @@ msgid ""
"the root of the project that contains the release type (major, minor, "
"patch) and a summary of the changes that will be used as the release "
"changelog entry. For example::"
msgstr ""
msgstr "通过了风格检查和所有测试后,请在项目的根目录下添加一个 ``RELEASE.md`` 文件,其中应包含发布的"
"类型major、minor、patch以及代码变更的摘要这份摘要会被用作更新日志的条目。下面是一个例子"
#: ../../contribute.rst:182
msgid "Commit your changes and push your topic branch::"
msgstr ""
msgstr "commit你的更改并push对应分支"
#: ../../contribute.rst:188
msgid ""
"Finally, browse to your repository fork on GitHub and submit a pull "
"request."
msgstr ""
msgstr "最后前往Github从你fork的仓库向原仓库提出PR。"
#: ../../contribute.rst:192
msgid "Logging tips"
msgstr ""
msgstr "日志指南"
#: ../../contribute.rst:194
msgid "Try to use logging with appropriate levels."
msgstr ""
msgstr "请仔细斟酌合适的日志等级。"
#: ../../contribute.rst:196
msgid "For logging messages that are not repeated, use the usual Python way::"
msgstr ""
msgstr "对于不重复的日志消息,使用一般的方式即可:"
#: ../../contribute.rst:205
#, python-format
@ -509,24 +544,25 @@ msgid ""
"Do not format log messages yourself. Use ``%s`` formatting in messages "
"and pass arguments to logger. This is important, because the Pelican "
"logger will preprocess some arguments, such as exceptions."
msgstr ""
msgstr "请不要自己格式化日志消息,而是使用在日志消息中使用 ``%s`` 并向logger传入参数。请务必"
"遵循这一规则因为Pelican的logger会自动预处理一些特殊的参数例如exception。"
#: ../../contribute.rst:210
msgid "Limiting extraneous log messages"
msgstr ""
msgstr "限制低关联日志消息"
#: ../../contribute.rst:212
msgid ""
"If the log message can occur several times, you may want to limit the log"
" to prevent flooding. In order to do that, use the ``extra`` keyword "
"argument for the logging message in the following format::"
msgstr ""
msgstr "如果日志消息会重复多次,你会希望限制这些多余的内容。使用 ``extra`` 命名参数来实现这一点:"
#: ../../contribute.rst:219
msgid ""
"Optionally, you can also set ``'limit_args'`` as a tuple of arguments in "
"``extra`` dict if your generic message needs formatting."
msgstr ""
msgstr "另外,如果通用日志消息需要格式化,可以添加 ``'limit_args'`` 参数并将其对应值设为一个元组。"
#: ../../contribute.rst:222
msgid ""
@ -534,21 +570,22 @@ msgid ""
" are outputted normally but the fifth one will be logged using "
"``'limit_msg'`` (and ``'limit_args'`` if present). After the fifth, "
"corresponding log messages will be ignored."
msgstr ""
msgstr "限制数默认设为了 ``5`` ,即前四个有相同 ``'limit_msg'`` 参数的日志消息会正常输出,但第五条"
"这样的日志消息会呈现为 ``'limit_msg'`` 参数值本身( ``'limit_args'`` 同理)。第六条及之后的日志消息会被直接忽略。"
#: ../../contribute.rst:227
msgid ""
"For example, if you want to log missing resources, use the following "
"code::"
msgstr ""
msgstr "例如,如果你想要用日志记录资源缺失的信息,可以使用下面的代码:"
#: ../../contribute.rst:235
msgid "The log messages will be displayed as follows::"
msgstr ""
msgstr "最终的日志消息看起来会像这样:"
#: ../../contribute.rst:245
msgid "Outputting traceback in the logs"
msgstr ""
msgstr "在日志中输出traceback信息"
#: ../../contribute.rst:247
msgid ""
@ -557,7 +594,9 @@ msgid ""
"keyword argument to ``True`` during logging. However, doing so by default"
" can be undesired because tracebacks are long and can be confusing to "
"regular users. Try to limit them to ``--debug`` mode like the following::"
msgstr ""
msgstr "当在 ``except`` 块中进行日志记录时你可能会希望同时输出traceback信息。可以简单地将 ``exc_info`` 参数"
"设为 ``True`` 实现这一功能。但是通过此方法输出地traceback信息会非常长不便于理解。可以像下述代码一样将这些"
"信息限制在 ``--debug`` 模式中:"
#~ msgid ""
#~ "Use a search engine (e.g., DuckDuckGo,"

View file

@ -2,8 +2,6 @@
# Copyright (C) 20102023
# This file is distributed under the same license as the Pelican package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2023.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Pelican 4\n"
@ -21,23 +19,23 @@ msgstr ""
#: ../../internals.rst:2
msgid "Pelican internals"
msgstr ""
msgstr "Pelican内部机制"
#: ../../internals.rst:4
msgid ""
"This section describe how Pelican works internally. As you'll see, it's "
"quite simple, but a bit of documentation doesn't hurt. :)"
msgstr ""
msgstr "这一节描述了Pelican的内部运行机制。你会发现Pelican的内部并不复杂。 :)"
#: ../../internals.rst:7
msgid ""
"You can also find in the :doc:`report` section an excerpt of a report the"
" original author wrote with some software design information."
msgstr ""
msgstr "你可以在 :doc:`report` 一节中找到原作者用软件设计相关内容报告的节选。"
#: ../../internals.rst:13
msgid "Overall structure"
msgstr ""
msgstr "总体结构"
#: ../../internals.rst:15
msgid ""
@ -45,18 +43,20 @@ msgid ""
" of output. Usually, the input files are reStructuredText and Markdown "
"files, and the output is a blog, but both input and output can be "
"anything you want."
msgstr ""
msgstr "Pelican做的事情其实很简单获取一个文件列表并将它们处理为某种输出。通常输入文件是"
"reStructuredText和Markdown文件输出是一个博客但事实上输入和输出都可以是你想要的任何内容。"
#: ../../internals.rst:19
msgid "The logic is separated into different classes and concepts:"
msgstr ""
msgstr "系统的整体逻辑可以分为几个不同的类和概念:"
#: ../../internals.rst:21
msgid ""
"**Writers** are responsible for writing files: .html files, RSS feeds, "
"and so on. Since those operations are commonly used, the object is "
"created once and then passed to the generators."
msgstr ""
msgstr "**Writers** 负责完成 html文件、RSS订阅源等等内容。因为这些操作都是比较常用的这个类只会被创建"
"一次然后再传给Generators。"
#: ../../internals.rst:25
msgid ""
@ -64,7 +64,8 @@ msgid ""
"reStructuredText for now, but the system is extensible). Given a file, "
"they return metadata (author, tags, category, etc.) and content (HTML-"
"formatted)."
msgstr ""
msgstr "**Readers** 用于读取不同格式的文件目前支持HTML、Markdown、reStructuredText但可以继续扩展。"
"向**Readers**输入一个文件它会返回文档的元数据作者、标签、分类等等与HTML格式的文档正文内容。"
#: ../../internals.rst:29
msgid ""
@ -72,33 +73,36 @@ msgid ""
"comes with ``ArticlesGenerator`` and ``PageGenerator``. Given a "
"configuration, they can do whatever they want. Most of the time, it's "
"generating files from inputs."
msgstr ""
msgstr "**Generators** 用以生成不同的输出Pelican自带了 ``ArticlesGenerator`` 和 ``PageGenerator`` 。"
"给定一套配置信息, **Generators** 可以做几乎任何事。但大多数情况下,它的工作就是从输入生成文件。"
#: ../../internals.rst:34
msgid ""
"Pelican also uses templates, so it's easy to write your own theme. The "
"syntax is `Jinja2 <https://palletsprojects.com/p/jinja/>`_ and is very "
"easy to learn, so don't hesitate to jump in and build your own theme."
msgstr ""
msgstr "Pelican同样也使用模板因此可以较为简单地编写自定义主题。模板语法使用的是易于学习的 "
"`Jinja2 <https://palletsprojects.com/p/jinja/>`_ ,因此快去构建你自己的主题吧。"
#: ../../internals.rst:39
msgid "How to implement a new reader?"
msgstr ""
msgstr "如何实现一个新的reader"
#: ../../internals.rst:41
msgid ""
"Is there an awesome markup language you want to add to Pelican? Well, the"
" only thing you have to do is to create a class with a ``read`` method "
"that returns HTML content and some metadata."
msgstr ""
msgstr "若是希望为Pelican添加一个标记语言只需要创建一个类实现 ``read`` 方法,并在其中返回元数据"
"和以HTML表示的正文内容。"
#: ../../internals.rst:45
msgid "Take a look at the Markdown reader::"
msgstr ""
msgstr "可以看一看Markdown的reader"
#: ../../internals.rst:71
msgid "Simple, isn't it?"
msgstr ""
msgstr "是不是很简单呢?"
#: ../../internals.rst:73
msgid ""
@ -108,17 +112,19 @@ msgid ""
"mark import success or failure. This makes it possible for users to "
"continue using their favourite markup method without needing to install "
"modules for formats they don't use."
msgstr ""
msgstr "如果新创建的reader需要额外的Python依赖应该把 ``import`` 放在 ``try...except`` 块中。"
"在reader类中设置类属性 ``enabled`` 来标记import是否成功。这使得用户能继续使用他们喜欢的标记语言"
"而无需安装用不到的模块。"
#: ../../internals.rst:80
msgid "How to implement a new generator?"
msgstr ""
msgstr "如何实现一个新的generator"
#: ../../internals.rst:82
msgid ""
"Generators have two important methods. You're not forced to create both; "
"only the existing ones will be called."
msgstr ""
msgstr "generator有两个重要方法。不一定两个都要创建若只创建了一个就会自动调用存在的方法。"
#: ../../internals.rst:85
msgid ""
@ -130,7 +136,10 @@ msgid ""
"the context with them. Be careful *not* to output anything using this "
"context at this stage, as it is likely to change by the effect of other "
"generators."
msgstr ""
msgstr "``generate_context`` 会优先被调用,其中可以完成任何你想要做的事,如果需要的话,还要"
"更新全局上下文。全局上下文会在所有generator间共享并在之后传给模板。例如 ``PageGenerator`` 的 "
"``generate_context`` 方法会找寻所有页面,并将他们转换为对象,再将上下文传入其中。注意,请 *不要* 在"
"此阶段使用该上下文输出任何内容因为其他generator还会继续影响上下文。"
#: ../../internals.rst:93
msgid ""
@ -141,4 +150,7 @@ msgid ""
"this method will look at all the pages recorded in the global context and"
" output a file on the disk (using the writer method ``write_file``) for "
"each page encountered."
msgstr ""
msgstr "``generate_output`` 会在 ``generate_context`` 之后被调用,用于生成要输出的内容。此时就需要使用"
"上下文并调用 ``writer`` 对象的方法,此 ``writer`` 就是传入 ``generate_output`` 方法的第一个参数。"
"``PageGenerator`` 的 ``generate_output`` 方法中会使用writer的 ``write_file`` 方法为全局上下文中的"
"每一个页面输出一个文件。"