complete the translation of tips

This commit is contained in:
GeorgeHu 2023-12-08 19:04:35 +08:00
commit 6760a7e0ae
2 changed files with 103 additions and 73 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,15 +20,15 @@ msgstr ""
#: ../../tips.rst:2
msgid "Tips"
msgstr ""
msgstr "温馨提示"
#: ../../tips.rst:4
msgid "Here are some tips about Pelican that you might find useful."
msgstr ""
msgstr "以下是一些实用的小技巧。"
#: ../../tips.rst:7 ../../tips.rst:208
msgid "Custom 404 Pages"
msgstr ""
msgstr "自定义404页面"
#: ../../tips.rst:9
msgid ""
@ -39,28 +38,31 @@ msgid ""
"matches the theme of your site is to create a custom 404 page (*not* an "
"article), such as this Markdown-formatted example stored in "
"``content/pages/404.md``::"
msgstr ""
msgstr "当浏览器请求的资源无法在服务器中找到时web服务器常常会显示一个通用的 \"File not found\" (404)"
"的错误页面这可能会不太美观。为了能使用一个与站点主题相匹配的404页面注意是页面而 **不是** 文章),"
"例如下面这个Markdown格式的例子将此文件存为了 ``content/pages/404.md`` "
#: ../../tips.rst:22
msgid ""
"The next step is to configure your web server to display this custom page"
" instead of its default 404 page. For Nginx, add the following to your "
"configuration file's ``location`` block::"
msgstr ""
msgstr "下一步就是配置web服务器使其显示此自定义页面而不是默认的404页面。例如对于Nginx在配置文件的 "
"``location`` 块中添加下面的命令:"
#: ../../tips.rst:28
msgid "For Apache::"
msgstr ""
msgstr "对于Apache"
#: ../../tips.rst:32
msgid ""
"For Amazon S3, first navigate to the ``Static Site Hosting`` menu in the "
"bucket settings on your AWS console. From there::"
msgstr ""
msgstr "对于Amazon S3实例先在控制台的设置中找到 ``Static Site Hosting`` ,并添加:"
#: ../../tips.rst:38
msgid "Publishing to GitHub Pages"
msgstr ""
msgstr "发布到GitHub Pages"
#: ../../tips.rst:40
msgid ""
@ -72,21 +74,27 @@ msgid ""
"It's also possible to `use a custom domain with GitHub Pages "
"<https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-"
"github-pages-site>`_."
msgstr ""
msgstr "如果将Pelican站点放在了 `GitHub <https://github.com/>`_ 上,那么你就可以将站点免费发布"
"在 `GitHub Pages <https://pages.github.com/>`_ 上。如果是用户或组织的站点,发布的地址为 "
"``https://<username>.github.io`` ;如果是某个项目的站点,发布的地址则为 ``https://<username>.github.io/<repository>`` 。"
"当然也可以 `在GitHub Pages上使用自定义域名 <https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-"
"github-pages-site>`_ 。"
#: ../../tips.rst:46
msgid ""
"There are `two ways to publish a site to GitHub Pages "
"<https://docs.github.com/en/pages/getting-started-with-github-"
"pages/configuring-a-publishing-source-for-your-github-pages-site>`_:"
msgstr ""
msgstr "总的来说,有 `两种将站点发布到GitHub Pages的方法 <https://docs.github.com/en/pages/getting-started-with-github-"
"pages/configuring-a-publishing-source-for-your-github-pages-site>`_ "
#: ../../tips.rst:48
msgid ""
"**Publishing from a branch:** run ``pelican`` locally and push the output"
" directory to a special branch of your GitHub repo. GitHub will then "
"publish the contents of this branch to your GitHub Pages site."
msgstr ""
msgstr "**从某一分支发布:** 在本地运行 ``pelican`` 后将输出文件夹push到GitHub仓库的某一分支。GitHub"
"就会从该分支将内容发布到GitHub Pages上。"
#: ../../tips.rst:51
msgid ""
@ -97,31 +105,34 @@ msgid ""
"This way you don't need to run ``pelican`` locally. You can even edit "
"your site's source files using GitHub's web interface and any changes "
"that you commit will be published."
msgstr ""
msgstr "**从自定义GitHub Actions工作流发布** 将内容源文件推送到GitHub仓库的默认分支然后依靠GitHub Actions"
"工作流执行 ``pelican`` 以生成输出文件夹最后将其发布到你的GitHub Pages站点。此种方法下就无需在本地执行 ``pelican`` "
"命令了。甚至可以直接在GitHub的网页中在线修改站点内容源文件。"
#: ../../tips.rst:60
msgid "Publishing a Project Site to GitHub Pages from a Branch"
msgstr ""
msgstr "从某一分支发布项目站点到GitHub Pages"
#: ../../tips.rst:62
msgid ""
"To publish a Pelican site as a Project Page you need to *push* the "
"content of the ``output`` dir generated by Pelican to a repository's "
"``gh-pages`` branch on GitHub."
msgstr ""
msgstr "要将Pelican站点发布为项目页面你需要将Pelican生成的 ``output`` 目录 **push** 到GitHub仓库"
"的 ``gh-pages`` 分支。"
#: ../../tips.rst:66
msgid ""
"The excellent `ghp-import <https://github.com/davisp/ghp-import>`_, which"
" can be installed with ``pip``, makes this process really easy."
msgstr ""
msgstr "可通过 ``pip`` 安装的 `ghp-import <https://github.com/davisp/ghp-import>`_ 使这一步变得非常简单。"
#: ../../tips.rst:69
msgid ""
"For example, if the source of your Pelican site is contained in a GitHub "
"repository, and if you want to publish that Pelican site in the form of "
"Project Pages to this repository, you can then use the following::"
msgstr ""
msgstr "例如当Pelican站点的源文件已经包含在GitHub仓库中时可以将其作为此仓库的项目页面"
#: ../../tips.rst:77
msgid ""
@ -129,95 +140,104 @@ msgid ""
"with the content of the ``output`` directory (creating the branch if it "
"doesn't already exist). The ``git push origin gh-pages`` command updates "
"the remote ``gh-pages`` branch, effectively publishing the Pelican site."
msgstr ""
msgstr "``ghp-import output`` 命令会用 ``output`` 目录下的内容更新本地的 ``gh-pages`` 分支(如果此分支不存在"
"则会先创建)。接着再用 ``git push origin gh-pages`` 命令更新远程分支 ``gh-pages`` 如此就能够发布Pelican站点了。"
#: ../../tips.rst:84
msgid ""
"The ``github`` target of the Makefile (and the ``gh_pages`` task of "
"``tasks.py``) created by the ``pelican-quickstart`` command publishes the"
" Pelican site as Project Pages, as described above."
msgstr ""
msgstr "``pelican-quickstart`` 在Makefile文件中所生成的 ``github`` 目标(以及为 ``gh_pages`` 任务生成的 ``tasks.py`` "
"使得Pelican站点能像上面描述的那样被发布为项目页面。"
#: ../../tips.rst:89
msgid "Publishing a User Site to GitHub Pages from a Branch"
msgstr ""
msgstr "从某一分支发布用户站点到GitHub Pages"
#: ../../tips.rst:91
msgid ""
"To publish a Pelican site in the form of User Pages, you need to *push* "
"the content of the ``output`` dir generated by Pelican to the ``master`` "
"branch of your ``<username>.github.io`` repository on GitHub."
msgstr ""
msgstr "要以用户页面形式发布Pelican站点你需要将Pelican生成的 ``output`` 目录内容 **push** 到 ``<username>.github.io`` "
"仓库的 ``master`` 分支上。"
#: ../../tips.rst:95
msgid "Again, you can take advantage of ``ghp-import``::"
msgstr ""
msgstr "同样的,此处也可以使用 ``ghp-import`` "
#: ../../tips.rst:101
msgid ""
"The ``git push`` command pushes the local ``gh-pages`` branch (freshly "
"updated by the ``ghp-import`` command) to the ``elemoine.github.io`` "
"repository's ``master`` branch on GitHub."
msgstr ""
msgstr "``git push`` 命令将本地的 ``gh-pages`` 分支(此分支在刚刚通过 ``ghp-import`` 命令进行了更新)"
"push到了GitHub仓库 ``elemoine.github.io`` 的 ``master`` 分支。"
#: ../../tips.rst:107
msgid ""
"To publish your Pelican site as User Pages, feel free to adjust the "
"``github`` target of the Makefile."
msgstr ""
msgstr "要将Pelican站点发布为用户页面可以根据需要修改Makefile中的 ``github`` 目标"
#: ../../tips.rst:110
msgid ""
"Another option for publishing to User Pages is to generate the output "
"files in the root directory of the project."
msgstr ""
msgstr "发布用户页面的另一种方法就是将输出文件生成在项目的根目录下。"
#: ../../tips.rst:113
msgid ""
"For example, your main project folder is ``<username>.github.io`` and you"
" can create the Pelican project in a subdirectory called ``Pelican``. "
"Then from inside the ``Pelican`` folder you can run::"
msgstr ""
msgstr "例如,项目的主文件夹是 ``<username>.github.io`` ,你可以在子目录 ``Pelican`` 中创建一个Pelican项目。"
"然后你可以在这个 ``Pelican`` 文件夹中执行下面的命令:"
#: ../../tips.rst:119
msgid ""
"Now you can push the whole project ``<username>.github.io`` to the master"
" branch of your GitHub repository::"
msgstr ""
msgstr "接着可以将整个项目 ``<username>.github.io`` push到GitHub仓库的master分支中"
#: ../../tips.rst:124
msgid "(assuming origin is set to your remote repository)."
msgstr ""
msgstr "此处假设远程仓库命名为origin"
#: ../../tips.rst:127
msgid "Publishing to GitHub Pages Using a Custom GitHub Actions Workflow"
msgstr ""
msgstr "使用自定义GitHub Actions工作流将站点发布GitHub Pages中"
#: ../../tips.rst:129
msgid ""
"Pelican comes with a `custom workflow "
"<https://github.com/getpelican/pelican/blob/master/.github/workflows/github_pages.yml>`_"
" for publishing a Pelican site. To use it:"
msgstr ""
msgstr "Pelican已经给你准备了一份 `自定义工作流 "
"<https://github.com/getpelican/pelican/blob/master/.github/workflows/github_pages.yml>`_ "
"你可以直接使用此工作流发布站点:"
#: ../../tips.rst:132
msgid ""
"Enable GitHub Pages in your repo: go to **Settings → Pages** and choose "
"**GitHub Actions** for the **Source** setting."
msgstr ""
msgstr "首先为仓库开启GitHub Pages **Settings → Pages** 中有个 **Source** 设置项,"
"将其选择为 **GitHub Actions** 。"
#: ../../tips.rst:135
msgid ""
"Commit a ``.github/workflows/pelican.yml`` file to your repo with these "
"contents:"
msgstr ""
msgstr "往你的仓库中commit一个 ``.github/workflows/pelican.yml`` 文件,文件内容如下:"
#: ../../tips.rst:154
msgid ""
"Go to the **Actions** tab in your repo "
"(``https://github.com/<username>/<repository>/actions``) and you should "
"see a **Deploy to GitHub Pages** action running."
msgstr ""
msgstr "选中仓库的 **Actions** 标签栏( ``https://github.com/<username>/<repository>/actions`` "
"此时你应该会看到已经有一个名为 **Deploy to GitHub Pages** 的action正在运行。"
#: ../../tips.rst:158
msgid ""
@ -225,132 +245,137 @@ msgid ""
"your repo's GitHub Pages URL: ``https://<username>.github.io`` for a user"
" or organization site or ``https://<username>.github.io/<repository>>`` "
"for a project site."
msgstr ""
msgstr "当此action执行完成就能够通过仓库的GitHub Pages地址 ``https://<username>.github.io`` 看到部署好了"
"的用户或组织站点了,对于项目站点,通过 ``https://<username>.github.io/<repository>`` 访问"
#: ../../tips.rst:163
msgid "Notes:"
msgstr ""
msgstr "注意事项:"
#: ../../tips.rst:165
msgid ""
"You don't need to set ``SITEURL`` in your Pelican settings: the workflow "
"will set it for you"
msgstr ""
msgstr "无需在Pelican配置文件中设置 ``SITEURL`` ,工作流会帮你进行设置。"
#: ../../tips.rst:168
msgid ""
"You don't need to commit your ``--output`` / ``OUTPUT_PATH`` directory "
"(``output/``) to git: the workflow will run ``pelican`` to build the "
"output directory for you on GitHub Actions"
msgstr ""
msgstr "无需commit ``--output`` 或 ``OUTPUT_PATH`` 目录( ``output/`` ):工作流会自己执行 ``pelican`` 命令"
"来构建输出目录。"
#: ../../tips.rst:172
msgid ""
"See `GitHub's docs about reusable workflows "
"<https://docs.github.com/en/actions/using-workflows/reusing-workflows>`_ "
"for more information."
msgstr ""
msgstr "更多信息请参阅 `GitHub可重用工作流文档 <https://docs.github.com/en/actions/using-workflows/reusing-workflows>`_ 。"
#: ../../tips.rst:175
msgid ""
"A number of optional inputs can be added to the ``with:`` block when "
"calling the workflow:"
msgstr ""
msgstr "有一些可选输入可以添加到工作流的 ``with:`` 块中:"
#: ../../tips.rst:179
msgid "Name"
msgstr ""
msgstr "名称"
#: ../../tips.rst:179
msgid "Required"
msgstr ""
msgstr "是否必需"
#: ../../tips.rst:179
msgid "Description"
msgstr ""
msgstr "描述"
#: ../../tips.rst:179
msgid "Type"
msgstr ""
msgstr "值的类型"
#: ../../tips.rst:179
msgid "Default"
msgstr ""
msgstr "默认值"
#: ../../tips.rst:181
msgid "settings"
msgstr ""
msgstr "settings"
#: ../../tips.rst:181
msgid "Yes"
msgstr ""
msgstr ""
#: ../../tips.rst:181
msgid ""
"The path to your Pelican settings file (``pelican``'s ``--settings`` "
"option), for example: ``\"publishconf.py\"``"
msgstr ""
msgstr "Pelican配置文件的路径会被用户 ``pelican`` 命令的 ``--settings`` 选项),例如 ``\"publishconf.py\"`` 。"
#: ../../tips.rst:181 ../../tips.rst:186 ../../tips.rst:193
msgid "string"
msgstr ""
msgstr "string"
#: ../../tips.rst:186
msgid "requirements"
msgstr ""
msgstr "requirements"
#: ../../tips.rst:186 ../../tips.rst:193
msgid "No"
msgstr ""
msgstr ""
#: ../../tips.rst:186
msgid ""
"The Python requirements to install, for example to enable markdown and "
"typogrify use: ``\"pelican[markdown] typogrify\"`` or if you have a "
"requirements file: ``\"-r requirements.txt\"``"
msgstr ""
msgstr "需要安装的Python模块例如要开启markdown和typogrify可指定 ``\"pelican[markdown] typogrify\"`` "
"或者可以指定一个requirements文件 ``\"-r requirements.txt\"`` "
#: ../../tips.rst:186
msgid "``\"pelican\"``"
msgstr ""
msgstr "``\"pelican\"``"
#: ../../tips.rst:193
msgid "output-path"
msgstr ""
msgstr "output-path"
#: ../../tips.rst:193
msgid "Where to output the generated files (``pelican``'s ``--output`` option)"
msgstr ""
msgstr "生成文件的输出位置(会被用于 ``pelican`` 命令的 ``--output`` 选项)"
#: ../../tips.rst:193
msgid "``\"output/\"``"
msgstr ""
msgstr "``\"output/\"``"
#: ../../tips.rst:198
msgid "For example:"
msgstr ""
msgstr "一个例子:"
#: ../../tips.rst:210
msgid ""
"GitHub Pages will display the custom 404 page described above, as noted "
"in the relevant `GitHub docs "
"<https://help.github.com/articles/custom-404-pages/>`_."
msgstr ""
msgstr "如果按前述进行配置GitHub Pages是能够正确显示自定义的404页面的相关内容在 `GitHub的文档中 "
"<https://help.github.com/articles/custom-404-pages/>`_ 也有提到。"
#: ../../tips.rst:214
msgid "Update your site on each commit"
msgstr ""
msgstr "在每次commit后都更新站点"
#: ../../tips.rst:216
msgid ""
"To automatically update your Pelican site on each commit, you can create "
"a post-commit hook. For example, you can add the following to "
"``.git/hooks/post-commit``::"
msgstr ""
msgstr "要想在每次commit后自动更新Pelican站点你可以创建一个post-commit钩子。例如可以将下面的内容保存"
"为 ``.git/hooks/post-commit`` "
#: ../../tips.rst:223
msgid "Copy static files to the root of your site"
msgstr ""
msgstr "将静态文件拷贝到站点根目录"
#: ../../tips.rst:225
msgid ""
@ -361,34 +386,38 @@ msgid ""
"directory and add a ``CNAME`` file to it. Then use the ``STATIC_PATHS`` "
"setting to tell Pelican to copy this file to your output directory. For "
"example::"
msgstr ""
msgstr "要将`自定义域名 <https://help.github.com/articles/setting-up-a-custom-domain-with-pages>`_ "
"与GitHub Pages一起使用需要将站点的域名例如 ``blog.example.com`` )添加到站点根目录的 ``CNAME`` 文件中。"
"为此,请创建 ``content/extra/`` 目录,并在里面添加一个 ``CNAME`` 文件。然后使用Pelican的 ``STATIC_PATHS`` "
"来告诉Pelican将此文件复制到输出目录"
#: ../../tips.rst:236
msgid "Note: use forward slashes, ``/``, even on Windows."
msgstr ""
msgstr "请注意:务必使用正斜杠 ``/`` 在Windows上也是。"
#: ../../tips.rst:238
msgid ""
"You can also use the ``EXTRA_PATH_METADATA`` mechanism to place a "
"``favicon.ico`` or ``robots.txt`` at the root of any site."
msgstr ""
msgstr "利用 ``EXTRA_PATH_METADATA`` 机制,你可以将 ``favicon.ico`` 或 ``robots.txt`` 也拷贝到站点的根目录下。"
#: ../../tips.rst:242
msgid "How to add YouTube or Vimeo Videos"
msgstr ""
msgstr "如何添加YouTube或Vimeo视频"
#: ../../tips.rst:244
msgid ""
"The easiest way is to paste the embed code of the video from these sites "
"directly into your source content."
msgstr ""
msgstr "最简单的方法是将这些网站的视频嵌入代码直接粘贴到您的源内容文件中。"
#: ../../tips.rst:247
msgid ""
"Alternatively, you can also use Pelican plugins like ``liquid_tags``, "
"``pelican_youtube``, or ``pelican_vimeo`` to embed videos in your "
"content."
msgstr ""
msgstr "或者,您还可以使用例如 ``liquid_tags`` 、``pelican_youtube`` 或 ``pelican_vimeo`` 等Pelican插件"
"将视频嵌入。"
#: ../../tips.rst:250
msgid ""
@ -396,35 +425,36 @@ msgid ""
"you embed videos in the markup. You can use `reST video directive "
"<https://gist.github.com/dbrgn/2922648>`_ for reST or `mdx_video plugin "
"<https://github.com/italomaia/mdx-video>`_ for Markdown."
msgstr ""
msgstr "此外像reST和 Markdown这样的标记语言都有对应插件可以让你在其中嵌入视频。可以使用 `reST的视频指令 "
"<https://gist.github.com/dbrgn/2922648>`_ 或者 `Markdown的mdx_video插件 <https://github.com/italomaia/mdx-video>`_ 。"
#: ../../tips.rst:257
msgid "Develop Locally Using SSL"
msgstr ""
msgstr "在本地使用SSL进行开发"
#: ../../tips.rst:259
msgid "Here's how you can set up your local pelican server to support SSL."
msgstr ""
msgstr "以下描述了如何在本地Pelican服务器上配置SSL。"
#: ../../tips.rst:261
msgid ""
"First, create a self-signed certificate and key using ``openssl`` (this "
"creates ``cert.pem`` and ``key.pem``)::"
msgstr ""
msgstr "首先,通过 ``openssl`` 创建自签名的证书和密钥,这会生成 ``cert.pem`` 和 ``key.pem`` 文件:"
#: ../../tips.rst:265
msgid ""
"And use this command to launch the server (the server starts within your "
"``output`` directory)::"
msgstr ""
msgstr "接着使用下面的命令来开启服务器(此服务器会在 ``output`` 目录下开启):"
#: ../../tips.rst:269
msgid "If you are using ``develop-server.sh``, add this to the top::"
msgstr ""
msgstr "如果你使用的是 ``develop-server.sh`` 脚本,在脚本的开头添加:"
#: ../../tips.rst:274
msgid "and modify the ``pelican.server`` line as follows::"
msgstr ""
msgstr "然后修改按照下述修改 ``pelican.server`` 一行:"
#~ msgid "Publishing to GitHub"
#~ msgstr ""