chore(i8n,curriculum): processed translations (#41504)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
camperbot
2021-03-16 08:41:19 -06:00
committed by GitHub
parent 6f6c4f9081
commit 843eb81632
44 changed files with 393 additions and 369 deletions

View File

@ -9,7 +9,7 @@ dashedName: escape-sequences-in-strings
# --description--
引号不是字符串中唯一可以被 <dfn>转义</dfn> 的字符。 使用转义字符有两个原因:
引号不是字符串中唯一可以被转义(<dfn>escaped</dfn>的字符。 使用转义字符有两个原因:
1. 首先是可以让你使用无法输入的字符,例如退格。
2. 其次是可以让你在一个字符串中表示多个引号,而不会出错。
@ -24,9 +24,9 @@ dashedName: escape-sequences-in-strings
使用转义序列把下面三行文本赋值给一个变量 `myStr`
<blockquote>FirstLine<br> \SecondLine<br>ThirdLine</blockquote>
<blockquote>FirstLine<br>    \SecondLine<br>ThirdLine</blockquote>
你需要使用转义字符正确地插入特殊字符 确保间距与上面文本一致,并且单词或转义字符之间没有空格。
你需要使用转义字符正确地插入特殊字符 确保间距与上面文本一致,并且单词或转义字符之间没有空格。
**注意:** `SecondLine` 是因为键入了转义字符(而不是空格),所以在那个位置。

View File

@ -1,6 +1,6 @@
---
id: 56533eb9ac21ba0edf2244b4
title: Quoting Strings with Single Quotes
title: 用单引号引用字符串
challengeType: 1
videoUrl: 'https://scrimba.com/c/cbQmnhM'
forumTopicId: 18260
@ -9,39 +9,41 @@ dashedName: quoting-strings-with-single-quotes
# --description--
<dfn>String</dfn> values in JavaScript may be written with single or double quotes, as long as you start and end with the same type of quote. Unlike some other programming languages, single and double quotes work the same in JavaScript.
JavaScript 中的<dfn>字符串</dfn>可以使用开始和结束都是同类型的单引号或双引号表示。 与其他一些编程语言不同的是,单引号和双引号的功能在 JavaScript 中是相同的。
```js
doubleQuoteStr = "This is a string";
singleQuoteStr = 'This is also a string';
```
The reason why you might want to use one type of quote over the other is if you want to use both in a string. This might happen if you want to save a conversation in a string and have the conversation in quotes. Another use for it would be saving an `<a>` tag with various attributes in quotes, all within a string.
当你需要在一个字符串中使用多个引号的时候,你可以使用单引号包裹双引号或者相反。 常见的场景比如在字符串中包含对话的句子需要用引号包裹。 另外比如在一个包含有 `<a>` 标签的字符串中,标签的属性值需要用引号包裹。
```js
conversation = 'Finn exclaims to Jake, "Algebraic!"';
```
However, this becomes a problem if you need to use the outermost quotes within it. Remember, a string has the same kind of quote at the beginning and end. But if you have that same quote somewhere in the middle, the string will stop early and throw an error.
然而,如果你需要在其中使用外面的引号,这就成为一个问题。 记住,一个字符串在开头和结尾处有相同的引号。 要知道,字符串在开头和结尾都有相同的引号,如果在中间使用了相同的引号,字符串会提前中止并抛出错误。
```js
goodStr = 'Jake asks Finn, "Hey, let\'s go on an adventure?"';
badStr = 'Finn responds, "Let's go!"'; // Throws an error
badStr = 'Finn responds, "Let's go!"';
```
In the <dfn>goodStr</dfn> above, you can use both quotes safely by using the backslash <code>\\</code> as an escape character.
在这里 `badStr` 会产生一个错误。
**Note:** The backslash <code>\\</code> should not be confused with the forward slash `/`. They do not do the same thing.
在上面的 <dfn>goodStr</dfn> 中,通过使用反斜杠 `\` 转义字符可以安全地使用两种引号。
**提示:**不要混淆反斜杠 `\` 和斜杠 `/`。 它们不是一回事。
# --instructions--
Change the provided string to a string with single quotes at the beginning and end and no escape characters.
把字符串更改为开头和结尾使用单引号的字符串,并且不包含转义字符。
Right now, the `<a>` tag in the string uses double quotes everywhere. You will need to change the outer quotes to single quotes so you can remove the escape characters.
这样字符串中的 `<a>` 标签里面任何地方都可以使用双引号。 你需要将最外层引号更改为单引号,以便删除转义字符。
# --hints--
You should remove all the `backslashes` (<code>\\</code>).
应该删除所有反斜杠(`\`)。
```js
assert(
@ -52,7 +54,7 @@ assert(
);
```
You should have two single quotes `'` and four double quotes `"`.
应该要有两个单引号 `'` 和四个双引号 `"`
```js
assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2);

View File

@ -8,7 +8,7 @@ dashedName: catch-mixed-usage-of-single-and-double-quotes
# --description--
JavaScript 允许使用单引号 (`'`) 和双引号 (`"`) 声明字符串。 决定使用哪一个通常看个人偏好,但有一些例外。
JavaScript 允许使用单引号`'`和双引号`"`声明字符串。 决定使用哪一个通常看个人偏好,但有一些例外。
如果字符串中有缩写或存在一段带引号的文本,你就会明白为什么 JavaScript 允许两种引号了。 请注意,不要提前用引号结束字符串,这会导致语法错误。
@ -22,7 +22,7 @@ const uhOhGroucho = 'I've had a perfectly wonderful evening, but this wasn't it.
前两项是正确的,但第三项是不正确的。
当然,只使用一种引号也是可以的。 可以使用反斜杠(`\`转义字符来转义字符串的引号:
当然,只使用一种引号也是可以的。 可以使用反斜杠(`\`)来转义字符串的引号:
```js
const allSameQuotes = 'I\'ve had a perfectly wonderful evening, but this wasn\'t it.';

View File

@ -8,26 +8,28 @@ dashedName: reuse-patterns-using-capture-groups
# --description--
一些你所搜寻的匹配模式会在字符串中出现多次 手动重复该正则表达式显得不够简洁。 当字符串中出现多个重复子字符串时,有一种更好的方式来编写模式。
一些你所搜寻的匹配模式会在字符串中出现多次 手动重复该正则表达式显得不够简洁。 当字符串中出现多个重复子字符串时,有一种更好的方式来编写模式。
可以使用 <dfn>捕获组</dfn> 搜寻重复的子字符串。 括号 `(``)` 可以用来匹配重复的子字符串。 把需要重复匹配的模式放在括号中即可。
可以使用捕获组(<dfn>capture groups</dfn>搜寻重复的子字符串。 括号 `(``)` 可以用来匹配重复的子字符串。 把需要重复匹配的模式放在括号中即可。
要指定重复字符串将出现的位置,可以使用反斜杠(<code>\\</code>)后接一个数字。 这个数字从 1 开始,随着你使用的每个捕获组的增加而增加。 这里有一个示例,`\1`可以匹配第一个组。
要指定重复字符串将出现的位置,可以使用反斜杠(`\`)后接一个数字。 这个数字从 1 开始,随着你使用的每个捕获组的增加而增加。 这里有一个示例,`\1` 可以匹配第一个组。
下面的示例展示的是匹配被空格隔开的两个相同单词:
```js
let repeatStr = "regex regex";
let repeatRegex = /(\w+)\s\1/;
repeatRegex.test(repeatStr); // Returns true
repeatStr.match(repeatRegex); // Returns ["regex regex", "regex"]
repeatRegex.test(repeatStr);
repeatStr.match(repeatRegex);
```
在字符串上调用 `.match()` 方法将返回一个数组,其中包含它最终匹配到的字符串及其捕获组
`test` 调用将返回 `true``match` 调用将返回 `["regex regex", "regex"]`
在字符串上调用 `.match()` 方法将返回一个数组,其中包含它最终匹配到的字符串及其捕获组。
# --instructions--
Use capture groups in `reRegex` to match a string that consists of only the same number repeated exactly three times separated by single spaces.
`reRegex` 中使用捕获组来匹配一个只由相同的数字重复三次组成的由空格分隔字符串。
# --hints--
@ -37,49 +39,49 @@ Use capture groups in `reRegex` to match a string that consists of only the same
assert(reRegex.source.match(/\\d/));
```
你的正则表达式应该使用两次捕获组。
你的正则表达式应该使用捕获组两次
```js
assert(reRegex.source.match(/\\1|\\2/g).length >= 2);
```
Your regex should match `"42 42 42"`.
你的正则表达式应该匹配字符串 `42 42 42`
```js
assert(reRegex.test('42 42 42'));
```
Your regex should match `"100 100 100"`.
你的正则表达式应该匹配字符串 `100 100 100`
```js
assert(reRegex.test('100 100 100'));
```
Your regex should not match `"42 42 42 42"`.
你的正则表达式不应匹配字符串 `42 42 42 42`
```js
assert.equal('42 42 42 42'.match(reRegex.source), null);
```
Your regex should not match `"42 42"`.
你的正则表达式不应该匹配字符串 `42 42`
```js
assert.equal('42 42'.match(reRegex.source), null);
```
Your regex should not match `"101 102 103"`.
你的正则表达式不应该匹配字符串 `101 102 103`
```js
assert(!reRegex.test('101 102 103'));
```
Your regex should not match `"1 2 3"`.
你的正则表达式不应匹配字符串 `1 2 3`
```js
assert(!reRegex.test('1 2 3'));
```
Your regex should match `"10 10 10"`.
你的正则表达式不应匹配字符串 `10 10 10`
```js
assert(reRegex.test('10 10 10'));