此仓库包含 React 中文文档 的文档及源码,并由官方实时同步。
翻译基本接近尾声,但文档中也有可能存在疏漏之处。
如在阅读文档中,遇到文档的问题可直接 PR 修改。
也可添加反馈群。我们会及时给出反馈。
当然也可以在群里交流 React 相关的交流心得,非常欢迎。
希望大家共同把这个文档维护好,造福更多 React 开发者。
扫码添加 React 文档交流反馈群 | 添加 docschina-bot |
---|---|
注:添加机器人成功后(添加时回复没用哟),向机器人回复关键字
react
,即可加群。
翻译流程:
- 挑选你想要翻译或校对的文章 New Chinese Website: TODOs
- 请 fork 这个仓库
- 基于 fork 后的仓库中 master 分支拉取一个新的分支(名字自取)
- 翻译(校对)你所选择的文章,提交到新的分支
- 此时提交 Pull Request 到该仓库
- 会有专人 Review 该 Pull Request,当两人以上通过该 Pull Request 时,你的翻译将被合并到仓库中
- 删除你所创建的分支(如继续参与,参考同步流程)
同步流程:
-
添加该 repo 为你 fork 后仓库上游
$ git remote add upstream [email protected]:reactjs/zh-hans.reactjs.org.git or $ git remote add upstream https://github.com/reactjs/zh-hans.reactjs.org.git
-
同步 git fetch 上游代码
$ git checkout master && git fetch upstream
-
将上游代码合并至你 fork 后的仓库(master 分支)中,保证你的 master 分支永远是最新版本
$ git merge upstream/master
-
重复翻译流程
注意:
- 同步时不应产生 Merge 相关的 commit
- 尽量保证一次 PR 只有一篇文章,便于后续校对和维护
词汇表(Glossary):
大家在翻译过程中会遇到不需要翻译的内容,可以添加到词汇表中。
项目起步,部分内容逐步完善中。后续会添加相关流程图片,便于理解。 该流程我继续细化,如有疑问。
Translation Process:
- Choose the article you want to translate or proofread New Chinese Website: TODOs
- Please fork this repo
- In the repo after fork, create a new branch (custom branch name) based on the master branch.
- Translation or proofread article, and commit your branch
- Commit your PR to this repo
- Please wait for Review.
- When PR merge to this repo, you can delete your branch.
Synchronization Process:
-
Add the repo to become the remote upstream of your fork repo
$ git remote add upstream [email protected]:reactjs/zh-hans.reactjs.org.git or $ git remote add upstream https://github.com/reactjs/zh-hans.reactjs.org.git
-
Fetch remote upstream
$ git fetch upstream
-
Merge upstream/master to your repo/master
$ git checkout master && git merge upstream/master
-
Re-execute the translation process
- Git
- Node: any 8.x version starting with 8.4.0 or greater
- Yarn: See Yarn website for installation instructions
- A fork of the repo (for any contributions)
- A clone of the reactjs.org repo on your local machine
cd reactjs.org
to go into the project rootyarn
to install the website's npm dependencies
yarn dev
to start the hot-reloading development server (powered by Gatsby)open http://localhost:8000
to open the site in your favorite browser
The documentation is divided into several sections with a different tone and purpose. If you plan to write more than a few sentences, you might find it helpful to get familiar with the contributing guidelines for the appropriate sections.
git checkout master
from any folder in your localreactjs.org
repositorygit pull origin master
to ensure you have the latest main codegit checkout -b the-name-of-my-branch
(replacingthe-name-of-my-branch
with a suitable name) to create a branch
- Follow the "Running locally" instructions
- Save the files and check in the browser
- Changes to React components in
src
will hot-reload - Changes to markdown files in
content
will hot-reload - If working with plugins, you may need to remove the
.cache
directory and restart the server
- If possible, test any visual changes in all latest versions of common browsers, on both desktop and mobile.
- Run
yarn check-all
from the project root. (This will run Prettier, ESLint, and Flow.)
git add -A && git commit -m "My message"
(replacingMy message
with a commit message, such asFix header logo on Android
) to stage and commit your changesgit push my-fork-name the-name-of-my-branch
- Go to the reactjs.org repo and you should see recently pushed branches.
- Follow GitHub's instructions.
- If possible, include screenshots of visual changes. A Netlify build will also be automatically created once you make your PR so other people can see your change.
If you are interested in translating reactjs.org
, please see the current translation efforts at isreacttranslatedyet.com.
If your language does not have a translation and you would like to create one, please follow the instructions at reactjs.org Translations.
yarn reset
to clear the local cache
Content submitted to reactjs.org is CC-BY-4.0 licensed, as found in the LICENSE-DOCS.md file.