Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add debugging-cn.json #10

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Conversation

CatcherO
Copy link

Description

#8
@S1ngS1ng @wudifeixue

@wudifeixue
Copy link

Awesome! I will review this pull request more thoroughly ASAP. Good job overall.

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. 注意空格。你在有些地方加了多余的,有些地方忘加了。
    2. “你” 和 “您”,通篇应保持一致。
    3. 专业名词,如果有翻译,通篇应保持一致。单独出现的时候建议加上引号。比如 assign 翻译为“赋值”,这个就可以不用加引号了,但全篇都应该用“赋值”,不应该出现“设置”这样的词
    4. tests 里的 text 是要翻译的,testString 里面,assert 第二个参数直接用 text 里翻译好的内容就行
    5. files 中,注释部分是要翻译的,相同/相似的注释也请保持翻译一致

"title": "Use the JavaScript Console to Check the Value of a Variable",
"description": [
"Chrome 和 Firefox 都有出色的 JavaScript 控制台,也称为 DevTools,用于调试你的 JavaScript 代码。",
"你可以在 Chrome 的菜单中找到开发者工具或 FireFox 的菜单中的 Web 控制台。如果你使用其他浏览器或手机,我们强烈建议你切换到桌面版 Firefox 或 Chrome。",
Copy link
Contributor

Choose a reason for hiding this comment

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

这里,麻烦你再确认下。中文版的 Chrome 菜单里是写着 "开发者工具",以及 Firefox 菜单里是写着 "Web 控制台" 么?

如果是的话,感觉加上引号会更好:

你可以在 Chrome 的菜单中找到“开发者工具”或 FireFox 的菜单中的 “Web 控制台“

"description": [
"Chrome 和 Firefox 都有出色的 JavaScript 控制台,也称为 DevTools,用于调试你的 JavaScript 代码。",
"你可以在 Chrome 的菜单中找到开发者工具或 FireFox 的菜单中的 Web 控制台。如果你使用其他浏览器或手机,我们强烈建议你切换到桌面版 Firefox 或 Chrome。",
"<code>console.log()</code> 方法,将括号内的输出“打印”到控制台,这可能是最有用的调试工具。将它放在代码中的关键点可以显示变量的中间值。在查看输出之前,最好先了解输出应该是什么。在整个代码中使用检查点来查看计算状态将有助于缩小问题所在。",
Copy link
Contributor

Choose a reason for hiding this comment

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

将括号内的输出“打印”到控制台

感觉这句话有点儿奇怪,因为括号内是“内容”,或者是“输出内容”。考虑:

将括号中的内容“打印”到控制台

或者

将括号中的内容输出到控制台

注意,这里选用的应与下一行 Here's an example to print 'Hello world!' to the console:print 的翻译一致


console.log() 方法,将括号内的输出“打印”到控制台,这可能是最有用的调试工具。

非限定性定语从句(Nonrestrictive relative clause)起补充说明的作用,建议在翻译的时候两边不用逗号隔开(因为不符合中文的表达习惯)。个人建议提前主句:

<code>console.log()</code> 方法可能是最有用的调试工具,它可以将括号中的内容输出到控制台。

或者,这样可能也可以接受:

<code>console.log()</code> 方法可以将括号中的内容输出到控制台,它可能是最有用的调试工具

不过这一种表达,英文中一般是两句话,而不是一句

"下面是打印 'Hello world!' 到控制台的示例:",
"<code>console.log('Hello world!');</code>",
"<hr>",
"使用 <code>console.log()</code> 方法在代码中注明的地方打印变量 <code>a</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>console.log()</code> 方法在代码中注明的地方打印变量 <code>a</code> 的值。

这样可能有点儿复杂化了:

在这道挑战/题目中,使用 <code>console.log()</code> 方法在代码中注明的地方打印变量 <code>a</code> 的值。

这样可能也行:

挑战任务:使用 <code>console.log()</code> 方法在代码中注明的地方打印变量 <code>a</code> 的值。

@wudifeixue @Becavalier Thoughts?

],
"tests": [
{
"text":
Copy link
Contributor

Choose a reason for hiding this comment

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

tests 里的 text 也是要翻译的噢,这是出现在左下角的内容。

根据 test 执行的方式 以及 chai 的 assert 文档testString 里,assert 的第二个参数定义的是测试执行 fail 时出现在页面右下角的 output。英文版的这个参数和 text 一致。所以我们应该也翻译下? @Becavalier

"let a = 5;",
"let b = 1;",
"a++;",
"// Add your code below this line",
Copy link
Contributor

Choose a reason for hiding this comment

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

contents 里的注释是要翻译的,这个也会出现在用户界面上。
请参考目前的中文版翻译

@wudifeixue 记得咱们之前讨论过吧?�继续用原来的?

"当你使用将索引范围作为参数的字符串或数组方法时,它有助于阅读文档并了解它们是否包含(指定索引处的项目是否是返回的一部分)。以下是一些错误的示例:",
"<blockquote>let alphabet = \"abcdefghijklmnopqrstuvwxyz\";<br>let len = alphabet.length;<br>for (let i = 0; i <= len; i++) {<br>&nbsp;&nbsp;// loops one too many times at the end<br>&nbsp;&nbsp;console.log(alphabet[i]);<br>}<br>for (let j = 1; j < len; j++) {<br>&nbsp;&nbsp;// loops one too few times and misses the first character at index 0<br>&nbsp;&nbsp;console.log(alphabet[j]);<br>}<br>for (let k = 0; k < len; k++) {<br>&nbsp;&nbsp;// Goldilocks approves - this is just right<br>&nbsp;&nbsp;console.log(alphabet[k]);<br>}</blockquote>",
"<hr>",
"修复以下函数中的两个索引错误,以便将 1 到 5 之间的数字打印到控制台。"
Copy link
Contributor

Choose a reason for hiding this comment

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

感觉这里确切一些可能更好?
以便将 1 到 5 之间的数字打印到控制台。 => 以便将 1 到 5 之间(包含 1 和 5)的所有数字打印到控制台。

"有时需要在循环中保存信息,增加计数器或重置变量。一个潜在的问题是变量什么时候该重新初始化,什么时候不该重新初始化,反之亦然。如果您不小心重置了用于终止条件的变量,导致无限循环,这将特别危险。",
"使用 <code>console.log()</code> 在每个循环中打印变量值可以发现与重置相关的错误行为,或者重置变量失败。",
"<hr>",
"以下函数应该创建一个具有 <code>m</code> 行和 <code>n</code> 列的 零 的二维数组。不幸的是,它没有产生预期的输出,因为<code>row</code>变量没有在外部循环中重新初始化(设置回空数组)。修复代码,使其返回正确的3x2零数组,看起来像 <code>[[0,0],[0,0],[0,0]]</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>m</code> 行和 <code>n</code> 列的 零 的二维数组 => <code>m</code> 行和 <code>n</code> 列“零”的二维数组 会不会好些?


使其返回正确的3x2零数组,看起来像 <code>[[0,0],[0,0],[0,0]]</code> 。 => 使其正确地返回包含 3 行 2 列“零”的二维数组,即 <code>[[0,0],[0,0],[0,0]]</code> 。

"id": "587d7b86367417b2b2512b3d",
"title": "Prevent Infinite Loops with a Valid Terminal Condition",
"description": [
"最后一个话题是可怕的无限循环。当你需要程序运行代码块一定次数或满足条件时,循环是很好的工具,但是它们需要终止条件来结束循环。无限循环可能会使浏览器冻结或崩溃,并导致一般程序执行混乱,没有人想要这样的结果。",
Copy link
Contributor

Choose a reason for hiding this comment

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

删掉 一般

"最后一个话题是可怕的无限循环。当你需要程序运行代码块一定次数或满足条件时,循环是很好的工具,但是它们需要终止条件来结束循环。无限循环可能会使浏览器冻结或崩溃,并导致一般程序执行混乱,没有人想要这样的结果。",
"在本节的介绍中有一个无限循环的例子——它没有终止条件来摆脱 <code>loopy()</code> 内的 <code>while</code> 循环。不要调用这个函数!",
"<blockquote>function loopy() {<br>&nbsp;&nbsp;while(true) {<br>&nbsp;&nbsp;&nbsp;&nbsp;console.log(\"Hello, world!\");<br>&nbsp;&nbsp;}<br>}</blockquote>",
"程序员的工作是确保最终达到终止条件,该条件告诉程序何时跳出循环。有一种错误是从终端条件向错误方向递增或递减计数器变量。另一种是在循环代码中意外重置计数器或索引变量,而不是递增或递减它。",
Copy link
Contributor

Choose a reason for hiding this comment

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

终端条件 => 终止条件。下同

这里的 terminal 不是指运行环境“终端”,而是终止条件的“终止”

"<blockquote>function loopy() {<br>&nbsp;&nbsp;while(true) {<br>&nbsp;&nbsp;&nbsp;&nbsp;console.log(\"Hello, world!\");<br>&nbsp;&nbsp;}<br>}</blockquote>",
"程序员的工作是确保最终达到终止条件,该条件告诉程序何时跳出循环。有一种错误是从终端条件向错误方向递增或递减计数器变量。另一种是在循环代码中意外重置计数器或索引变量,而不是递增或递减它。",
"<hr>",
"<code>myFunc()</code> 函数包含一个无限循环,因为终端条件 <code>i != 4</code> 永远不会计算为 <code>false</code> (并中断循环) - <code>i</code> 将每次递增2,然后跳过4,因为 <code>i</code> 是从奇数开始递增。在终端条件中输入比较运算符,使循环仅在 <code>i</code> 小于或等于4的情况下运行。"
Copy link
Contributor

Choose a reason for hiding this comment

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

删掉 计算

@CatcherO
Copy link
Author

@S1ngS1ng 辛苦星星姐了,“您”全改为“你”了,testsfiles部分翻译好了,其他都按要求改了,我的翻译太不地道了:joy:

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.

问题不大 👍
一些小问题:

  • 多余的空格
  • 还有一个注释没有翻译
  • console.clear 那句话忘加了吧

修改的时候,记得对比一下原文,改完之后再读一下看通不通顺哈 😄

"对于浏览器控制台。 当你在浏览器中加载并运行 JavaScript 文件时, <code>console.log()</code> 语句会在控制台中按照你调用的次数准确地打印出你要求的内容。 然而,在 freeCodeCamp 的代码编辑器中使用 <code>console.log()</code> 会略有不同,一开始可能会让你感到困惑。",
"在 freeCodeCamp 代码编辑器中,传给 <code>console.log()</code> 的值会在每组测试执行的时候输出。另外,如果你在代码中还手动调用过挑战题目的函数,调用几次就会增加几次传入值的输出。",
"这就产生了一些有趣的行为,并可能在一开始就让你感到困惑,因为你觉得只会输出一次的值可能会输出多次,具体次数取决于挑战题目本身测试的数量以及这些测试调用挑战函数的方式",
"如果你不打算执行挑战的测试,而只想查看自己调用 <code>console.log()</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>console.clear()</code>。 这句话是要加上的 😂
看下原文 https://github.com/FreeCodeCampChina/curriculum-cn/blob/dev/challenges/02-javascript-algorithms-and-data-structures/debugging.json#L62

"<hr>",
"使用 <code>console.log()</code> 在代码中指定的位置打印变量。",
""
],
"tests": [
{
"text":
"Use <code>console.log()</code> to print the <code>outputTwice</code> variable. In your Browser Console this should print out the value of the variable two times.",
"使用 <code>console.log()</code> 输出变量 <code>outputTwice</code> 的值。 在浏览器控制台中,应该输出两次变量的值。",
Copy link
Contributor

Choose a reason for hiding this comment

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

多余的空格

@@ -117,31 +117,31 @@
"id": "587d7b84367417b2b2512b34",
"title": "Use typeof to Check the Type of a Variable",
"description": [
"你可以使用 <code>typeof</code> 检查变量的数据结构或类型。在处理多种数据类型时,这个在调试时很有用。如果你认为你正在添加两个数字,但其中一个实际上是一个字符串,则结果可能是意外的。类型错误可能潜伏在计算或函数调用中。当你以 JavaScript 对象( JSON )的形式访问和使用外部数据时尤其要小心。",
"你可以使用 <code>typeof</code> 检查变量的数据结构或类型。在处理多种数据类型时,<code>typeof</code> 会对调试很有帮助。如果你认为你两数相加,而其中一个实际上是一个字符串,则结果可能是错误的。类型错误可能隐藏在计算或函数调用中。当你以 JavaScript 对象(JSON)的形式访问和使用外部数据时尤其要小心。",
Copy link
Contributor

Choose a reason for hiding this comment

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

如果你认为你两数相加,而其中一个实际上是一个字符串, => 如果你想计算两数之和,但实际传入了一个字符串参数

这样会不会好些?

"当你试图访问字符串或数组的特定索引(分割或访问一个片段)或循环索引时,会出现 <code>Off by one errors</code> 错误(有时称为OBOE)。 JavaScript索引从 <code>0</code>开始,而不是<code>1</code>,这意味着最后一个索引总是小于项目的长度。 如果您尝试访问等于长度的索引,程序可能会抛出“索引超出范围”引用错误或打印出 <code>undefined</code>。",
"当你使用将索引范围作为参数的字符串或数组方法时,它有助于阅读文档并了解它们是否包含(指定索引处的项目是否是返回的一部分)。以下是一些错误的示例:",
"当你试图访问字符串或数组的特定索引(分割或访问一个片段)或循环索引时,有时会出现 <code>Off by one errors</code> 错误(有时称为 OBOE)。 JavaScript 索引从 <code>0</code>开始,而不是<code>1</code>,这意味着最后一个索引总会比字符串或数组的长度少 1。 如果你尝试访问等于长度的索引,程序可能会抛出“索引超出范围”引用错误或打印出 <code>undefined</code>。",
"当你使用将索引范围作为参数的字符串或数组方法时,阅读相关的文档并了解参数中的索引的包含性(即是否考虑进返回值中)很重要。以下是一些错误的示例:",
"<blockquote>let alphabet = \"abcdefghijklmnopqrstuvwxyz\";<br>let len = alphabet.length;<br>for (let i = 0; i <= len; i++) {<br>&nbsp;&nbsp;// loops one too many times at the end<br>&nbsp;&nbsp;console.log(alphabet[i]);<br>}<br>for (let j = 1; j < len; j++) {<br>&nbsp;&nbsp;// loops one too few times and misses the first character at index 0<br>&nbsp;&nbsp;console.log(alphabet[j]);<br>}<br>for (let k = 0; k < len; k++) {<br>&nbsp;&nbsp;// Goldilocks approves - this is just right<br>&nbsp;&nbsp;console.log(alphabet[k]);<br>}</blockquote>",
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
Author

Choose a reason for hiding this comment

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

Goldilocks approves 这个怎么翻译?
我查到有个“金发姑娘原则”( Goldilocks principle )

Copy link
Contributor

@S1ngS1ng S1ngS1ng Jul 14, 2018

Choose a reason for hiding this comment

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

@CatcherO
注意到上下文:
image

很明显前两个写法,一个结尾多了 1,一个开头少了 1。


根据 Urban Dictionary 对 Goldilocks 的定义(请主动忽略掉污的部分。。😂):

image

image

以及 Urban Dictionary 对 Goldilocks Approach 的定义

image

这就与 wikipedia 中 Goldilocks principle 画红框的部分“just the right amount” 相吻合(点开图片看大图)。以及,后面的 "this is just right" 也是同样的意思

image


因此,最后一个写法的范围刚刚好,有点儿“就是这个范围” 或者引申一下,“终于写对了” 的感觉。

个人觉得这里根据意思翻译就好,放上原文的直接翻译反而还要再添加个链接什么的。。😂
可以正式一点儿 “这个范围才是正确的”,也可以是调侃一点儿:“恭喜你,终于找对了范围”。

记得,翻译完之后注意检查一下前后文(就是和上面的两个注释)是否搭配。

" for (let i = 1; i <= len; i++) {",
" // Do not alter code below this line",
" // 请不要修改这条注释以下的代码",
Copy link
Contributor

Choose a reason for hiding this comment

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

要不要换成 请修改这条注释以上的代码

@wudifeixue

Choose a reason for hiding this comment

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

还是和英语保持一致吧,我感觉没有必要

"<code>console.log()</code> 方法,将括号内的输出“打印”到控制台,这可能是最有用的调试工具。将它放在代码中的关键点可以显示变量的中间值。在查看输出之前,最好先了解输出应该是什么。在整个代码中使用检查点来查看计算状态将有助于缩小问题所在。",
"下面是打印 'Hello world!' 到控制台的示例:",
"你可以在 Chrome 的菜单中找到”开发者工具”或 FireFox 的菜单中的 “Web 控制台”。如果你使用其他浏览器或手机,我们强烈建议你切换到桌面版 Firefox 或 Chrome。",
"<code>console.log()</code> 方法可能是最有用的调试工具,它可以将括号中的内容输出到控制台,。将它放在代码中的关键点可以显示变量的中间值。在查看输出之前,最好先了解输出应该是什么。在整个代码中使用检查点来查看计算状态将有助于缩小问题所在。",
Copy link
Contributor

Choose a reason for hiding this comment

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

它可以将括号中的内容输出到控制台,。 这里的标点符号不太对

Choose a reason for hiding this comment

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

开发者工具的 双引号 感觉也有点微妙啊,对比那个Web 控制台来讲的话

Copy link
Contributor

Choose a reason for hiding this comment

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

@wudifeixue 其实我觉得是这样。如果中文版的 dev tool 就叫“开发者工具”,那还是有必要加上引号的

"传递给文本编辑器块中的 <code>console.log()</code> 的值会运行在每组测试和你在代码中进行的每一次函数调用。",
"这就产生了一些有趣的行为,并可能在一开始就让您感到困惑,因为您希望仅查看一次的记录值可能会打印出更多次,具体取决于测试次数和传递给这些测试的值。",
"如果您只想查看单个输出而无需担心测试周期的运行,可以使用 <code>console.clear()</code>。",
"对于浏览器控制台。 当你在浏览器中加载并运行 JavaScript 文件时, <code>console.log()</code> 语句会在控制台中按照你调用的次数准确地打印出你要求的内容。 然而,在 freeCodeCamp 的代码编辑器中使用 <code>console.log()</code> 会略有不同,一开始可能会让你感到困惑。",
Copy link
Contributor

Choose a reason for hiding this comment

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

去掉句号之后的空格吧

Choose a reason for hiding this comment

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

强迫症患者的福音

"如果您只想查看单个输出而无需担心测试周期的运行,可以使用 <code>console.clear()</code>。",
"对于浏览器控制台。 当你在浏览器中加载并运行 JavaScript 文件时, <code>console.log()</code> 语句会在控制台中按照你调用的次数准确地打印出你要求的内容。 然而,在 freeCodeCamp 的代码编辑器中使用 <code>console.log()</code> 会略有不同,一开始可能会让你感到困惑。",
"在 freeCodeCamp 代码编辑器中,传给 <code>console.log()</code> 的值会在每组测试执行的时候输出。另外,如果你在代码中还手动调用过挑战题目的函数,调用几次就会增加几次传入值的输出。",
"这就产生了一些有趣的行为,并可能在一开始就让你感到困惑,因为你觉得只会输出一次的值可能会输出多次,具体次数取决于挑战题目本身测试的数量以及这些测试调用挑战函数的方式",
Copy link
Contributor

Choose a reason for hiding this comment

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

每句话的结尾也加上句号吧,保持统一

@S1ngS1ng S1ngS1ng requested a review from wudifeixue July 13, 2018 17:59
@huluoyang
Copy link

@CatcherO 抱歉,我们新开了 challenges 仓库来专门做翻译,此仓库不再用作翻译。

详情请传送到:https://github.com/freecodecampchina/challenges

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.

None yet

4 participants