Skip to content

Commit f2c868e

Browse files
authored
Merge pull request #3496 from Dilettante258/source
Chinese translation update for Part 4
2 parents 5c429d2 + 4bd6fd2 commit f2c868e

36 files changed

+1195
-1228
lines changed

src/content/0/zh/part0a.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ lang: zh
396396
### Interview promise
397397

398398
<!-- Our collaborators, [Houston Inc.](https://houston-inc.com/), [Terveystalo](https://www.terveystalo.com/en/) and [Smartly.io](https://www.smartly.io/), have given the <i>promise of a job interview</i> for everyone who completes the course and the project work with maximum credits (14 + 10). The parts 12 and 13 that were released during 2021 are not required if you finish the project by 15.3.2022.-->
399-
我们的合作者,[Houston Inc.](https://houston-inc.com/)[Terveystalo](https://www.terveystalo.com/en/)[Smartly.io](https://www.smartly.io/),已经给了每个完成课程和项目工作并获得最高学分(14+10)的人一个工作面试的<i>承诺</i>。如果你在2022年3月15日之前完成项目,那么2021年发布的第12和13章节就不需要了。
399+
我们的合作者,[Houston Inc.](https://houston-inc.com/)[Terveystalo](https://www.terveystalo.com/en/)[Smartly.io](https://www.smartly.io/),已经给了每个完成课程和项目工作并获得最高学分(14+10)的人一个工作面试的<i> promise </i>。如果你在2022年3月15日之前完成项目,那么2021年发布的第12和13章节就不需要了。
400400

401401
<!-- This means that the student can, if they so choose, sign up for a job interview with a collaborator who has given the promise. The teacher of the course, Matti Luukkainen, will send instructions to the student after the courses have been completed with maximum credits.-->
402402
这意味着,如果学生选择,报名参加合作方的工作面试。课程的老师Matti Luukkainen会给课程完成后并获得最大的学分的学生发送指引。

src/content/10/zh/part10c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fetch('https://my-api.com/post-end-point', {
5252
注意,这些URL是编造的,不会(很可能)对你的请求发出响应。与Axios相比,Fetch API的操作水平要低一些。例如,没有任何请求或响应体的序列化和解析。这意味着你必须自己设置<i>Content-Type</i>头并使用<em>JSON.stringify</em>方法来序列化请求体。
5353

5454
<!-- The <em>fetch</em> function returns a promise which resolves a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) object. Note that error status codes such as 400 and 500 <i>are not rejected</i> like for example in Axios. In case of a JSON formatted response we can parse the response body using the <em>Response.json</em> method:-->
55-
<em>fetch</em>函数返回一个承诺,它解决了一个[Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) 对象。请注意,错误状态代码如400和500 <i>不会被拒绝</i>,例如在Axios中。如果是JSON格式的响应,我们可以使用<em>Response.json</em>方法解析响应体。
55+
<em>fetch</em>函数返回一个 promise ,它解决了一个[Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) 对象。请注意,错误状态代码如400和500 <i>不会被拒绝</i>,例如在Axios中。如果是JSON格式的响应,我们可以使用<em>Response.json</em>方法解析响应体。
5656

5757
```javascript
5858
const fetchMovies = async () => {

src/content/12/zh/part12a.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ lang: zh
3636
尽管应用在你的机器上运行得很好,但它就是不能在服务器上运行,这种情况并不罕见。这可能是由于某些依赖性的缺失或环境的其他差异。在这里,容器是一个很好的解决方案,因为你可以在你的机器和服务器上的同一执行环境中运行应用。这并不完美:不同的硬件可能是一个问题,但你可以限制环境之间的差异。
3737

3838
<!-- Sometimes you may hear about the <i>"Works in my container"</i> issue. The phrase describes a situation in which the application works fine in a container running on your machine but breaks when the container is started on a server. The phrase is a play on the infamous <i>"Works on my machine"</i> issue, which containers are often promised to solve. The situation also is most likely a usage error.-->
39-
有时你可能会听到<i>"在我的容器中工作"</i>问题。这句话描述了这样一种情况:应用在你的机器上运行的容器中工作正常,但当容器在服务器上启动时就会中断。这句话是对臭名昭著的<i>"在我的机器上工作"</i>问题的一种戏谑,容器通常被承诺解决这个问题。这种情况也很可能是一个使用错误。
39+
有时你可能会听到<i>"在我的容器中工作"</i>问题。这句话描述了这样一种情况:应用在你的机器上运行的容器中工作正常,但当容器在服务器上启动时就会中断。这句话是对臭名昭著的<i>"在我的机器上工作"</i>问题的一种戏谑,容器通常被 promise 解决这个问题。这种情况也很可能是一个使用错误。
4040

4141
### About this part ###
4242

@@ -234,7 +234,7 @@ For more examples and ideas, visit:
234234
```
235235

236236
<!-- The output contains a few new things for us to learn. <i>Docker daemon</i> is a background service that makes sure the containers are running, and we use the <i>Docker client</i> to interact with the daemon. We now have interacted with the first image and created a container from the image. During the execution of that container, we received the output.-->
237-
这个输出包含了一些新的东西供我们学习。<i>Docker daemon</i>是一个后台服务,它确保了容器的运行,我们使用<i>Docker client</i>来与daemon交互。现在我们已经与第一个镜像进行了交互,并从该镜像中创建了一个容器。在该容器的执行过程中,我们收到了这样的输出。
237+
这个输出包含了一些新的东西供我们学习。<i>Docker daemon</i>是一个后端服务,它确保了容器的运行,我们使用<i>Docker client</i>来与daemon交互。现在我们已经与第一个镜像进行了交互,并从该镜像中创建了一个容器。在该容器的执行过程中,我们收到了这样的输出。
238238

239239
</div>
240240

src/content/12/zh/part12b.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ services:
368368
现在我们可以使用_docker-compose up_来构建和运行该应用。如果我们想重建图像,可以使用_docker-compose up --build_。
369369
370370
<!-- You can also run the application in the background with _docker-compose up -d_ (_-d_ for detached) and close it with _docker-compose down_.-->
371-
你也可以用_docker-compose up -d_ (_-d_表示分离)在后台运行应用,用_docker-compose down_关闭它。
371+
你也可以用_docker-compose up -d_ (_-d_表示分离)在后端运行应用,用_docker-compose down_关闭它。
372372
373373
<!-- Creating files like this that <i>declare</i> what you want instead of script files that you need to run in a specific order / a specific number of times is often a great practice.-->
374374
创建像这样的文件,<i>声明</i>你想要的东西,而不是你需要按特定顺序/特定次数运行的脚本文件,通常是一个很好的做法。
@@ -432,7 +432,7 @@ services:
432432
你可以使用_-f_标志来指定一个<i>文件</i>来运行Docker Compose命令,例如:_docker-compose -f docker-compose.dev.yml up_。现在,我们可能有多个它's useful.
433433
434434
<!-- Now start the MongoDB with _docker-compose -f docker-compose.dev.yml up -d_. With _-d_ it will run it in the background. You can view the output logs with _docker-compose -f docker-compose.dev.yml logs -f_. There the _-f_ will ensure we <i>follow</i> the logs.-->
435-
现在用_docker-compose -f docker-compose.dev.yml up -d_启动MongoDB。使用_-d_,它将在后台运行。你可以用_docker-compose -f docker-compose.dev.yml logs -f_查看输出日志。那里的_-f_将确保我们<i>遵循</i>日志。
435+
现在用_docker-compose -f docker-compose.dev.yml up -d_启动MongoDB。使用_-d_,它将在后端运行。你可以用_docker-compose -f docker-compose.dev.yml logs -f_查看输出日志。那里的_-f_将确保我们<i>遵循</i>日志。
436436
437437
<!-- As said previously, currently we <strong>do not</strong> want to run the Node application inside a container. Developing while the application itself is inside a container is a challenge. We will explore that option in the later in this part.-->
438438
如前所述,目前我们<strong>不</strong>想在容器中运行Node应用。在应用本身处于容器内时进行开发是一个挑战。我们将在本章节的后面探讨这个选项。
@@ -638,7 +638,7 @@ volumes:
638638
Docker命令[exec](https://docs.docker.com/engine/reference/commandline/exec/)是一个重击手。它可以用来在一个容器运行时直接跳入它。
639639

640640
<!-- Let's start a web server in the background and do a little bit of debugging to get it running and displaying the message "Hello, exec!" in our browser. Let's choose [Nginx](https://www.nginx.com/) which is, among other things, a server capable of serving static HTML files. It has a default index.html that we can replace.-->
641-
让我们在后台启动一个Web服务器,做一点调试,让它运行并在浏览器中显示 "Hello, exec!"的信息。让我们选择[Nginx](https://www.nginx.com/),除此之外,它是一个能够提供静态HTML文件的服务器。它有一个默认的index.html,我们可以替换它。
641+
让我们在后端启动一个Web服务器,做一点调试,让它运行并在浏览器中显示 "Hello, exec!"的信息。让我们选择[Nginx](https://www.nginx.com/),除此之外,它是一个能够提供静态HTML文件的服务器。它有一个默认的index.html,我们可以替换它。
642642

643643
```bash
644644
$ docker container run -d nginx
@@ -863,13 +863,13 @@ Emitted 'error' event on RedisClient instance at:
863863
#### Exercise 12.10:
864864

865865
<!-- The project already has [https://www.npmjs.com/package/redis](https://www.npmjs.com/package/redis) installed and two functions "promisified" - getAsync and setAsync.-->
866-
该项目已经安装了[https://www.npmjs.com/package/redis](https://www.npmjs.com/package/redis)和两个 "承诺 "的函数--getAsync和setAsync。
866+
该项目已经安装了[https://www.npmjs.com/package/redis](https://www.npmjs.com/package/redis)和两个 " promise "的函数--getAsync和setAsync。
867867

868868
<!-- - setAsync function takes in key and value, using the key to store the value.-->
869869
- setAsync函数接收键和值,用键来存储值。
870870

871871
<!-- - getAsync function takes in key and returns the value in a promise.-->
872-
- getAsync函数接收键并在一个承诺中返回值
872+
- getAsync函数接收键并在一个 promise 中返回值
873873

874874
<!-- Implement a todo counter that saves the number of created todos to Redis:-->
875875
实现一个todo计数器,将创建的todos的数量保存到Redis。

src/content/12/zh/part12c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ COPY --from=build-stage /usr/src/app/build /usr/share/nginx/html # highlight-lin
172172
先在容器外运行前端,确保它能与后端一起工作。
173173

174174
<!-- Containerize the application by creating <i>todo-app/todo-frontend/Dockerfile</i> and use [ENV](https://docs.docker.com/engine/reference/builder/#env) instruction to pass *REACT\_APP\_BACKEND\_URL* to the application and run it with the backend. The backend should still be running outside a container. Note that you need to set *REACT\_APP\_BACKEND\_URL* before the frontend is build, otherwise it does not get defined in the code!-->
175-
通过创建<i>todo-app/todo-frontend/Dockerfile</i>来容器化应用,并使用[ENV](https://docs.docker.com/engine/reference/builder/#env)指令将*REACT\_APP\_BACKEND\_URL*传递给应用并与后端一起运行。后台应该仍然在容器外运行。请注意,你需要在构建前端之前设置*REACT\_APP\_BACKEND\_URL*,否则它就不会在代码中被定义!
175+
通过创建<i>todo-app/todo-frontend/Dockerfile</i>来容器化应用,并使用[ENV](https://docs.docker.com/engine/reference/builder/#env)指令将*REACT\_APP\_BACKEND\_URL*传递给应用并与后端一起运行。后端应该仍然在容器外运行。请注意,你需要在构建前端之前设置*REACT\_APP\_BACKEND\_URL*,否则它就不会在代码中被定义!
176176

177177
#### Exercise 12.14: Testing during the build process
178178

src/content/13/zh/part13a.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ lang: zh
8585
然而,我们将利用在Heroku云服务平台上为应用创建Postgres数据库的优势,这一点在第3和第4章节中已经很熟悉。
8686

8787
<!-- In the theory material of this section, we will be building a Postgres-enabled version from the backend of the notes-storage application, which was built in sections 3 and 4.-->
88-
在本节的理论材料中,我们将从第3和第4节中建立的笔记存储应用的后台建立一个支持Postgres的版本
88+
在本节的理论材料中,我们将从第3和第4节中建立的笔记存储应用的后端建立一个支持Postgres的版本
8989

9090
<!-- Now let's create a suitable directory inside the Heroku application, add a database to it and use the _heroku config_ command to get the <i>connect string</i>, which is required to connect to the database:-->
9191
现在让我们在Heroku应用中创建一个合适的目录,在其中添加一个数据库,并使用_heroku config_命令来获得<i>连接字符串</i>,这是连接数据库所需要的。

src/content/13/zh/part13c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ npx sequelize-cli model:generate --name User --attributes name:string,username:s
16041604
大结局:[在第四章节的末尾](/en/part4/token_authentication#problems-of-token-based-authentication)提到了一个token-criticality问题:如果一个用户对系统的访问被决定撤销,该用户仍然可以使用手中的token来使用该系统。
16051605
16061606
<!-- The usual solution to this is to store a record of each token issued to the client in the backend database, and to check with each request whether access is still valid. In this case, the validity of the token can be removed immediately if necessary. Such a solution is often referred to as a <i>server-side session</i>.-->
1607-
对此,通常的解决方案是在后台数据库中存储发给客户的每个令牌的记录,并在每次请求时检查访问是否仍然有效。在这种情况下,必要时可以立即删除令牌的有效性。这样的解决方案通常被称为<i>服务器端会话</i>
1607+
对此,通常的解决方案是在后端数据库中存储发给客户的每个令牌的记录,并在每次请求时检查访问是否仍然有效。在这种情况下,必要时可以立即删除令牌的有效性。这样的解决方案通常被称为<i>服务器端会话</i>
16081608
16091609
<!-- Now expand the system so that the user who has lost access will not be able to perform any actions that require login.-->
16101610
现在扩展系统,使失去访问权的用户无法执行任何需要登录的操作。

0 commit comments

Comments
 (0)