文档

This introductory guide will help you acquire the tools and knowledge needed to contribute to the documentation.

Read the introduction to the reStructuredText language if you are not familiar with it. Then, there are two courses of action to start contributing to the documentation:

  • For minor changes, such as adding a paragraph or fixing a typo, we recommend using the GitHub interface. This is the easiest and fastest way to submit changes, and it is suitable for non-technical people. Jump directly to the Contributing to the documentation section to get started.

  • For more complex changes, such as adding a new page, it is necessary to use Git and work from a local copy of the documentation. Follow the instructions in the 环境设置 section first to prepare your environment.

重构文本 (RST)

The documentation is written in reStructuredText (RST), a lightweight markup language consisting of regular text augmented with markup, which allows including headings, images, notes, and so on. RST is easy to use, even if you are not familiar with it.

重要

Be mindful of our content and RST guidelines as you write documentation. This ensures that the documentation stays consistent and facilitates the approval of changes by the Odoo team.

环境设置

下面的说明帮助您准备环境以便在本地对文档进行修改,然后将其推送到 GitHub。如果您已经完成了这一步骤或者想要从 GitHub 界面进行修改,请跳过本节并转到 Contributing to the documentation

  1. First, create a GitHub account. Odoo uses GitHub to manage the source code of its products, and this is where you will submit your changes.

  2. Generate a new SSH key and register it on your GitHub account.

  3. 前往 github.com/odoo/documentation 并点击右上角的 Fork 按钮来创建一个分支 (你自己的副本) 到你的账户。这将创建一个代码库的副本,你可以在其中进行更改而不影响主要代码库。如果你在 Odoo 工作,则跳过此步骤。

  4. Install Git. It is a command-line (a text interface) tool that allows tracking the history of changes made to a file and, more importantly, working on different versions of that file simultaneously. It means you do not need to worry about overwriting someone else’s pending work when making changes.

    请确认 Git 的安装目录已经包含在您系统的 PATH 变量中。

    按照 在Linux和macOS上更新PATH变量的指南 使用Git的安装路径(默认为 /usr/bin/git)进行操作。

  5. 配置 Git 以标识您为将来贡献的作者。输入您在 GitHub 注册时使用的相同电子邮件地址。

    $ git config --global user.name "Your Name"
    $ git config --global user.email "youremail@example.com"
    
  6. 使用 Git 克隆源代码并进入本地仓库。

    $ git clone git@github.com:odoo/documentation.git
    $ cd documentation
    
  7. 配置 Git 将更改推送到您的 fork 而不是主代码库。在下面的命令中,将 <your_github_account> 替换为您创建 fork 的 GitHub 帐户的名称。如果您在 Odoo 工作,则跳过此步骤。

    $ git remote add dev git@github.com:<your_github_account>/documentation.git
    
  8. 配置 Git 以便于不同系统的作者之间进行协作。

    $ git config --global core.autocrlf input
    $ git config commit.template `pwd`/commit_template.txt
    
  9. Install the latest release of Python and pip.

  10. 使用pip安装文档的Python依赖项。

    $ pip install -r requirements.txt
    

    验证 Python 依赖项的安装目录是否包含在系统的 PATH 变量中。

    按照 在Linux和macOS上更新PATH变量的指南,使用Python依赖项的安装路径(默认为 ~/.local/bin)进行操作。

  11. 安装 Make。

    $ sudo apt install make -y
    
  12. Install pngquant.

  13. You are now ready to make your first contribution with Git.

Contributing to the documentation

  1. First, create a GitHub account. Odoo uses GitHub to manage the source code of its products, and this is where you will submit your changes.

  2. 请确认您正在浏览您想要更改的文档版本。您可以从顶部菜单中的下拉菜单中选择版本。

  3. 前往您想要更改的页面,然后点击页面右上角的 在 GitHub 上编辑 按钮。

  4. 点击 Fork this repository 按钮创建一个分支 (你自己的副本) 到你的账户上。这将创建一个代码库的副本,你可以在其中进行更改而不影响主要的代码库。如果你在 Odoo 工作,则跳过此步骤。

    ../_images/fork-repository.png
  5. 在进行所需更改时,请注意遵循 contentRST 指南。

    小技巧

    点击 预览更改 按钮以以更易读的格式查看您的贡献。请注意,预览无法正确处理所有标记。例如,注释和提示将显示为纯文本。

  6. 滚动到页面底部并填写小表单以提出您的更改。在第一个文本框中,写下您更改的非常简短的摘要。例如,”修复一个拼写错误”或”添加销售订单发票的文档”。在第二个文本框中,解释 为什么 您提出这些更改。然后,点击 提出更改 按钮。

    ../_images/propose-changes.png
  7. 审核您的更改并单击 创建拉取请求 按钮。

  8. 勾选 Allow edits from maintainer 复选框。如果你在 Odoo 工作,则跳过此步骤。

  9. Review the summary that you wrote about your changes and click on the Create pull request button again.

  10. 在页面底部,检查合并状态并解决任何问题。

  11. As soon as your PR is ready for merging, a member of the Odoo team is automatically assigned for review. If the reviewer has questions or remarks, they will post them as comments and you will be notified by email. Those comments must be resolved for the contribution to go forward.

  12. Once your changes are approved, the reviewer merges them and they appear online the next day.