Skip to content

Conversation

@xiaoxizi333
Copy link
Contributor

No description provided.

{
"id": "5895f700f9fc0f352b528e63",
"title": "Set up a Template Engine",
"title": "创建引擎模版",
Copy link
Contributor

Choose a reason for hiding this comment

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

set up =>设置 而不是创建

"Now to tell Node/Express to use the templating engine you will have to tell your express <b>app</b> to <b>set</b> 'pug' as the 'view-engine'. <code>app.set('view engine', 'pug')</code>",
"Lastly, you should change your response to the request for the index route to <code>res.render</code> with the path to the view <em>views/pug/index.pug</em>.",
"If all went as planned, you should refresh your apps home page and see a small message saying you're successfully rending the Pug from our Pug file! Submit your page when you think you've got it right."
"提醒一下,这个项目建立在<a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-advancednode/'>Glitch</a>上的启动项目中,或是从<a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>GitHub</a>上克隆",
Copy link
Contributor

Choose a reason for hiding this comment

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

或是从 => 也可以从

"Lastly, you should change your response to the request for the index route to <code>res.render</code> with the path to the view <em>views/pug/index.pug</em>.",
"If all went as planned, you should refresh your apps home page and see a small message saying you're successfully rending the Pug from our Pug file! Submit your page when you think you've got it right."
"提醒一下,这个项目建立在<a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-advancednode/'>Glitch</a>上的启动项目中,或是从<a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>GitHub</a>上克隆",
"你可以在应用程序的模版引擎中使用静态模板文件(如那些写在<em>Pug</em>里的)。在运行时,模版引擎会用服务端的真实值替换掉在模版文件中的变量,然后将模版转译成发送给客户端的 HTML 静态文件。这样可以更轻松地去构造 HTML 页面,在页面上不需要在客户端发送 API 请求去呈现变量。",
Copy link
Contributor

Choose a reason for hiding this comment

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

真实值 => 真实数据
design an HTML page => 设计,而不是构造
allows for displaying of variables on the page without needing to make an API call from the client.
允许在页面直接显示变量内容而不需要发送 API 请求。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我觉得一般都是构造一个页面 而不是设计页面 我们是前端程序员 不是UI设计师 翻译应该要灵活一点 贴近自己做的事情才对,所以我觉得design an HTML page => 是构造而不是设计

"你可以在应用程序的模版引擎中使用静态模板文件(如那些写在<em>Pug</em>里的)。在运行时,模版引擎会用服务端的真实值替换掉在模版文件中的变量,然后将模版转译成发送给客户端的 HTML 静态文件。这样可以更轻松地去构造 HTML 页面,在页面上不需要在客户端发送 API 请求去呈现变量。",
"为了在项目中使用 <em>Pug</em>,你需要在你的 package.json 中添加依赖<code>\"pug\": \"^0.1.0\"</code>",
"为了在 Node/Express 中运用模版引擎,你需要告诉你的 express <b>应用</b><b>建立</b>'pug'作为'view-engine' <code>app.set('view engine', 'pug')</code>",
"最后, 你需要改变你对索引路由用页面路径<em>views/pug/index.pug</em>到<code>res.render</code>的请求的响应。",
Copy link
Contributor

@huluoyang huluoyang Aug 1, 2018

Choose a reason for hiding this comment

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

最后一句行文不流畅,请重新翻译。

"为了在项目中使用 <em>Pug</em>,你需要在你的 package.json 中添加依赖<code>\"pug\": \"^0.1.0\"</code>",
"为了在 Node/Express 中运用模版引擎,你需要告诉你的 express <b>应用</b><b>建立</b>'pug'作为'view-engine' <code>app.set('view engine', 'pug')</code>",
"最后, 你需要改变你对索引路由用页面路径<em>views/pug/index.pug</em>到<code>res.render</code>的请求的响应。",
"如果一切就绪, 你需要刷新应用程序的主页,你可以看到 Pug 的成功建立的提示!你确定后就可以提交你的页面了。"
Copy link
Contributor

Choose a reason for hiding this comment

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

连续两个的 => 一个的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What are talking about?

@huluoyang
Copy link
Contributor

万事开头难,慢慢来,1天翻译1个小节即可。

@huluoyang huluoyang added the need update Use when a translation (?) PR has been reviewed and needs to address comments label Aug 1, 2018
Copy link
Contributor

@S1ngS1ng S1ngS1ng left a comment

Choose a reason for hiding this comment

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

  1. 看一下 style-guide,行内元素(如 <a><em> 之类的)是否加空格取决于内容
  2. to 不能总是翻译成“去”,要根据上下文调整
  3. testStringassert 的第二个参数(字符串)是要翻译的

"Now to tell Node/Express to use the templating engine you will have to tell your express <b>app</b> to <b>set</b> 'pug' as the 'view-engine'. <code>app.set('view engine', 'pug')</code>",
"Lastly, you should change your response to the request for the index route to <code>res.render</code> with the path to the view <em>views/pug/index.pug</em>.",
"If all went as planned, you should refresh your apps home page and see a small message saying you're successfully rending the Pug from our Pug file! Submit your page when you think you've got it right."
"提醒一下,这个项目建立在<a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-advancednode/'>Glitch</a>上的启动项目中,也可以从<a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>GitHub</a>上克隆",
Copy link
Contributor

Choose a reason for hiding this comment

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

不必翻译成 提醒一下,翻译成 注意 就好


<a> 标签加空格的方式请参考 style-guide,这里是要加的

"Lastly, you should change your response to the request for the index route to <code>res.render</code> with the path to the view <em>views/pug/index.pug</em>.",
"If all went as planned, you should refresh your apps home page and see a small message saying you're successfully rending the Pug from our Pug file! Submit your page when you think you've got it right."
"提醒一下,这个项目建立在<a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-advancednode/'>Glitch</a>上的启动项目中,也可以从<a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>GitHub</a>上克隆",
"你可以在应用程序的模版引擎中使用静态模板文件(如那些写在<em>Pug</em>里的)。在运行时,模版引擎会用服务端的真实数据替换掉在模版文件中的变量,然后将模版转译成发送给客户端的 HTML 静态文件。这样可以更轻松地去构造 HTML 页面,允许在页面直接显示变量内容而不需要发送 API 请求。",
Copy link
Contributor

Choose a reason for hiding this comment

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

app 建议保留,可以不翻译


更轻松地去构造 => 更轻松地构造

"提醒一下,这个项目建立在<a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-advancednode/'>Glitch</a>上的启动项目中,也可以从<a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>GitHub</a>上克隆",
"你可以在应用程序的模版引擎中使用静态模板文件(如那些写在<em>Pug</em>里的)。在运行时,模版引擎会用服务端的真实数据替换掉在模版文件中的变量,然后将模版转译成发送给客户端的 HTML 静态文件。这样可以更轻松地去构造 HTML 页面,允许在页面直接显示变量内容而不需要发送 API 请求。",
"为了在项目中使用 <em>Pug</em>,你需要在你的 package.json 中添加依赖<code>\"pug\": \"^0.1.0\"</code>",
"为了在 Node/Express 中运用模版引擎,你需要告诉你的 express <b>应用</b><b>建立</b>'pug'作为'view-engine' <code>app.set('view engine', 'pug')</code>",
Copy link
Contributor

Choose a reason for hiding this comment

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

运用 => 适用


你需要告诉你的 express <b>应用</b>去<b>建立</b>'pug'作为'view-engine' <code>app.set('view engine', 'pug')</code> =>
你需要在 express 中将 <b>app</b> 的 “view-engine” 设置为 “pug”,就像这样:<code>app.set('view engine', 'pug')</code>。

  1. 不要逐字逐句的翻译
  2. 注意语序
  3. 注意结尾句号
  4. 注意标点。<code> 里面的不用改,但外面的要改

"你可以在应用程序的模版引擎中使用静态模板文件(如那些写在<em>Pug</em>里的)。在运行时,模版引擎会用服务端的真实数据替换掉在模版文件中的变量,然后将模版转译成发送给客户端的 HTML 静态文件。这样可以更轻松地去构造 HTML 页面,允许在页面直接显示变量内容而不需要发送 API 请求。",
"为了在项目中使用 <em>Pug</em>,你需要在你的 package.json 中添加依赖<code>\"pug\": \"^0.1.0\"</code>",
"为了在 Node/Express 中运用模版引擎,你需要告诉你的 express <b>应用</b><b>建立</b>'pug'作为'view-engine' <code>app.set('view engine', 'pug')</code>",
"最后, 你需要使用<code>res.render</code>方法去渲染<em>views/pug/index.pug</em>页面来作为路由请求的返回。",
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的 <em> 两边需要加空格。


=>

"为了在项目中使用 <em>Pug</em>,你需要在你的 package.json 中添加依赖<code>\"pug\": \"^0.1.0\"</code>",
"为了在 Node/Express 中运用模版引擎,你需要告诉你的 express <b>应用</b><b>建立</b>'pug'作为'view-engine' <code>app.set('view engine', 'pug')</code>",
"最后, 你需要使用<code>res.render</code>方法去渲染<em>views/pug/index.pug</em>页面来作为路由请求的返回。",
"如果一切就绪, 你需要刷新应用程序的主页,你可以看到 Pug 的成功建立的提示!你确定后就可以提交你的页面了。"
Copy link
Contributor

Choose a reason for hiding this comment

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

如果一切就绪, 你需要刷新应用程序的主页,你可以看到 Pug 的成功建立的提示!你确定后就可以提交你的页面了。 =>
如果一切顺利,刷新一下 app 的主页就可以看到 Pug 成功加载的提示,这时你就可以提交你的页面了。

  1. 这里不应该用半角标点
  2. 注意调整一下表达方式

"testString": "getUserInput => $.get(getUserInput('url')+ '/_api/package.json') .then(data => { var packJson = JSON.parse(data); assert.property(packJson.dependencies, 'pug', 'Your project should list \"pug\" as a dependency'); }, xhr => { throw new Error(xhr.statusText); })"
"text": "Pug 是依赖",
"testString":
"getUserInput => $.get(getUserInput('url')+ '/_api/package.json') .then(data => { var packJson = JSON.parse(data); assert.property(packJson.dependencies, 'pug', 'Your project should list \"pug\" as a dependency'); }, xhr => { throw new Error(xhr.statusText); })"
Copy link
Contributor

Choose a reason for hiding this comment

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

这里,第二个参数(字符串)是要翻译的,和上面的 text 一样就好。

下同

Copy link
Contributor

@S1ngS1ng S1ngS1ng left a comment

Choose a reason for hiding this comment

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

别的没问题了

"text": "Pug 正确展示变量",
"testString":
"getUserInput => $.get(getUserInput('url')+ '/') .then(data => { assert.match(data, /pug-variable(\"|')>Please login/gi, 'Your projects home page should now be rendered by pug with the projects .pug file unaltered'); }, xhr => { throw new Error(xhr.statusText); })"
"getUserInput => $.get(getUserInput('url')+ '/') .then(data => { assert.match(data, /pug-variable(\"|')>Please login/gi, '项目的主页应用 pug 来呈现,但 .pug文件'); }, xhr => { throw new Error(xhr.statusText); })"
Copy link
Contributor

Choose a reason for hiding this comment

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

这里翻译的不太对。

你的项目主页应使用 pug 作为渲染引擎,且 .pug 文件不应改变。

"Pug 文件中,你可以引用变量名来使用变量,像 <code>#{variable_name}</code> 插入元素中或像 <code>p= variable_name</code> 把元素与变量直接写在一起,这表示 p 元素的内容等价于这个变量。",
"建议大家在 Pug 的 Githubs README <a href='https://github.com/pugjs/pug'>here</a> 看看它的语法与结构。 Pug 使用空格和标签来展示嵌套元素和间隔大量的代码。",
"pug 'index.pug' 文件中,我们用变量 <em>title</em> <em>message</em>",
"从服务器传递这些信息,你需要用变量和数据在 <em>res.render</em> 中添加一个对象作为第二论据。举一个例子,创建一个变量来传递对象: <code>{title: 'Hello', message: 'Please login'</code> 到你的主页",
Copy link
Contributor

Choose a reason for hiding this comment

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

code 两边的空格去掉

"Now refresh your page and you should see those values rendered in your view in the correct spot as laid out in your index.pug file! Submit your page when you think you've got it right."
"注意, 这个项目建立在 <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-advancednode/'>Glitch</a> 上的启动项目中,也可以从 <a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>GitHub</a> 上克隆。",
"模版引擎最棒的特点之一就是在 HTML 页面展示之前,可以从服务端传变量到模版文件。",
"Pug 文件中,你可以引用变量名来使用变量,像 <code>#{variable_name}</code> 插入元素中或像 <code>p= variable_name</code> 把元素与变量直接写在一起,这表示 p 元素的内容等价于这个变量。",
Copy link
Contributor

Choose a reason for hiding this comment

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

code 两边的空格去掉

"text": "Pug 正在运行",
"testString":
"getUserInput => $.get(getUserInput('url')+ '/') .then(data => { assert.match(data, /pug-success-message/gi, 'Your projects home page should now be rendered by pug with the projects .pug file unaltered'); }, xhr => { throw new Error(xhr.statusText); })"
"getUserInput => $.get(getUserInput('url')+ '/') .then(data => { assert.match(data, /pug-success-message/gi, '项目的主页应用 pug 来呈现,但 .pug文件'); }, xhr => { throw new Error(xhr.statusText); })"
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的翻译参考底下

Copy link
Contributor

@S1ngS1ng S1ngS1ng left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@S1ngS1ng S1ngS1ng added :shipit: ship it Use when a translation (?) PR is ready for shipping and removed need update Use when a translation (?) PR has been reviewed and needs to address comments labels Aug 6, 2018
@huluoyang huluoyang merged commit 3099242 into FreeCodeCampChina:translate Aug 7, 2018
SSShooter pushed a commit to SSShooter/challenges that referenced this pull request Sep 7, 2018
* Introduction to Advanced Node and Express Challenges

* Set up a Template Engine

* correct translation

* Use a Template Engine's Powers

* correct error translation

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

Labels

:shipit: ship it Use when a translation (?) PR is ready for shipping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants