XBaith commented on a change in pull request #9097:
URL: https://github.com/apache/flink/pull/9097#discussion_r417755148



##########
File path: docs/getting-started/tutorials/datastream_api.zh.md
##########
@@ -203,26 +178,20 @@ DataStream<Tuple2<String, Long>> result = keyedEdits
     });
 {% endhighlight %}
 
-The first call, `.timeWindow()`, specifies that we want to have tumbling 
(non-overlapping) windows
-of five seconds. The second call specifies a *Aggregate transformation* on 
each window slice for
-each unique key. In our case we start from an initial value of `("", 0L)` and 
add to it the byte
-difference of every edit in that time window for a user. The resulting Stream 
now contains
-a `Tuple2<String, Long>` for every user which gets emitted every five seconds.
+首先调用 `.timeWindow()` 方法指定五秒翻滚(非重叠)窗口。第二个调用方法对于每一个唯一关键字指定每个窗口片`聚合转换`。
+在本例中,我们从 `("",0L)` 初始值开始,并将每个用户编辑的字节添加到该时间窗口中。对于每个用户来说,结果流现在包含的元素为 
`Tuple2<String, Long>`,它每5秒发出一次。

Review comment:
       注意中文和数字之间留有空格:“它每 5 秒发出一次。”

##########
File path: docs/getting-started/tutorials/datastream_api.zh.md
##########
@@ -203,26 +178,20 @@ DataStream<Tuple2<String, Long>> result = keyedEdits
     });
 {% endhighlight %}
 
-The first call, `.timeWindow()`, specifies that we want to have tumbling 
(non-overlapping) windows
-of five seconds. The second call specifies a *Aggregate transformation* on 
each window slice for
-each unique key. In our case we start from an initial value of `("", 0L)` and 
add to it the byte
-difference of every edit in that time window for a user. The resulting Stream 
now contains
-a `Tuple2<String, Long>` for every user which gets emitted every five seconds.
+首先调用 `.timeWindow()` 方法指定五秒翻滚(非重叠)窗口。第二个调用方法对于每一个唯一关键字指定每个窗口片`聚合转换`。

Review comment:
       "tumbling windows" 一般翻译为“滚动窗口”

##########
File path: docs/getting-started/tutorials/datastream_api.zh.md
##########
@@ -203,26 +178,20 @@ DataStream<Tuple2<String, Long>> result = keyedEdits
     });
 {% endhighlight %}
 
-The first call, `.timeWindow()`, specifies that we want to have tumbling 
(non-overlapping) windows
-of five seconds. The second call specifies a *Aggregate transformation* on 
each window slice for
-each unique key. In our case we start from an initial value of `("", 0L)` and 
add to it the byte
-difference of every edit in that time window for a user. The resulting Stream 
now contains
-a `Tuple2<String, Long>` for every user which gets emitted every five seconds.
+首先调用 `.timeWindow()` 方法指定五秒翻滚(非重叠)窗口。第二个调用方法对于每一个唯一关键字指定每个窗口片`聚合转换`。

Review comment:
       “窗口切片” is better

##########
File path: docs/getting-started/tutorials/datastream_api.zh.md
##########
@@ -286,15 +255,14 @@ public class WikipediaAnalysis {
 }
 {% endhighlight %}
 
-You can run this example in your IDE or on the command line, using Maven:
+你可以在你的IDE中或者命令行中,使用Maven命令运行这个代码实例:

Review comment:
       中文和英文之间留有空格

##########
File path: docs/getting-started/tutorials/datastream_api.zh.md
##########
@@ -351,48 +309,43 @@ result
     .addSink(new FlinkKafkaProducer011<>("localhost:9092", "wiki-result", new 
SimpleStringSchema()));
 {% endhighlight %}
 
-The related classes also need to be imported:
+相关类也需要导入:
 {% highlight java %}
 import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer011;
 import org.apache.flink.api.common.serialization.SimpleStringSchema;
 import org.apache.flink.api.common.functions.MapFunction;
 {% endhighlight %}
 
-Note how we first transform the Stream of `Tuple2<String, Long>` to a Stream 
of `String` using
-a MapFunction. We are doing this because it is easier to write plain strings 
to Kafka. Then,
-we create a Kafka sink. You might have to adapt the hostname and port to your 
setup. `"wiki-result"`
-is the name of the Kafka stream that we are going to create next, before 
running our program.
-Build the project using Maven because we need the jar file for running on the 
cluster:
+注意我们是如何使用 MapFunction 将 `Tuple2<String,Long>` 流转换为 `字符串` 流。这样做的原因是因为将普通字符串写入到 
Kafka 更容易。然后,我们会创建一个 Kafka 输出。你可能需要根据你的设置去调整主机名和端口。`wiki-result`
+是我们接下来在运行程序之前创建的 Kafka 流的主题。由于我们需要在集群上运行 jar 文件,这里使用 Maven 构建项目:
 
 {% highlight bash %}
 $ mvn clean package
 {% endhighlight %}
 
-The resulting jar file will be in the `target` subfolder: 
`target/wiki-edits-0.1.jar`. We'll use
-this later.
+上述命令将会生成一个在`target`目录中的 jar 文件,具体文件如下:`target/wiki-edits-0.1.jar`,之后我们将使用这个文件。
 
-Now we are ready to launch a Flink cluster and run the program that writes to 
Kafka on it. Go
-to the location where you installed Flink and start a local cluster:
+现在我们准备启动一个 Flink 集群,然后运行写入到 Kafka 的实时任务。进入到你本地安装 Flink 的位置,然后启动一个本地集群:
 
 {% highlight bash %}
 $ cd my/flink/directory
 $ bin/start-cluster.sh
 {% endhighlight %}
 
-We also have to create the Kafka Topic, so that our program can write to it:
+我们必须先创建一个 Kafka 主题,这样我们的程序才能往里写入数据:

Review comment:
       Topic 不建议翻译为主题,因为是 Kafka的专有名词

##########
File path: docs/getting-started/tutorials/datastream_api.zh.md
##########
@@ -309,24 +277,15 @@ similar to this:
 4> (KasparBot,-245)
 {% endhighlight %}
 
-The number in front of each line tells you on which parallel instance of the 
print sink the output
-was produced.
+每行数据前面的数字代表着打印接收器运行的并行实例。
 
-This should get you started with writing your own Flink programs. To learn more
-you can check out our guides
-about [basic concepts]({{ site.baseurl }}/dev/api_concepts.html) and the
-[DataStream API]({{ site.baseurl }}/dev/datastream_api.html). Stick
-around for the bonus exercise if you want to learn about setting up a Flink 
cluster on
-your own machine and writing results to [Kafka](http://kafka.apache.org).
+这可以让你开始创建你自己的 Flink 项目。你可以查看[基本概念]({{ site.baseurl 
}}/zh/dev/api_concepts.html)和[DataStream API]({{ site.baseurl 
}}/zh/dev/datastream_api.html)指南。如果你想学习了解更多关于 Flink 集群安装以及数据写入到 
[Kafka](http://kafka.apache.org),你可以自己多加以练习尝试。
 
-## Bonus Exercise: Running on a Cluster and Writing to Kafka
+## 额外练习: 集群运行并输出 Kafka

Review comment:
       附加练习: 在集群上运行并输出到 Kafka




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to