Skip to content

Add Chinese translations for docs: deployment.md - #1203

Merged
tiangolo merged 8 commits into
fastapi:masterfrom
RunningIkkyu:docs_zh_deployment
May 16, 2020
Merged

tiangolo merged 8 commits into
fastapi:masterfrom
RunningIkkyu:docs_zh_deployment

Conversation

@RunningIkkyu

Copy link
Copy Markdown
Contributor

Add Chinese translation for the doc: deployment.md.

@codecov

codecov Bot commented Apr 1, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #1203 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1203   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          226       226           
  Lines         6785      6785           
=========================================
  Hits          6785      6785           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dff644a...6dd8bfd. Read the comment docs.

@vcancy vcancy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty


我们会经常加入新的功能,定期错误修复,同时也在不断的优化项目代码。

这也是为什么当前版本仍然是 `0.x.x`,我们以此表明每个版本都可能有重大改变。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing “ This follows the Semantic Versioning conventions.”

Comment thread docs/zh/docs/deployment.md Outdated

### 指定你的 `FastAPI` 版本

首先,要指定的 **FastAPI** 版本,选择一个能够正确运行你的应用的最新版本。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你应该做的第一件事,是为你正在使用的 FastAPI 指定一个能够正确运行你的应用的最新版本。


### 关于版本

FastAPI 遵循语义版本控制约定,`1.0.0` 以下的任何版本都可能加入重大变更。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FastAPI 遵循语义化版本控制规范,1.0.0 以下的任何版本都可能加入不兼容的变更。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definition of Convension from Oxford:

a way in which something is usually done.
an agreement between states covering particular matters, especially one less formal than a treaty.
"规范" means "Standard, specification or regulation", that's not the right word for it.
So the meaning of Convension should be "约定,协定,习俗" rather than "规范"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are right.

Comment thread docs/zh/docs/deployment.md Outdated

FastAPI 遵循语义版本控制约定,`1.0.0` 以下的任何版本都可能加入重大变更。

FastAPI 也遵循这样的惯例:任何 ”PATCH“ 版本变更都是用来修复 bug 和非重大改变。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FastAPI 也遵循这样的约定:任何 ”PATCH“ 版本变更都是用来修复 bug 和向下兼容的变更。

Comment thread docs/zh/docs/deployment.md Outdated
fastapi>=0.45.0,<0.46.0
```

重大变更和新特性在 "MINOR" 版本中添加。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“重大变更”should be "不兼容变更"

Comment thread docs/zh/docs/deployment.md Outdated

### 更新 FaseAPI 版本

有时需要测试你的应用。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你应该为你的应用添加测试

Comment thread docs/zh/docs/deployment.md Outdated

使用 **FastAPI** 测试应用非常容易(归功于 Starlette),查看文档:[测试](tutorial/testing.md){.internal-link target=_blank}

测试之后,就可以将 **FastAPI** 更新到最近的一个的版本,然后通过运行测试来确定你所有代码都可以正确工作。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“测试之后” should be "有了测试之后“

Comment thread docs/zh/docs/deployment.md Outdated

测试之后,就可以将 **FastAPI** 更新到最近的一个的版本,然后通过运行测试来确定你所有代码都可以正确工作。

如果一切正常,或者做了必要的修改之后,所有的测试都通过了,就可以把 `FastAPI` 版本指定为最新版本了。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

”指定为最新版本了“ should be ”比较新的那个版本了"

Comment thread docs/zh/docs/deployment.md Outdated
这部分,您将通过指引和链接了解到:

* 如何将您的 **FastAPI** 应用制作成最高性能的 **Docker** 映像/容器。约需五分钟。
* (可选)理解作为一个开发者必知的 HTTPS 相关知识。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"必知" is conflict with "可选",should be "需要知道"

Comment thread docs/zh/docs/deployment.md Outdated

</div>

现在 Docker 容器中有一个优化好的 FastAPI 服务器。Docker 会自动调整您当前的服务器(和CPU核心的数量)。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the "Auto-tuned" is executed by uvicorn's configuration instead of Docker.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在你在 Docker 容器中有了一个根据当前服务器(和CPU核心的数量)自动优化好的 FastAPI 服务器。

Comment thread docs/zh/docs/deployment.md Outdated
* 在获得一个安全连接之后,通讯协议仍然是 HTTP。
* HTTP 内容是加密的,即使这些内容使用 HTTP 协议传输。

常见的做法是在服务器(机器,主机等等)上运行一个程序或HTTP 服务来管理所有的 HTTPS 部分:将加密的 HTTP 请求发送给在同一服务器运行的真实 HTTP 应用(在这里是 **FastAPI** 应用),从应用获得 HTTP 响应,使用适当的证书加密响应然后使用 HTTPS 将其发回客户端。这个服务器常被称作 <a href="https://en.wikipedia.org/wiki/TLS_termination_proxy" class="external-link" target="_blank">TLS 终止代理</a>。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“decrypted ” should be “解密后的”。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

个程序或HTTP miss a sapce


Traefik 集成了 Let's Encrypt,所以能够处理全部 HTTPS 的部分,包括证书获取与更新。

Traefik 也集成了 Docker,所以你也可以在每个应用的配置中声明你的域名并可以让它读取这些配置,生成 HTTPS 证书并自动将 HTTPS 提供给你的应用程序,而你不需要对其配置进行任何更改。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

”has integration with sth" should be “可以与某物进行集成”。“Traefik 也集成了 Docker” is incorrect.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afaid I disagree with you. The present perfect is formed using has/have + past participle. We use the present perfect to indicate that an action happened at an unspecified time before now. The Chinese meaning should be "已经做了某事". Don't know where is the word "可以" comes from?

Furthermore, Traefik has intergration with Lets' Encrpyt already. See Feature of Traefix

Comment thread docs/zh/docs/deployment.md Outdated

也许你想编写一些工具来确保它停止时会自动重启。

或者安装 <a href="https://gunicorn.org/" class="external-link" target="_blank">Gunicorn</a> 并 <a href="https://www.uvicorn.org/#running-with-gunicorn" class="external-link" target="_blank">将其作为 Uvicorn 的管理器</a>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing "or use Hypercorn with multiple workers.","或者通过运行多个职程的方式使用 Hypercorn"

Comment thread docs/zh/docs/deployment.md Outdated

或者安装 <a href="https://gunicorn.org/" class="external-link" target="_blank">Gunicorn</a> 并 <a href="https://www.uvicorn.org/#running-with-gunicorn" class="external-link" target="_blank">将其作为 Uvicorn 的管理器</a>

或者保证精确调整 worker 的数量等等。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

切记去精心调整 worker 的数量等配置。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three sentences before etc should be Parallel structure and all three examples are expressing one thing: All these cumbersome things you might want to do, Docker is done for you. To convey that, the meanings shoud be You might also want to make sure fine-tune the number of workers., just as the start of the first two sentences.

Comment thread docs/zh/docs/deployment.md Outdated

部署 **FastAPI** 应用相对比较简单。

根据特定使用情况和使用工具有不同的部署方式。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's need to translation word sveral will be better?
根据特定使用情况和使用工具有几种不同的部署方式。

Comment thread docs/zh/docs/deployment.md Outdated

你应该做的第一件事情,是为你正在使用的 **FastAPI** 指定一个能够正确运行你的应用的最新版本。

例如,应用中正在使用版本 `0.45.0`。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it changes the meaning of the original sentence, missed some words .
It‘s should be:

例如,假设你的应用正在使用 `0.45.0` 版本。 

Comment thread docs/zh/docs/deployment.md Outdated
fastapi==0.45.0
```

这表明您将使用 `0.45.0` 版本的 `FastAPI`。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“您” and “你” should be unified.

Comment thread docs/zh/docs/deployment.md Outdated
* 如何将您的 **FastAPI** 应用制作成最高性能的 **Docker** 映像/容器。约需五分钟。
* (可选)理解作为一个开发者需要知道的 HTTPS 相关知识。
* 使用自动化 HTTPS 设置一个 Docker Swarm 模式的集群,即使是在一个简单的 $5 USD/month 的服务器上。约需要 20 分钟。
* 使用 Docker Swarm 集群以及 HTTP等等,生成和部署一个完整的 **FastAPI** 应用。约需 10 分钟。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space after HTTP

Comment thread docs/zh/docs/deployment.md Outdated

### 启动 Docker 容器

* 基于你的镜像运行容器:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be better with 运行基于你的镜像的容器?

Comment thread docs/zh/docs/deployment.md Outdated
* 在获得一个安全连接之后,通讯协议仍然是 HTTP。
* HTTP 内容是加密的,即使这些内容使用 HTTP 协议传输。

常见的做法是在服务器(机器,主机等等)上运行一个程序或HTTP 服务来管理所有的 HTTPS 部分:将加密的 HTTP 请求发送给在同一服务器运行的真实 HTTP 应用(在这里是 **FastAPI** 应用),从应用获得 HTTP 响应,使用适当的证书加密响应然后使用 HTTPS 将其发回客户端。这个服务器常被称作 <a href="https://en.wikipedia.org/wiki/TLS_termination_proxy" class="external-link" target="_blank">TLS 终止代理</a>。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

个程序或HTTP miss a sapce

Comment thread docs/zh/docs/deployment.md Outdated

但是紧接着 <a href="https://letsencrypt.org/" class="external-link" target="_blank">Let's Encrypt</a> 被创造了。

这是一个来自Linux基金会的项目。它以自动化的方式免费提供HTTPS证书。这些证书使用所有的标准加密措施,且证书生命周期很短(大约 3 个月),正是由于它们生命周期的减短,所以实际上安全性更高。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

miss space before and after Linux HTTPS

Comment thread docs/zh/docs/deployment.md Outdated

### Traefik

<a href="https://traefik.io/" class="external-link" target="_blank">Traefik</a> 是一个高性能的反向代理/负载均衡器。它能够完成「TLS 终止协议」的工作(其他特性除外)。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TLS Termination Proxy should be translated unified. Above be translated as TLS 终止代理

@nczitzk nczitzk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good translation 🎉! I requested some minor suggesting changes here. Hope it helps 😃.


获取这些证书的过程曾经非常繁琐,需要大量的文书工作,而且证书的价格也相当昂贵。

但是紧接着 <a href="https://letsencrypt.org/" class="external-link" target="_blank">Let's Encrypt</a> 被创造了。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

但是紧接着 Let's Encrypt 被创造了 sounds a bit odd, although the original text is But then Let's Encrypt was created.

I think 但是紧接着 Let's Encrypt 出现了 is just fine 😃.

If insisting on not missing created, I would say 但是紧接着 Let's Encrypt 应运而生 and the context also makes sense:

We were supposed to do blablabla to acquire these certificates, however, some people decided to create something since the process was cumbersome and expensive...and then we have Let's Encrypt. 🎉


保证精确调整 worker 的数量等等。

但是如果你正做这些,你可能只需要使用 Docker 镜像就能够自动做到这些了。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

但是如果你正做着所有这些操作,你可以仅使用 Docker 镜像自动执行它们。

  • all that should be 所有这些. I thought Docker image could only set up some tooling to make sure it is restarted automatically if it stops at the outset 😅.
  • 这些 are unclear in the context. I suggest adding 操作 after 这些, since 英语多替代,汉语多重复.
  • might just use should be 可以仅使用.
  • does it automatically refers to does all that you are doing automatically. Here should be 自动执行你正做着的所有这些操作 and we can say 自动执行它们.

@tiangolo
tiangolo merged commit f67bc3f into fastapi:master May 16, 2020
@tiangolo

Copy link
Copy Markdown
Member

Thanks for your contribution @RunningIkkyu ! 🚀 🎉 🙇

And thanks for the comments and reviews @Dustyposa , @nczitzk , @vcancy , @songzhi , @waynerv ! ☕ 🍰

As it has several approvals I'm gonna merge it as it is right now, so that we have the current version live. And if any of you think it can be improved/updated then we can do that in additional PRs on top, and we can continue the discussion in those new PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants