fix(i18n): chinese test suite (#38220)

* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
This commit is contained in:
Kristofer Koishigawa
2020-02-18 01:40:55 +09:00
committed by Mrugesh Mohapatra
parent 6a7a7e6d7d
commit b3213fc892
1264 changed files with 5635 additions and 4331 deletions

View File

@ -18,7 +18,7 @@ localeTitle: 从API访问JSON数据
```yml
tests:
- text: 您的代码应使用括号和点符号来访问正确的代码名称并将“Loki”打印到控制台。
testString: 'assert(code.match(/(?:json\[2\]\.codeNames\[1\]|json\[2\]\[("|")codeNames\1\]\[1\])/g), "Your code should use bracket and dot notation to access the proper code name, and print "Loki" to the console.");'
testString: assert(code.match(/console\s*\.\s*log\s*\(\s*json\s*\[2\]\s*(\.\s*codeNames|\[\s*('|`|")codeNames\2\s*\])\s*\[\s*1\s*\]\s*\)/g));
```

View File

@ -18,7 +18,7 @@ localeTitle: 单击“事件”更改文本
```yml
tests:
- text: 您的代码应使用<code>document.getElementsByClassName</code>方法选择具有类<code>message</code>的元素,并将其<code>textContent</code>设置为给定的字符串。
testString: 'assert(code.match(/document\.getElementsByClassName\(\s*?("|")message\1\s*?\)\[0\]\.textContent\s*?=\s*?("|")Here is the message\2/g), "Your code should use the <code>document.getElementsByClassName</code> method to select the element with class <code>message</code> and set its <code>textContent</code> to the given string.");'
testString: assert(code.match(/document\s*\.getElementsByClassName\(\s*?('|")message\1\s*?\)\[0\]\s*\.textContent\s*?=\s*?('|")Here is the message\2/g));
```

View File

@ -18,11 +18,11 @@ localeTitle: 将JSON数据转换为HTML
```yml
tests:
- text: 您的代码应该将数据存储在<code>html</code>变量中
testString: 'assert(code.match(/html\s+?(\+=|=\shtml\s\+)/g), "Your code should store the data in the <code>html</code> variable");'
testString: assert(code.match(/html\s+?(\+=|=\shtml\s\+)/g));
- text: 您的代码应该使用<code>forEach</code>方法来循环API中的JSON数据。
testString: 'assert(code.match(/json\.forEach/g), "Your code should use a <code>forEach</code> method to loop over the JSON data from the API.");'
testString: assert(code.match(/json\.forEach/g));
- text: 您的代码应将密钥名称包装在<code>strong</code>标记中。
testString: 'assert(code.match(/<strong>.+<\/strong>/g), "Your code should wrap the key names in <code>strong</code> tags.");'
testString: assert(code.match(/<strong>.+<\/strong>/g));
```

View File

@ -18,13 +18,13 @@ localeTitle: 获取地理位置数据以查找用户的GPS坐标
```yml
tests:
- text: 您的代码应使用<code>navigator.geolocation</code>来访问用户的当前位置。
testString: 'assert(code.match(/navigator\.geolocation\.getCurrentPosition/g), "Your code should use <code>navigator.geolocation</code> to access the user&#39;s current location.");'
testString: assert(code.match(/navigator\.geolocation\.getCurrentPosition/g));
- text: 您的代码应使用<code>position.coords.latitude</code>来显示用户的纬度位置。
testString: 'assert(code.match(/position\.coords\.latitude/g), "Your code should use <code>position.coords.latitude</code> to display the user&#39;s latitudinal location.");'
testString: assert(code.match(/position\.coords\.latitude/g));
- text: 您的代码应使用<code>position.coords.longitude</code>来显示用户的纵向位置。
testString: 'assert(code.match(/position\.coords\.longitude/g), "Your code should use <code>position.coords.longitude</code> to display the user&#39;s longitudinal location.");'
testString: assert(code.match(/position\.coords\.longitude/g));
- text: 您应该在<code>data</code> div元素中显示用户的位置。
testString: 'assert(code.match(/document\.getElementById\(\s*?("|")data\1\s*?\)\.innerHTML/g), "You should display the user&#39;s position within the <code>data</code> div element.");'
testString: assert(code.match(/document\.getElementById\(\s*?('|")data\1\s*?\)\.innerHTML/g));
```

View File

@ -18,17 +18,17 @@ localeTitle: 使用JavaScript XMLHttpRequest方法获取JSON
```yml
tests:
- text: 您的代码应该创建一个新的<code>XMLHttpRequest</code> 。
testString: 'assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), "Your code should create a new <code>XMLHttpRequest</code>.");'
testString: assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g));
- text: 您的代码应该使用<code>open</code>方法初始化对freeCodeCamp Cat Photo API的“GET”请求。
testString: 'assert(code.match(/\.open\(\s*?("|")GET\1\s*?,\s*?("|")\/json\/cats\.json\2\s*?,\s*?true\s*?\)/g), "Your code should use the <code>open</code> method to initialize a "GET" request to the freeCodeCamp Cat Photo API.");'
testString: assert(code.match(/\.open\(\s*?('|")GET\1\s*?,\s*?('|")\/json\/cats\.json\2\s*?,\s*?true\s*?\)/g));
- text: 您的代码应使用<code>send</code>方法发送请求。
testString: 'assert(code.match(/\.send\(\s*\)/g), "Your code should use the <code>send</code> method to send the request.");'
testString: assert(code.match(/\.send\(\s*\)/g));
- text: 您的代码应该有一个设置为函数的<code>onload</code>事件处理程序。
testString: 'assert(code.match(/\.onload\s*=\s*function\(\s*?\)\s*?{/g), "Your code should have an <code>onload</code> event handler set to a function.");'
testString: assert(code.match(/\.onload\s*=\s*(function|\(\s*?\))\s*?(\(\s*?\)|\=\>)\s*?{/g));
- text: 您的代码应该使用<code>JSON.parse</code>方法来解析<code>responseText</code> 。
testString: 'assert(code.match(/JSON\.parse\(.*\.responseText\)/g), "Your code should use the <code>JSON.parse</code> method to parse the <code>responseText</code>.");'
testString: assert(code.match(/JSON\s*\.parse\(\s*.*\.responseText\s*\)/g));
- text: 您的代码应该获取带有类<code>message</code>的元素并将其内部HTML更改为JSON数据字符串。
testString: 'assert(code.match(/document\.getElementsByClassName\(\s*?("|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?JSON\.stringify\(.+?\)/g), "Your code should get the element with class <code>message</code> and change its inner HTML to the string of JSON data.");'
testString: assert(code.match(/document\s*\.getElementsByClassName\(\s*?('|")message\1\s*?\)\[0\]\s*\.innerHTML\s*?=\s*?JSON\.stringify\(.+?\)/g));
```

View File

@ -18,9 +18,9 @@ localeTitle: 使用onclick属性处理使用JavaScript单击事件
```yml
tests:
- text: 您的代码应使用<code>document.getElementById</code>方法来选择<code>getMessage</code>元素。
testString: 'assert(code.match(/document\.getElementById\(\s*?("|")getMessage\1\s*?\)/g), "Your code should use the <code>document.getElementById</code> method to select the <code>getMessage</code> element.");'
testString: assert(code.match(/document\s*\.getElementById\(\s*?('|")getMessage\1\s*?\)/g));
- text: 您的代码应添加<code>onclick</code>事件处理程序。
testString: 'assert(typeof document.getElementById("getMessage").onclick === "function", "Your code should add an <code>onclick</code> event handler.");'
testString: assert(typeof document.getElementById('getMessage').onclick === 'function');
```

View File

@ -18,17 +18,17 @@ localeTitle: 使用JavaScript XMLHttpRequest方法发布数据
```yml
tests:
- text: 您的代码应该创建一个新的<code>XMLHttpRequest</code> 。
testString: 'assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), "Your code should create a new <code>XMLHttpRequest</code>.");'
testString: assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g));
- text: 您的代码应使用<code>open</code>方法初始化对服务器的“POST”请求。
testString: 'assert(code.match(/\.open\(\s*?("|")POST\1\s*?,\s*?url\s*?,\s*?true\s*?\)/g), "Your code should use the <code>open</code> method to initialize a "POST" request to the server.");'
testString: assert(code.match(/\.open\(\s*?('|")POST\1\s*?,\s*?url\s*?,\s*?true\s*?\)/g));
- text: 您的代码应使用<code>setRequestHeader</code>方法。
testString: 'assert(code.match(/\.setRequestHeader\(\s*?("|")Content-Type\1\s*?,\s*?("|")text\/plain\2\s*?\)/g), "Your code should use the <code>setRequestHeader</code> method.");'
testString: assert(code.match(/\.setRequestHeader\(\s*?('|")Content-Type\1\s*?,\s*?('|")application\/json;\s*charset=UTF-8\2\s*?\)/g));
- text: 您的代码应该将<code>onreadystatechange</code>事件处理程序设置为函数。
testString: 'assert(code.match(/\.onreadystatechange\s*?=/g), "Your code should have an <code>onreadystatechange</code> event handler set to a function.");'
testString: assert(code.match(/\.onreadystatechange\s*?=/g));
- text: 您的代码应该获取带有类<code>message</code>的元素并将其内部HTML更改为<code>responseText</code> 。
testString: 'assert(code.match(/document\.getElementsByClassName\(\s*?("|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?.+?\.responseText/g), "Your code should get the element with class <code>message</code> and change its inner HTML to the <code>responseText</code>.");'
testString: assert(code.match(/document\.getElementsByClassName\(\s*?('|")message\1\s*?\)\[0\]\.textContent\s*?=\s*?.+?\.userName\s*?\+\s*?.+?\.suffix/g));
- text: 您的代码应使用<code>send</code>方法。
testString: 'assert(code.match(/\.send\(\s*?userName\s*?\)/g), "Your code should use the <code>send</code> method.");'
testString: assert(code.match(/\.send\(\s*?body\s*?\)/g));
```

View File

@ -18,7 +18,7 @@ localeTitle: 预过滤JSON以获取所需的数据
```yml
tests:
- text: 您的代码应该使用<code>filter</code>方法。
testString: 'assert(code.match(/json\.filter/g), "Your code should use the <code>filter</code> method.");'
testString: assert(code.match(/json\.filter/g));
```

View File

@ -18,7 +18,7 @@ localeTitle: 从数据源渲染图像
```yml
tests:
- text: 您应该使用<code>imageLink</code>属性来显示图像。
testString: 'assert(code.match(/val\.imageLink/g), "You should use the <code>imageLink</code> property to display the images.");'
testString: assert(code.match(/val\.imageLink/g));
```