diff --git a/curriculum/challenges/arabic/10-coding-interview-prep/rosetta-code/state-name-puzzle.md b/curriculum/challenges/arabic/10-coding-interview-prep/rosetta-code/state-name-puzzle.md index 841319d1bda..6ae83d11ec1 100644 --- a/curriculum/challenges/arabic/10-coding-interview-prep/rosetta-code/state-name-puzzle.md +++ b/curriculum/challenges/arabic/10-coding-interview-prep/rosetta-code/state-name-puzzle.md @@ -15,7 +15,7 @@ dashedName: state-name-puzzle Write a function to solve the challenge for a given array of actual U.S. state names, and for fictional state names. -The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `"from"` array should contain the original names and the `"to"` array should contain the resultant names. +The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `from` array should contain the original names and the `to` array should contain the resultant names. # --hints-- diff --git a/curriculum/challenges/arabic/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md b/curriculum/challenges/arabic/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md index 7d84dc3d6a8..472e09d230d 100644 --- a/curriculum/challenges/arabic/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md +++ b/curriculum/challenges/arabic/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md @@ -7,7 +7,7 @@ dashedName: step-5 # --description-- -أسفل عنصرك `.header`، أنشئ عنصر `div` جديد مع `class` يسمى `"gallery"`. سيكون `div` حاوية لصور المَعْرِض. +Below your `.header` element, create a new `div` element and assign it a `class` of `gallery`. سيكون `div` حاوية لصور المَعْرِض. في عنصر `.gallery`، أنشئ تسع عناصر `img`. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md index aa044de71f3..ee088d679f6 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md @@ -17,7 +17,7 @@ You should use compound assignment to add the string `Right! You win 20 gold!` t assert.match(pick.toString(), /text\.innerText\s*\+=\s*('|")Right! You win 20 gold!\1/); ``` -You should use compound assignment add `20` to the value of `gold`. +You should use compound assignment to add `20` to the value of `gold`. ```js assert.match(pick.toString(), /gold\s*\+=\s*20/); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md index 01adfa0d9d5..8f7e4f2b1da 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md @@ -11,12 +11,12 @@ dashedName: escape-sequences-in-strings 引號不是字符串中唯一可以被轉義(escaped)的字符。 使用轉義字符有兩個原因: -1. To allow you to use characters you may not otherwise be able to type out, such as a newline. +1. 首先是可以讓你使用無法輸入的字符,例如換行。 2. 其次是可以讓你在一個字符串中表示多個引號,而不會出錯。 我們在之前的挑戰中學到了這個。 -
代碼輸出
\'單引號
\"雙引號
\\反斜槓
\n換行符
\ttab
\rcarriage return
\b退格
\f換頁符
+
代碼輸出
\'單引號
\"雙引號
\\反斜槓
\n換行符
\t製表符
\r回車
\b退格
\f換頁符
*請注意,必須對反斜槓本身進行轉義,它才能顯示爲反斜槓。* diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 964bdf024bd..afa9caeb654 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -71,7 +71,7 @@ assert( ); ``` -Global variables should not be used to cache the array. +不應使用全局變量來緩存數組。 ```js countdown(1) diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 429cd2dcbd5..c793ef04a4e 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -56,7 +56,7 @@ assert.deepStrictEqual(rangeOfNumbers(6, 9), [6, 7, 8, 9]); assert.deepStrictEqual(rangeOfNumbers(4, 4), [4]); ``` -Global variables should not be used to cache the array. +不應使用全局變量來緩存數組。 ```js rangeOfNumbers(1, 3) diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index bf01fc37706..1a8adb89066 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -12,9 +12,9 @@ ES6 提供了一個新的創建對象的語法,使用關鍵字 classhttps://25--5-clock.freecodecamp.rocks. +**目標:** 構建一個應用,功能和 https://25--5-clock.freecodecamp.rocks 類似。 完成以下需求,並且通過所有測試。 可以使用你需要的任何庫或 API。 賦予它你自己的個人風格。 diff --git a/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-drum-machine.md b/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-drum-machine.md index 46bc000a2e2..4c71d344f0a 100644 --- a/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-drum-machine.md +++ b/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-drum-machine.md @@ -8,7 +8,7 @@ dashedName: build-a-drum-machine # --description-- -**Objective:** Build an app that is functionally similar to this: https://drum-machine.freecodecamp.rocks/. +**目標:** 構建一個應用,功能和 https://drum-machine.freecodecamp.rocks/ 類似。 完成以下需求,並且通過所有測試。 可以使用你需要的任何庫或 API。 賦予它你自己的個人風格。 diff --git a/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-javascript-calculator.md b/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-javascript-calculator.md index 51cf65eeebc..e60ca5202ae 100644 --- a/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-javascript-calculator.md +++ b/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-javascript-calculator.md @@ -8,7 +8,7 @@ dashedName: build-a-javascript-calculator # --description-- -**Objective:** Build an app that is functionally similar to this: https://javascript-calculator.freecodecamp.rocks/. +**目標:** 構建一個應用,功能和 https://javascript-calculator.freecodecamp.rocks/ 類似。 完成以下需求,並且通過所有測試。 可以使用你需要的任何庫或 API。 賦予它你自己的個人風格。 diff --git a/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md b/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md index 385221aecf0..8c3658cf9cd 100644 --- a/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md +++ b/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md @@ -8,7 +8,7 @@ dashedName: build-a-markdown-previewer # --description-- -**Objective:** Build an app that is functionally similar to this: https://markdown-previewer.freecodecamp.rocks/. +**目標:** 構建一個應用,功能和 https://markdown-previewer.freecodecamp.rocks/ 類似。 完成以下需求,並且通過所有測試。 可以使用你需要的任何庫或 API。 賦予它你自己的個人風格。 diff --git a/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-random-quote-machine.md b/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-random-quote-machine.md index d2656cd7cac..7b2fc07ec7b 100644 --- a/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-random-quote-machine.md +++ b/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-random-quote-machine.md @@ -8,7 +8,7 @@ dashedName: build-a-random-quote-machine # --description-- -**Objective:** Build an app that is functionally similar to this: https://random-quote-machine.freecodecamp.rocks/. +**目標:** 構建一個應用,功能和 https://random-quote-machine.freecodecamp.rocks/ 類似。 完成以下需求,並且通過所有測試。 可以使用你需要的任何庫或 API。 賦予它你自己的個人風格。 diff --git a/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/jquery/learn-how-script-tags-and-document-ready-work.md b/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/jquery/learn-how-script-tags-and-document-ready-work.md index 461d0ddcb5f..990d08c4bd2 100644 --- a/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/jquery/learn-how-script-tags-and-document-ready-work.md +++ b/curriculum/challenges/chinese-traditional/03-front-end-development-libraries/jquery/learn-how-script-tags-and-document-ready-work.md @@ -18,7 +18,7 @@ dashedName: learn-how-script-tags-and-document-ready-work 在 `script` 標籤中添加代碼 `$(document).ready(function() {`。 然後在後面(仍在該 `script` 標籤內)用 `});` 閉合它。 -稍後將詳細介紹 `functions`, 現在需要知道的是,只要瀏覽器加載頁面,`function` 中放入的代碼就會運行。 +稍後將詳細介紹 `functions`, 重要的是要知道,在瀏覽器加載頁面後,你放入此 `function` 的代碼將立即運行。 有一點很重要,如果沒有 `document ready function`,代碼將在 HTML 頁面呈現之前運行,這可能會導致錯誤。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/authentication-strategies.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/authentication-strategies.md index b32a2b4ec88..5d35dbeb88f 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/authentication-strategies.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/authentication-strategies.md @@ -10,7 +10,7 @@ dashedName: authentication-strategies 策略是認證用戶的一種方式。 如果你讓用戶在註冊時填寫了用戶信息,那你就可以基於這些信息進行驗證。或者也可以引入第三方登錄,如 Google 或者 Github。 在這個項目中,我們將使用 Passport 中間件。 Passport 提供了一套全面的策略,支持使用用戶名和密碼、GitHub、谷歌等進行認證。 -`passport-local@~1.0.0` has already been added as a dependency, so add it to your server as follows: `const LocalStrategy = require('passport-local');` +已經引入 `passport-local@~1.0.0` 作爲依賴,將它添加到服務器,就像這樣:`const LocalStrategy = require('passport-local');` 然後,需要讓 passport **使用**一個實例化的 LocalStrategy 對象,這個對象的一些設置已完成。 請注意,接下來的所有代碼都應寫在連接數據庫的回調中,因爲它們的執行都依賴數據庫。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md index e1d14e15d4d..c5f9ee3c458 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md @@ -10,7 +10,7 @@ dashedName: authentication-with-socket-io 目前,你還無法確定連接到服務器的用戶身份。 雖然 `req.user` 包含用戶信息,但這個只在用戶直接與服務器交互時產生。當用戶通過 web socket 與服務器連接時,由於不存在 `req` 對象,我們就無法獲取用戶數據。 解決這個問題的方法之一是通過讀取和解析請求中包含 passport session 的 cookie,然後反序列化,進而獲取用戶信息對象。 幸運的是,NPM 上有可以讓這個複雜的流程簡單化的庫。 -`passport.socketio@~3.7.0`, `connect-mongo@~3.2.0`, and `cookie-parser@~1.4.5` have already been added as dependencies. Require them as `passportSocketIo`, `MongoStore`, and `cookieParser` respectively. Also, we need to initialize a new memory store, from `express-session` which we previously required. It should look like this: +`passport.socketio@~3.7.0`、`connect-mongo@~3.2.0` 和 `cookie-parser@~1.4.5` 已經被添加爲依賴項。 分別請求它們爲 `passportSocketIo`、`MongoStore` 和 `cookieParser`。 同時,我們需要從之前引入的 `express-session` 中初始化新的內存。 就像這樣: ```js const MongoStore = require('connect-mongo')(session); @@ -65,7 +65,7 @@ console.log('user ' + socket.request.user.name + ' connected'); 它將在服務器控制檯記錄已連接的用戶! -完成以上要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project up to this point https://gist.github.com/camperbot/1414cc9433044e306dd7fd0caa1c6254. +完成以上要求後,請提交你的頁面鏈接。 如果你遇到了問題,可以參考 https://gist.github.com/camperbot/1414cc9433044e306dd7fd0caa1c6254。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md index b14d397bf59..19350e0ce2e 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md @@ -26,7 +26,7 @@ module.exports = function (app, myDataBase) { 現在,我們來把 server.js 中與驗證相關的代碼分離到 auth.js 中,例如序列化,設置驗證策略等。 請正確添加依賴,並在 server.js 中調用 `auth(app, myDataBase)`。 -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out an example of the completed project. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md index ad93e666f65..73808e06b97 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md @@ -38,7 +38,7 @@ socket.on('user count', function(data) { 現在你可以嘗試啓動你的 app 並登錄,你會看到在客戶端的控制檯打印出了 “1”,這就表示目前連接到服務器的用戶數爲 1。 你可以試着通過打開多個 app 來驗證數量是否會增加。 -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/create-new-middleware.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/create-new-middleware.md index ba267e8e475..6c8f145b81c 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/create-new-middleware.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/create-new-middleware.md @@ -31,7 +31,7 @@ app }); ``` -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md index eab72ab1823..cf7f8820a15 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md @@ -22,7 +22,7 @@ socket.on('disconnect', () => { **注意:**和 `'disconnect'` 類似,所有 socket 可以發送到服務器的事件,我們都應該在有 “socket” 定義的連接監聽器裏處理。 -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md index 42b5b3d0243..49765741143 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md @@ -10,7 +10,7 @@ dashedName: hashing-your-passwords 回過頭來看信息安全,你也許記得在數據庫中存儲明文密碼是*絕對*禁止的。 現在,我們需要引入 BCrypt 來解決這個問題。 -`bcrypt@~5.0.0` has already been added as a dependency, so require it in your server. 你需要在兩個步驟中使用哈希運算:註冊和保存新賬戶,以及登錄時檢查密碼是否正確。 +`bcrypt@~5.0.0` 已被添加爲依賴項,在你的服務器中請求它。 你需要在兩個步驟中使用哈希運算:註冊和保存新賬戶,以及登錄時檢查密碼是否正確。 目前處理註冊的路由中,我們是這樣把密碼添加到數據庫的:`password: req.body.password`。 保存哈希值的一個簡單方式是在數據庫邏輯中添加 `const hash = bcrypt.hashSync(req.body.password, 12);`,然後把 `req.body.password` 替換爲 `password: hash`。 @@ -24,7 +24,7 @@ if (!bcrypt.compareSync(password, user.password)) { 當你需要存儲密碼時,這樣做可以有效地提升網站的安全性。 -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md index 119469df9d5..5b6d472022c 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md @@ -24,7 +24,7 @@ h2.center#welcome Welcome, #{username}! a(href='/logout') Logout ``` -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md index 10ab146d70b..e6b848566e9 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md @@ -18,7 +18,7 @@ dashedName: how-to-use-passport-strategies 這時,由於我們還沒有實現註冊功能,如果你在表單裏輸入了用戶名和密碼,路由將會重定向到主頁 `/`,在服務端將會打印 `'User {USERNAME} attempted to log in.'`。 -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implement-the-serialization-of-a-passport-user.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implement-the-serialization-of-a-passport-user.md index b3989f852ce..54c27f2dad3 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implement-the-serialization-of-a-passport-user.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implement-the-serialization-of-a-passport-user.md @@ -10,7 +10,7 @@ dashedName: implement-the-serialization-of-a-passport-user 截至目前,我們還沒有配置完數據庫,因此還無法加載用戶數據。 實現這個的方式很多,但對於我們的項目,一旦服務器啓動,那麼只要有 app 實例在運行,數據庫就應一直處於連接狀態。 爲此,你需要在環境變量 `MONGO_URI` 中添加你的數據庫地址(比如:`mongodb+srv://:@cluster0-jvwxi.mongodb.net/?retryWrites=true&w=majority`)。 我們會在 `connection.js` 文件中調用它。 -*If you are having issues setting up a free database on MongoDB Atlas, check out tutorial.* +*如果你在 MongoDB Atlas 設置免費數據庫時遇到問題,請查看教程。* 現在我們想要連接到數據庫,然後開始監聽請求。 這樣做的目的是在連接數據庫之前或者出現數據庫錯誤時,不接收任何請求。 要實現這一點,你需要在以下代碼中包含序列化和應用的路由: @@ -40,7 +40,7 @@ myDB(async client => { 記得要取消 `deserializeUser` 中 `myDataBase` 的註釋,並把 `doc` 添加到 `done(null, null)`。 -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md index 78d443e59b0..0f607bd5892 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md @@ -8,13 +8,13 @@ dashedName: implementation-of-social-authentication-ii # --description-- -設置 GitHub 驗證的最後一步是創建策略本身。 `passport-github@~1.1.0` has already been added as a dependency, so require it in your `auth.js` file as `GithubStrategy` like this: `const GitHubStrategy = require('passport-github').Strategy;`. 別忘了請求和配置 `dotenv`,使用你的環境變量。 +設置 GitHub 驗證的最後一步是創建策略本身。 已經添加 `passport-github@~1.1.0` 作爲依賴,在 `auth.js` 中請求它,作爲 `GithubStrategy`,像這樣:`const GitHubStrategy = require('passport-github').Strategy;`。 別忘了請求和配置 `dotenv`,使用你的環境變量。 爲了設置 GitHub 策略,我們需要在 Passport 中使用實例化的 `GitHubStrategy`,它可以接收兩個參數:一個對象(包括 `clientID`、`clientSecret` 和 `callbackURL`),以及一個回調函數。在這個回調函數中,我們要處理驗證成功時,判斷用戶是否已經在數據庫中存在的邏輯,以及在用戶數據庫對象中最初保存哪些字段。 這種處理方式適用於絕大部分第三方驗證策略,但有些策略會需要我們提供更多的信息,詳情請參考相關策略的 GitHub README。 例如,Google 的驗證策略會要求你提供一個 *scope*,用於標示用戶成功登錄後,你需要從返回的對象中獲取那些信息。以及,這也需要經過用戶同意,你纔可以獲取到。 -The current strategy we are implementing authenticates users using a GitHub account and OAuth 2.0 tokens. The client ID and secret obtained when creating an application are supplied as options when creating the strategy. The strategy also requires a `verify` callback, which receives the access token and optional refresh token, as well as `profile` which contains the authenticated user's GitHub profile. The `verify` callback must call `cb` providing a user to complete authentication. +當前策略是使用 GitHub 賬戶和 OAuth 2.0 令牌驗證用戶。 創建應用程序時獲得的客戶 ID 和密碼在創建策略時作爲選項提供。 策略還需要 `verify` 回調,接收訪問令牌和可選刷新令牌, 以及包含認證用戶的 GitHub 資料的 `profile`。 `verify` 回調必須調用 `cb` 提供用戶完成驗證。 -Here's how your new strategy should look at this point: +你的新策略應該是這樣的: ```js passport.use(new GitHubStrategy({ @@ -29,13 +29,13 @@ passport.use(new GitHubStrategy({ )); ``` -Your authentication won't be successful yet, and it will actually throw an error without the database logic and callback, but it should log your GitHub profile to your console if you try it! +目前,你的驗證部分不會成功。由於沒有數據庫的邏輯和回調函數,你的代碼目前還會報錯。但如果你試一試,就可以在控制檯裏看到輸出了你的 GitHub 個人信息。 -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- -passport-github dependency should be added. +應正確添加依賴 passport-github。 ```js (getUserInput) => @@ -54,7 +54,7 @@ passport-github dependency should be added. ); ``` -passport-github should be required. +應正確請求依賴 passport-github。 ```js (getUserInput) => @@ -72,7 +72,7 @@ passport-github should be required. ); ``` -GitHub strategy should be setup correctly thus far. +到目前爲止,GitHub 策略應正確設置。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-iii.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-iii.md index d278ad9897b..410f568fb37 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-iii.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-iii.md @@ -42,7 +42,7 @@ myDataBase.findOneAndUpdate( 你現在應該可以登錄你的應用了,試試吧。 -完成上述要求後,你可以在下方提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,你可以在下方提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication.md index 8d2b0f776fe..91ac422dbcd 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication.md @@ -18,7 +18,7 @@ dashedName: implementation-of-social-authentication 在 OAuth 驗證策略中,我們至少需要提供 *Client ID* 和 *Client Secret*,這樣第三方平臺就會獲悉驗證請求的來源,以及這個來源是否有效。 爲此,需要去我們使用的第三方驗證平臺(比如 GitHub)獲取這兩個字段的值。 注意,我們獲取到的這個值是唯一的,僅對我們的當前 app 有效——**因此,千萬不要分享給別人**,更不要上傳到公共倉庫或者直接寫在代碼裏。 通常,我們會把它們放在 `.env` 文件裏,並通過 `process.env.GITHUB_CLIENT_ID` 獲取。 對於這次挑戰,我們將會使用 GitHub 作爲驗證平臺。 -Obtaining your *Client ID and Secret* from GitHub is done in your account profile settings under 'developer settings', then 'OAuth applications'. 點擊 “Register a new application(註冊一個新的應用)”,設置你的應用名稱,然後把你的 Replit 主頁地址(**不是項目代碼的 url**)粘貼到 Homepage URL。然後,回調 url 需要設置成上面 Homepage URL 裏你粘貼的地址,但後面要加上 `/auth/github/callback`。 這樣在用戶通過 Github 驗證後才能跳轉到我們指定的頁面。 在你的 `.env` 文件裏將返回的信息保存爲 `'GITHUB_CLIENT_ID'` 和 `'GITHUB_CLIENT_SECRET'`。 +首先,你需要進入賬戶設置裏的 “developer settings(開發者設置)”板塊,在 'OAuth applications' 獲取 *用戶 ID 和密碼*。 點擊 “Register a new application(註冊一個新的應用)”,設置你的應用名稱,然後把你的 Replit 主頁地址(**不是項目代碼的 url**)粘貼到 Homepage URL。然後,回調 url 需要設置成上面 Homepage URL 裏你粘貼的地址,但後面要加上 `/auth/github/callback`。 這樣在用戶通過 Github 驗證後才能跳轉到我們指定的頁面。 在你的 `.env` 文件裏將返回的信息保存爲 `'GITHUB_CLIENT_ID'` 和 `'GITHUB_CLIENT_SECRET'`。 在你的 `routes.js` 文件中,添加 `showSocialAuth: true` 到主頁路由,在 `showRegistration: true` 的後面。 然後,爲 `/auth/github` 和 `/auth/github/callback` 創建兩個接收 GET 請求的路由。 第一個只需要通過調用 passport 來驗證 `'github'`。 第二個應該調用 passport 來驗證 `'github'`,但需要在失敗時跳轉回主頁 `/`,成功時跳轉到用戶頁面 `/profile`(跳轉的邏輯與上一個項目中的邏輯一樣)。 @@ -31,7 +31,7 @@ app.route('/login') }); ``` -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project up to this point https://gist.github.com/camperbot/1f7f6f76adb178680246989612bea21e. +完成上述要求後,請提交你的頁面鏈接。 如果你遇到了問題,可以參考 https://gist.github.com/camperbot/1f7f6f76adb178680246989612bea21e。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/logging-a-user-out.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/logging-a-user-out.md index b1523952694..0f97b984faa 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/logging-a-user-out.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/logging-a-user-out.md @@ -30,11 +30,11 @@ app.use((req, res, next) => { }); ``` -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- -`req.logout()` should be called in your `/logout` route. +`req.logout()` 應在 `/logout` 路由中調用。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/registration-of-new-users.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/registration-of-new-users.md index a2a47f0bd01..7dc97b2d1b0 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/registration-of-new-users.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/registration-of-new-users.md @@ -47,7 +47,7 @@ app.route('/register') ); ``` -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 **注意:**接下來的挑戰可能會在運行 *picture-in-picture*(畫中畫)模式的瀏覽器中出現問題。 如果你使用的線上 IDE 提供在 IDE 內預覽 app 的功能,請考慮打開新的標籤頁預覽。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.md index 32bdcaf76bd..d7bd3979595 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.md @@ -28,7 +28,7 @@ socket.emit('chat message', messageToSend); 至此,我們已經完成發送信息到所有客戶端的功能。 -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md index 5891eee6470..3f841df1ef9 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md @@ -12,7 +12,7 @@ dashedName: serialization-of-a-user-object 我們需要用到序列化和反序列化的方法來進行配置。 passport 爲我們提供了 `passport.serializeUser( OURFUNCTION )` 和 `passport.deserializeUser( OURFUNCTION )` 兩個方法。 -`serializeUser` 方法接收兩個參數,分別是表示用戶的對象和一個回調函數。 其中,回調函數的返回值應爲這個用戶的唯一標識符:最簡單的寫法就是讓它返回用戶的 `_id`。 它應當是唯一的,是由 MongoDB 產生的。 類似地,`deserializeUser` 也接收兩個參數,分別是在序列化時生成的標識符以及一個回調函數。在回調函數裏,我們需要根據根據傳入的標識符(比如 \_id)返回表示用戶的對象。 爲了在 MongoDB 中通過 query(查詢語句)獲取 `_id` 字段,首先我們需要創建 `const ObjectID = require('mongodb').ObjectID;`;然後調用它:`new ObjectID(THE_ID)`。 `mongodb@~3.6.0` has already been added as a dependency. 你可以在下面的例子中看到: +`serializeUser` 方法接收兩個參數,分別是表示用戶的對象和一個回調函數。 其中,回調函數的返回值應爲這個用戶的唯一標識符:最簡單的寫法就是讓它返回用戶的 `_id`。 它應當是唯一的,是由 MongoDB 產生的。 類似地,`deserializeUser` 也接收兩個參數,分別是在序列化時生成的標識符以及一個回調函數。在回調函數裏,我們需要根據根據傳入的標識符(比如 \_id)返回表示用戶的對象。 爲了在 MongoDB 中通過 query(查詢語句)獲取 `_id` 字段,首先我們需要創建 `const ObjectID = require('mongodb').ObjectID;`;然後調用它:`new ObjectID(THE_ID)`。 `mongodb@~3.6.0` 已經被添加爲依賴項。 你可以在下面的例子中看到: ```js passport.serializeUser((user, done) => { @@ -28,7 +28,7 @@ passport.deserializeUser((id, done) => { 因此,在我們在下一步中配置 DB 前,`deserializeUser` 會拋出錯誤。所以,現在請先註釋掉上面的代碼,在 `deserializeUser` 中僅調用 `done(null, null)` 即可。 -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-a-template-engine.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-a-template-engine.md index 3a24e4382d9..ac369eba179 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-a-template-engine.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-a-template-engine.md @@ -10,25 +10,25 @@ dashedName: set-up-a-template-engine 你可以採用下面的任意一種方式完成這些挑戰: -- Clone this GitHub repo and complete these challenges locally. -- Use our Replit starter project to complete these challenges. +- 克隆這個 GitHub 倉庫,並在本地完成這些挑戰。 +- 使用我們在 Replit 上的初始化項目來完成這些挑戰。 - 使用一個你選擇的站點生成器來完成項目。 需要確定包含了我們 GitHub 倉庫的所有文件。 完成本項目後,請將一個正常運行的 demo(項目演示)託管在可以公開訪問的平臺。 然後在 `Solution Link` 框中提交你的項目 URL。 你可以在應用的模版引擎中使用靜態模板文件(如那些寫在 *Pug* 裏的)。 在運行時,模版引擎會用服務端的真實數據替換掉模版文件中的變量, 然後將模版轉譯成發送給客戶端的 HTML 靜態文件。 這樣可以輕鬆地構造 HTML 頁面,允許在頁面直接顯示變量內容而不需要從客戶端發送 API 請求。 -`pug@~3.0.0` has already been installed, and is listed as a dependency in your `package.json` file. +`pug@~3.0.0` 已經被安裝,並且在你項目的 `package.json` 文件中作爲依賴。 Express 需要知道你正在使用哪個模板引擎。 我們將使用 `set` 方法來分配 `pug` 作爲 `view engine` 屬性的值: `app.set('view engine', 'pug')`。 -Your page will be blank until you correctly render the index file in the `views/pug` directory. +在正確渲染 `views/pug` 目錄中的索引文件之後,加載頁面。 -To render the `pug` template, you need to use `res.render()` in the `/` route. Pass the file path to the `views/pug` directory as the argument to the method. The path can be a relative path (relative to views), or an absolute path, and does not require a file extension. +要渲染 `pug` 模板,你需要在 `/` 路由中使用 `res.render()`。 將文件路徑作爲參數傳遞到方法的 `views/pug` 目錄。 這個路徑可以是相對路徑(相對於 views),也可以是絕對路徑,不需要文件擴展。 -If all went as planned, your app home page will no longer be blank and will display a message indicating you've successfully rendered the Pug template! +如果一切按計劃進行,你的應用程序主頁將不再是空白的,並將顯示一條信息,表明你已經成功地渲染了 Pug 模板! -完成以上要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成以上要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-passport.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-passport.md index 55f6d64fbfb..5e89342a239 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-passport.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-passport.md @@ -8,13 +8,13 @@ dashedName: set-up-passport # --description-- -現在我們來創建 *Passport*,最終我們需要用它來實現用戶註冊和登錄。 除了 Passport,我們還會用 Express-session 來處理 session(會話)。 Express-session has a ton of advanced features you can use, but for now we're just going to use the basics! Using this middleware saves the session id as a cookie in the client and allows us to access the session data using that id on the server. This way we keep personal account information out of the cookie used by the client to verify to our server they are authenticated and just keep the *key* to access the data stored on the server. +現在我們來創建 *Passport*,最終我們需要用它來實現用戶註冊和登錄。 除了 Passport,我們還會用 Express-session 來處理 session(會話)。 Express-session 有許多高級特性,但我們暫時只需要瞭解其基礎功能。 在客戶端,我們可以用這個中間件把 session id 儲存到 cookie。同時,我們可以在服務器上通過這個 id 訪問 session 數據。 通過這種方式,我們無需把用戶的個人賬號信息存到 cookie,來完成用戶的驗證。只需要用這個 id 作爲 *key* 來訪問服務器上用戶的數據即可。 -`passport@~0.4.1` and `express-session@~1.17.1` are already installed, and are both listed as dependencies in your `package.json` file. +`passport@~0.4.1` 和 `express-session@~1.17.1` 已經安裝,並且在你的 `package.json` 文件中均被列爲依賴項。 -You will need to set up the session settings now and initialize Passport. Be sure to first create the variables 'session' and 'passport' to require 'express-session' and 'passport' respectively. +現在,你需要配置 session 並初始化 Passport。 請先創建變量 “session” 和 “passport” 來分別引入 “express-session” 和 “passport”。 -To set up your express app to use the session we'll define just a few basic options. Be sure to add 'SESSION_SECRET' to your .env file and give it a random value. This is used to compute the hash used to encrypt your cookie! +爲了讓 express 應用可以使用 session,我們需要添加一些基礎選項。 請在 .env 文件中添加字段 “SESSION_SECRET”,並給它賦一個隨機值, 便於加密 cookie、計算哈希。 ```js app.use(session({ @@ -25,13 +25,13 @@ app.use(session({ })); ``` -As well you can go ahead and tell your express app to **use** 'passport.initialize()' and 'passport.session()'. (For example, `app.use(passport.initialize());`) +還有,我們需要讓 express **使用** “passport.initialize()” 和 “passport.session()”。 (例如,`app.use(passport.initialize());`)。 -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- -Passport and Express-session should be dependencies. +應添加 Passport 和 Express-session 作爲依賴。 ```js (getUserInput) => @@ -55,7 +55,7 @@ Passport and Express-session should be dependencies. ); ``` -Dependencies should be correctly required. +依賴應正確引入。 ```js (getUserInput) => @@ -78,7 +78,7 @@ Dependencies should be correctly required. ); ``` -Express app should use new dependencies. +Express app 可以使用新的依賴。 ```js (getUserInput) => @@ -101,7 +101,7 @@ Express app should use new dependencies. ); ``` -Session and session secret should be correctly set up. +應正確設置 Session 和會話密碼。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md index 9b779f41eac..05f2aab129f 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md @@ -10,7 +10,7 @@ dashedName: set-up-the-environment 在接下來的挑戰中,我們將會用到 `chat.pug` 文件。 首先,在你的 `routes.js` 文件中爲 `/chat` 添加一個處理 GET 請求的路由,並給它傳入 `ensureAuthenticated`。在回調函數中,我們需要讓它渲染 `chat.pug` 文件,並在響應中包含 `{ user: req.user }` 信息。 現在,請修改 `/auth/github/callback` 路由,讓它可以像這樣設置 user_id:`req.session.user_id = req.user.id`,並在設置完成後重定向至 `/chat`。 -`socket.io@~2.3.0` has already been added as a dependency, so require/instantiate it in your server as follows with `http` (comes built-in with Nodejs): +已添加 `socket.io@~2.3.0` 作爲依賴項,在你的服務器中和 `http` (內置在 Nodejs 中)一起導入/實例化,具體如下: ```javascript const http = require('http').createServer(app); @@ -19,7 +19,7 @@ const io = require('socket.io')(http); 現在我們的 *express 應用*已經包含了 *http* 服務,接下來我們需要監聽 *http* 服務的事件。 爲此,我們需要把 `app.listen` 更新爲 `http.listen`。 -需要處理的第一件事是監聽客戶端的新連接。 on 關鍵字就是監聽這個特定事件。 It requires 2 arguments: a string containing the title of the event that's emitted, and a function with which the data is passed through. 在連接監聽器中,我們用 *socket* 來代表它所包含的數據。 socket 就是指已連接到服務器的客戶端。 +需要處理的第一件事是監聽客戶端的新連接。 on 關鍵字就是監聽這個特定事件。 它需要 2 個參數:一個包含所發出事件標題的字符串,以及一個用於傳遞數據的函數。 在連接監聽器中,我們用 *socket* 來代表它所包含的數據。 socket 就是指已連接到服務器的客戶端。 爲了可以監聽服務器的連接事件,我們在數據庫連接的部分加入如下代碼: @@ -42,7 +42,7 @@ let socket = io(); **注意:**只有在連接到處於同一個 url/server 上的 socket 時,`io()`纔可以正常執行。 如果需要連接到外部的 socket,就需要這樣調用:`io.connect('URL');`。 -完成上述要求後,請提交你的頁面鏈接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,請提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/use-a-template-engines-powers.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/use-a-template-engines-powers.md index cce5575a5af..fca272ec0ab 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/use-a-template-engines-powers.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/advanced-node-and-express/use-a-template-engines-powers.md @@ -12,9 +12,9 @@ dashedName: use-a-template-engines-powers 在 Pug 文件中,你可以用變量名來調用變量,比如寫成 `#{variable_name}` 來實現行內調用,或像 `p=variable_name` 把元素與變量直接寫在一起,這表示 p 元素的內容等價於這個變量。 - Pug is all about using whitespace and tabs to show nested elements and cutting down on the amount of code needed to make a beautiful site. Read the Pug documentation for more information on usage and syntax. + Pug 是關於使用空白和製表符來顯示嵌套元素,並減少製作一個漂亮網站所需的代碼量。 閱讀 Pug 文檔以獲取更多關於使用和語法的信息。 - Here is an example: + 下面是一個例子: ```html @@ -38,17 +38,17 @@ dashedName: use-a-template-engines-powers ``` -Looking at our pug file `index.pug` included in your project, we used the variables `title` and `message`. +查看在你的項目中的 pug 文件 `index.pug`,我們使用了變量 `title` 和 `message`。 -To pass those along from our server, you will need to add an object as a second argument to your `res.render` with the variables and their values. For example, pass this object along setting the variables for your index view: `{title: 'Hello', message: 'Please login'}` +爲了從服務器傳遞這些信息,你需要給 `res.render` 的第二個參數傳入一個對象,其中包含變量和對應的值。 例如,在設置索引視圖的變量時傳遞此對象:`{title: 'Hello', message: 'Please login'}`。 -It should look like: `res.render(process.cwd() + '/views/pug/index', {title: 'Hello', message: 'Please login'});` 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! +看起來應該像這樣:`res.render(process.cwd() + '/views/pug/index', {title: 'Hello', message: 'Please login'});`。現在刷新頁面,你應該看到那些值就像在 `index.pug` 文件中一樣被渲染在頁面上正確的位置。 -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point. +完成上述要求後,你可以在下方提交你的頁面鏈接。 如果你在運行時遇到錯誤,你可以查看已執行項目的當前進度。 # --hints-- -Pug should correctly render variables. +Pug 應正確地展示變量。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/assert-deep-equality-with-.deepequal-and-.notdeepequal.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/assert-deep-equality-with-.deepequal-and-.notdeepequal.md index 72465c4f868..4e44847044a 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/assert-deep-equality-with-.deepequal-and-.notdeepequal.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/assert-deep-equality-with-.deepequal-and-.notdeepequal.md @@ -8,7 +8,7 @@ dashedName: assert-deep-equality-with--deepequal-and--notdeepequal # --description-- -As a reminder, this project is being built upon the following starter project on Replit or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 `deepEqual()` 斷言兩個對象是否深度相等。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/compare-the-properties-of-two-elements.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/compare-the-properties-of-two-elements.md index 107b249b8de..e473421d474 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/compare-the-properties-of-two-elements.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/compare-the-properties-of-two-elements.md @@ -8,15 +8,15 @@ dashedName: compare-the-properties-of-two-elements # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 # --instructions-- -Within `tests/1_unit-tests.js` under the test labelled `#8` in the `Comparisons` suite, change each `assert` to either `assert.isAbove` or `assert.isAtMost` to make the test pass (should evaluate to `true`). Do not alter the arguments passed to the asserts. +在 `tests/1_unit-tests.js` 中,在標有 `#8` 的 `Comparisons` 套件裏,將每個 `assert` 改成 `assert.isAbove` 或 `assert.isAtMost` 方法,讓測試通過(結果應該返回 `true`)。 不要修改傳給斷言的參數。 # --hints-- -All tests should pass. +應通過所有測試。 ```js (getUserInput) => @@ -30,7 +30,7 @@ All tests should pass. ); ``` -You should choose the correct method for the first assertion - `isAbove` vs. `isAtMost`. +請爲第一個斷言選擇正確的方法 — `isAbove` 或 `isAtMost`。 ```js (getUserInput) => @@ -48,7 +48,7 @@ You should choose the correct method for the first assertion - `isAbove` vs. `is ); ``` -You should choose the correct method for the second assertion - `isAbove` vs. `isAtMost`. +請爲第二個斷言選擇正確的方法 — `isAbove` 或 `isAtMost`。 ```js (getUserInput) => @@ -62,7 +62,7 @@ You should choose the correct method for the second assertion - `isAbove` vs. `i ); ``` -You should choose the correct method for the third assertion - `isAbove` vs. `isAtMost`. +請爲第三個斷言選擇正確的方法 — `isAbove` 或 `isAtMost`。 ```js (getUserInput) => @@ -80,7 +80,7 @@ You should choose the correct method for the third assertion - `isAbove` vs. `is ); ``` -You should choose the correct method for the fourth assertion - `isAbove` vs. `isAtMost`. +請爲第四個斷言選擇正確的方法 — `isAbove` 或 `isAtMost`。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/learn-how-javascript-assertions-work.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/learn-how-javascript-assertions-work.md index 71b7099db8c..88da660d10f 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/learn-how-javascript-assertions-work.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/learn-how-javascript-assertions-work.md @@ -10,8 +10,8 @@ dashedName: learn-how-javascript-assertions-work 你可以採用下面的任意一種方式完成這些挑戰: -- Clone this GitHub repo and complete these challenges locally. -- Use our Replit starter project to complete these challenges. +- 克隆這個 GitHub 倉庫,並在本地完成這些挑戰。 +- 使用我們在 Replit 上的初始化項目來完成這些挑戰。 - 使用一個你喜歡的站點生成器來完成項目。 需要確定包含了我們 GitHub 倉庫的所有文件。 完成本項目後,請將一個正常運行的 demo(項目演示)託管在可以公開訪問的平臺。 然後在 `Solution Link` 框中提交你的項目 URL。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iii---put-method.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iii---put-method.md index 9995cdeb83d..7ef33830c83 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iii---put-method.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iii---put-method.md @@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-an-api-response-using-chai-http-iii---put-me # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 當你測試一個 `PUT` 請求時,你經常會隨同它一起發送數據。 你在 `PUT` 請求中包含的數據被稱爲請求的主體。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method.md index d556982e11e..1fdb69726f8 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method.md @@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-an-api-response-using-chai-http-iv---put-met # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 這個練習與上一個類似。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http-ii.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http-ii.md index f2a580bd225..84de657090f 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http-ii.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http-ii.md @@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-api-endpoints-using-chai-http-ii # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 # --instructions-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http.md index 858d3f856d8..dc93d0bbb74 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http.md @@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-api-endpoints-using-chai-http # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 Mocha 允許你使用名爲 `chai-http` 的插件測試異步操作,例如調用 API 端點。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser-ii.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser-ii.md index 8ee00251c2f..cca9de9a72f 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser-ii.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser-ii.md @@ -8,11 +8,11 @@ dashedName: run-functional-tests-using-a-headless-browser-ii # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 # --instructions-- -Within `tests/2_functional-tests.js`, in the `'Submit the surname "Vespucci" in the HTML form'` test (`// #6`), automate the following: +在 `tests/2_functional-tests.js` 中,在 `'Submit the surname "Vespucci" in the HTML form'` 測試(`// #6`),自動執行以下操作: 1. 在表格中填寫姓氏 `Vespucci`。 2. 點擊提交按鈕 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser.md index a4d9b7014e9..8c276489630 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser.md @@ -8,7 +8,7 @@ dashedName: run-functional-tests-using-a-headless-browser # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 在頁面上有一個輸入表單。 它將數據作爲 AJAX 請求發送到 `PUT /travellers` 端點。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/simulate-actions-using-a-headless-browser.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/simulate-actions-using-a-headless-browser.md index 3d73b5e4b91..8b3ce389571 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/simulate-actions-using-a-headless-browser.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/simulate-actions-using-a-headless-browser.md @@ -7,7 +7,7 @@ dashedName: simulate-actions-using-a-headless-browser # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 在接下來的挑戰中,你將使用無頭瀏覽器模擬人類與頁面的交互。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-for-truthiness.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-for-truthiness.md index 120fbb97114..5533810b717 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-for-truthiness.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-for-truthiness.md @@ -8,7 +8,7 @@ dashedName: test-for-truthiness # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 `isTrue()` 僅當給出的值爲 Boolean 的 `true` 時可以通過測試;`isNotTrue()` 則會在給出除 `true` 以外的值時通過測試。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-string-contains-a-substring.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-string-contains-a-substring.md index 23b356d6daa..39791a09696 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-string-contains-a-substring.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-string-contains-a-substring.md @@ -8,7 +8,7 @@ dashedName: test-if-a-string-contains-a-substring # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 `include()` 和 `notInclude()` 同樣可以用於字符串。 `include()` 用於斷言字符串中包含某個子字符串。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-falls-within-a-specific-range.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-falls-within-a-specific-range.md index 91aaf87b3e2..6d41a203c14 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-falls-within-a-specific-range.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-falls-within-a-specific-range.md @@ -8,7 +8,7 @@ dashedName: test-if-a-value-falls-within-a-specific-range # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 ```javascript .approximately(actual, expected, delta, [message]) diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-a-string.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-a-string.md index 039a43e37c8..0d314f037df 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-a-string.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-a-string.md @@ -8,7 +8,7 @@ dashedName: test-if-a-value-is-a-string # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 `isString` 或 `isNotString` 斷言一個值是否爲字符串。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-of-a-specific-data-structure-type.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-of-a-specific-data-structure-type.md index b9179db3dd9..05743ae1ddb 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-of-a-specific-data-structure-type.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-of-a-specific-data-structure-type.md @@ -8,7 +8,7 @@ dashedName: test-if-a-value-is-of-a-specific-data-structure-type # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 `#typeOf` 斷言一個值的類型符合給定的類型,這個類型與 `Object.prototype.toString` 一致。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-variable-or-function-is-defined.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-variable-or-function-is-defined.md index f983bf4b262..ebd071fbbbe 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-variable-or-function-is-defined.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-variable-or-function-is-defined.md @@ -8,7 +8,7 @@ dashedName: test-if-a-variable-or-function-is-defined # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 # --instructions-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-array-contains-an-item.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-array-contains-an-item.md index 3aef8eaa9b0..2dcc99b2ce0 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-array-contains-an-item.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-array-contains-an-item.md @@ -8,7 +8,7 @@ dashedName: test-if-an-array-contains-an-item # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 # --instructions-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-has-a-property.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-has-a-property.md index da6a59a3d90..5c39797a9a5 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-has-a-property.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-has-a-property.md @@ -8,7 +8,7 @@ dashedName: test-if-an-object-has-a-property # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 `property` 斷言一個對象含有給定屬性。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-is-an-instance-of-a-constructor.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-is-an-instance-of-a-constructor.md index 407a4a415d0..09f91d9329d 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-is-an-instance-of-a-constructor.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-is-an-instance-of-a-constructor.md @@ -8,7 +8,7 @@ dashedName: test-if-an-object-is-an-instance-of-a-constructor # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 `#instanceOf` 斷言一個對象是一個構造器的實例。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-one-value-is-below-or-at-least-as-large-as-another.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-one-value-is-below-or-at-least-as-large-as-another.md index 601d7496b65..4aa1effd7cb 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-one-value-is-below-or-at-least-as-large-as-another.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-one-value-is-below-or-at-least-as-large-as-another.md @@ -8,7 +8,7 @@ dashedName: test-if-one-value-is-below-or-at-least-as-large-as-another # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 # --instructions-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-assert.isok-and-assert.isnotok.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-assert.isok-and-assert.isnotok.md index 8583e4d2ee7..c5a05ddb2c4 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-assert.isok-and-assert.isnotok.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-assert.isok-and-assert.isnotok.md @@ -8,11 +8,11 @@ dashedName: use-assert-isok-and-assert-isnotok # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 `isOk()` 用來測試值是否爲真值,`isNotOk()` 用來測試值是否爲假值。 -To learn more about truthy and falsy values, try our Falsy Bouncer challenge. +可以在過濾數組中的假值這個挑戰中瞭解更多關於真值和假值的信息。 # --instructions-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-regular-expressions-to-test-a-string.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-regular-expressions-to-test-a-string.md index 659ba631dd9..b4050f60c8d 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-regular-expressions-to-test-a-string.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-regular-expressions-to-test-a-string.md @@ -8,7 +8,7 @@ dashedName: use-regular-expressions-to-test-a-string # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 `match()` 斷言一個值匹配一個正則表達式(第二個參數)。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-double-equals-to-assert-equality.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-double-equals-to-assert-equality.md index e7ee1a318bd..e16ff545222 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-double-equals-to-assert-equality.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-double-equals-to-assert-equality.md @@ -8,7 +8,7 @@ dashedName: use-the-double-equals-to-assert-equality # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 `equal()` 使用 `==` 比較對象。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-triple-equals-to-assert-strict-equality.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-triple-equals-to-assert-strict-equality.md index 39bbff495fa..9edeb79033e 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-triple-equals-to-assert-strict-equality.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-triple-equals-to-assert-strict-equality.md @@ -8,7 +8,7 @@ dashedName: use-the-triple-equals-to-assert-strict-equality # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +請注意,本項目是在 Replit 上的初始化項目的基礎上進行開發,你也可以從 GitHub 上克隆。 `strictEqual()` 使用 `===` 比較對象。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/american-british-translator.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/american-british-translator.md index 2d9443effcd..e6146867fcb 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/american-british-translator.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/american-british-translator.md @@ -8,10 +8,10 @@ dashedName: american-british-translator # --description-- -Build a full stack JavaScript app that is functionally similar to this: https://american-british-translator.freecodecamp.rocks/. 可以採用下面的任意一種方式完成這個挑戰: +構建一個 JavaScript 全棧應用,在功能上與 https://american-british-translator.freecodecamp.rocks/ 類似。 可以採用下面的任意一種方式完成這個挑戰: -- Clone this GitHub repo and complete your project locally. -- Use our Replit starter project to complete your project. +- 克隆這個 GitHub 倉庫,並在本地完成你的項目。 +- 使用我們在 Replit 上的初始化項目來完成你的項目。 - 使用您選擇的站點生成器來完成項目。 並確保包含了我們 GitHub 倉庫的所有文件。 當完成本項目,請確認有一個可以公開訪問的正常運行 demo 。 然後將 URL 提交到 `Solution Link` 中。 此外,還可以將項目的源碼提交到 `GitHub Link` 中。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/issue-tracker.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/issue-tracker.md index e1096893573..b3fdf9e4d7f 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/issue-tracker.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/issue-tracker.md @@ -8,10 +8,10 @@ dashedName: issue-tracker # --description-- -Build a full stack JavaScript app that is functionally similar to this: https://issue-tracker.freecodecamp.rocks/. 可以採用下面的任意一種方式完成這個挑戰: +構建一個 JavaScript 全棧應用,在功能上與 https://issue-tracker.freecodecamp.rocks/ 類似。 可以採用下面的任意一種方式完成這個挑戰: -- Clone this GitHub repo and complete your project locally. -- Use this Replit starter project to complete your project. +- 克隆這個 GitHub 倉庫,並在本地完成你的項目。 +- 使用我們的 Replit 初始化項目來完成你的項目。 - 使用一個你喜歡的站點生成器來完成項目。 需要確定包含了我們 GitHub 倉庫的所有文件。 完成本項目後,請將一個正常運行的 demo(項目演示)託管在可以公開訪問的平臺。 然後在 `Solution Link` 框中提交你的項目 URL。 此外,還可以將項目的源碼提交到 `GitHub Link` 中。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/metric-imperial-converter.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/metric-imperial-converter.md index 6a3f006a885..8b6954c1e0f 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/metric-imperial-converter.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/metric-imperial-converter.md @@ -8,10 +8,10 @@ dashedName: metric-imperial-converter # --description-- -Build a full stack JavaScript app that is functionally similar to this: https://metric-imperial-converter.freecodecamp.rocks/. 可以採用下面的任意一種方式完成這個挑戰: +構建一個 JavaScript 全棧應用,在功能上與 https://metric-imperial-converter.freecodecamp.rocks/ 類似。 可以採用下面的任意一種方式完成這個挑戰: -- Clone this GitHub repo and complete your project locally. -- Use our Replit starter project to complete your project. +- 克隆這個 GitHub 倉庫,並在本地完成你的項目。 +- 使用我們在 Replit 上的初始化項目來完成你的項目。 - 使用一個你喜歡的站點生成器來完成項目。 需要確定包含了我們 GitHub 倉庫的所有文件。 完成本項目後,請將一個正常運行的 demo(項目演示)託管在可以公開訪問的平臺。 然後在 `Solution Link` 框中提交你的項目 URL。 此外,還可以將項目的源碼提交到 `GitHub Link` 中。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/personal-library.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/personal-library.md index f9e2f97afda..df64c6d44af 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/personal-library.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/personal-library.md @@ -8,10 +8,10 @@ dashedName: personal-library # --description-- -Build a full stack JavaScript app that is functionally similar to this: https://personal-library.freecodecamp.rocks/. 可以採用下面的任意一種方式完成這個挑戰: +構建一個 JavaScript 全棧應用,在功能上與 https://personal-library.freecodecamp.rocks/ 類似。 可以採用下面的任意一種方式完成這個挑戰: -- Clone this GitHub repo and complete your project locally. -- Use our Replit starter project to complete your project. +- 克隆這個 GitHub 倉庫,並在本地完成你的項目。 +- 使用我們在 Replit 上的初始化項目來完成你的項目 - 使用一個你喜歡的站點生成器來完成項目。 需要確定包含了我們 GitHub 倉庫的所有文件。 完成本項目後,請將一個正常運行的 demo(項目演示)託管在可以公開訪問的平臺。 然後在 `Solution Link` 框中提交你的項目 URL。 此外,還可以將項目的源碼提交到 `GitHub Link` 中。 diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/sudoku-solver.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/sudoku-solver.md index 0f91eb2a6b4..fa55a2f96e8 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/sudoku-solver.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/sudoku-solver.md @@ -8,10 +8,10 @@ dashedName: sudoku-solver # --description-- -Build a full stack JavaScript app that is functionally similar to this: https://sudoku-solver.freecodecamp.rocks/. 可以採用下面的任意一種方式完成這個挑戰: +構建一個 JavaScript 全棧應用,在功能上與 https://sudoku-solver.freecodecamp.rocks/ 類似。 可以採用下面的任意一種方式完成這個挑戰: -- Clone this GitHub repo and complete your project locally. -- Use our Replit starter project to complete your project. +- 克隆這個 GitHub 倉庫,並在本地完成你的項目。 +- 使用我們在 Replit 上的初始化項目來完成你的項目。 - 使用一個你喜歡的站點生成器來完成項目。 需要確定包含了我們 GitHub 倉庫的所有文件。 完成本項目後,請將一個正常運行的 demo(項目演示)託管在可以公開訪問的平臺。 然後在 `Solution Link` 框中提交你的項目 URL。 此外,還可以將項目的源碼提交到 `GitHub Link` 中。 @@ -270,7 +270,7 @@ async (getUserInput) => { }; ``` -If the object submitted to `/api/check` is missing `puzzle`, `coordinate` or `value`, the returned value will be `{ error: 'Required field(s) missing' }` +如果提交給 `/api/check` 的對象缺失 `puzzle`、`coordinate` 或 `value`,那麼返回的值將是 `{ error: 'Required field(s) missing' }`。 ```js async (getUserInput) => { @@ -324,7 +324,7 @@ async (getUserInput) => { }; ``` -If the `value` submitted to `/api/check` is not a number between 1 and 9, the returned value will be `{ error: 'Invalid value' }` +如果提交給 `/api/check` 的 `value` 不是一個介於 1 到 9 之間的數字,則返回的值將是 `{ error: 'Invalid value' }`。 ```js async (getUserInput) => { @@ -371,7 +371,7 @@ async (getUserInput) => { }; ``` -所有 14 項功能測試都已完成並通過。 See `/tests/2_functional-tests.js` for the expected functionality you should write tests for. +所有 14 項功能測試都已完成並通過。 請參閱 `/tests/2_functional-tests.js` 來了解你應該編寫的測試的功能。 ```js async (getUserInput) => { diff --git a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/files-as-a-sequence.md b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/files-as-a-sequence.md index cdc943a7645..ea88070f2c5 100644 --- a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/files-as-a-sequence.md +++ b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/files-as-a-sequence.md @@ -14,7 +14,7 @@ dashedName: files-as-a-sequence 更多資源: -\- Exercise +\- 練習 # --question-- diff --git a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/intermediate-expressions.md b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/intermediate-expressions.md index 4e613551868..25f3a82de49 100644 --- a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/intermediate-expressions.md +++ b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/intermediate-expressions.md @@ -14,9 +14,9 @@ dashedName: intermediate-expressions 更多資源: -\- Exercise 1 +\- 練習 1 -\- Exercise 2 +\- 練習 2 # --question-- diff --git a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/introduction-why-program.md b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/introduction-why-program.md index 2d969304655..c1aeec96e77 100644 --- a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/introduction-why-program.md +++ b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/introduction-why-program.md @@ -18,9 +18,9 @@ dashedName: introduction-why-program 更多資源: -\- Install Python on Windows +\- 在 Windows 上安裝 Python -\- Install Python on MacOS +\- 在 MacOS 上安裝 Python # --question-- diff --git a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/iterations-more-patterns.md b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/iterations-more-patterns.md index 9ba8ebf3f61..8a123ae92a0 100644 --- a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/iterations-more-patterns.md +++ b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/iterations-more-patterns.md @@ -14,7 +14,7 @@ dashedName: iterations-more-patterns 更多資源: -\- Exercise +\- 練習 # --question-- diff --git a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/networking-web-scraping-with-python.md b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/networking-web-scraping-with-python.md index ee0b5294818..f80f9431397 100644 --- a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/networking-web-scraping-with-python.md +++ b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/python-for-everybody/networking-web-scraping-with-python.md @@ -14,11 +14,11 @@ dashedName: networking-web-scraping-with-python 更多資料: -\- Exercise: socket1 +\- 練習:socket1 -\- Exercise: urllib +\- 練習:urllib -\- Exercise: urllinks +\- 練習:urllinks # --question-- diff --git a/curriculum/challenges/chinese-traditional/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md b/curriculum/challenges/chinese-traditional/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md index 792d5d9a03d..66afc5ec62e 100644 --- a/curriculum/challenges/chinese-traditional/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md +++ b/curriculum/challenges/chinese-traditional/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md @@ -22,11 +22,11 @@ dashedName: page-view-time-series-visualizer 使用數據完成以下任務: -- 使用 Pandas 從 “fcc-forum-pageviews.csv” 導入數據。 Set the index to the `date` column. +- 使用 Pandas 從 “fcc-forum-pageviews.csv” 導入數據。 將索引設置爲 `date` 列。 - 通過過濾掉頁面瀏覽量位於數據集前 2.5% 或數據集後 2.5% 的日期來清理數據。 -- 創建一個 `draw_line_plot` 函數,該函數使用 Matplotlib 繪製類似於“examples/Figure_1.png”的折線圖。 The title should be `Daily freeCodeCamp Forum Page Views 5/2016-12/2019`. The label on the x axis should be `Date` and the label on the y axis should be `Page Views`. -- 創建一個 `draw_bar_plot` 函數,用於繪製類似於“examples/Figure_2.png”的條形圖。 它應該顯示按年份分組的每個月的平均每日頁面瀏覽量。 The legend should show month labels and have a title of `Months`. On the chart, the label on the x axis should be `Years` and the label on the y axis should be `Average Page Views`. -- 創建一個 `draw_box_plot` 函數,該函數使用 Seaborn 繪製兩個相鄰的箱形圖,類似於“examples/Figure_3.png”。 這些箱線圖應顯示值在給定年份或月份內的分佈情況以及隨時間推移的比較情況。 The title of the first chart should be `Year-wise Box Plot (Trend)` and the title of the second chart should be `Month-wise Box Plot (Seasonality)`. Make sure the month labels on bottom start at `Jan` and the x and y axis are labeled correctly. 樣板文件包括準備數據的命令。 +- 創建一個 `draw_line_plot` 函數,該函數使用 Matplotlib 繪製類似於“examples/Figure_1.png”的折線圖。 標題應爲 `Daily freeCodeCamp Forum Page Views 5/2016-12/2019`。 x 軸上的標籤應爲 `Date`,y 軸上的標籤應爲 `Page Views`。 +- 創建一個 `draw_bar_plot` 函數,用於繪製類似於“examples/Figure_2.png”的條形圖。 它應該顯示按年份分組的每個月的平均每日頁面瀏覽量。 圖例應顯示月份標籤並具有 `Months` 標題。 在圖表上,x 軸上的標籤應爲 `Years`,y 軸上的標籤應爲 `Average Page Views`。 +- 創建一個 `draw_box_plot` 函數,該函數使用 Seaborn 繪製兩個相鄰的箱形圖,類似於“examples/Figure_3.png”。 這些箱線圖應顯示值在給定年份或月份內的分佈情況以及隨時間推移的比較情況。 第一個圖表的標題應爲 `Year-wise Box Plot (Trend)`,第二個圖表的標題應爲 `Month-wise Box Plot (Seasonality)`。 確保底部的月份標籤從 `Jan` 開始,並且 x 和 y 軸標記正確。 樣板文件包括準備數據的命令。 對於每個圖表,請確保使用數據框的副本。 單元測試是在 `test_module.py` 下爲你編寫的。 diff --git a/curriculum/challenges/chinese-traditional/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md b/curriculum/challenges/chinese-traditional/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md index 376bc31d1c7..1f4ac9013d7 100644 --- a/curriculum/challenges/chinese-traditional/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md +++ b/curriculum/challenges/chinese-traditional/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md @@ -23,10 +23,10 @@ dashedName: sea-level-predictor 使用數據完成以下任務: - 使用 Pandas 從 `epa-sea-level.csv` 導入數據。 -- Use matplotlib to create a scatter plot using the `Year` column as the x-axis and the `CSIRO Adjusted Sea Level` column as the y-axix. +- 使用 matplotlib 創建散點圖,使用 `Year` 列作爲 x 軸,將 `CSIRO Adjusted Sea Level` 列作爲 y 軸。 - 使用 `scipy.stats` 中的 `linregress` 函數來獲得最佳擬合線的斜率和 y 截距。 在散點圖的頂部繪製最佳擬合線。 使線穿過 2050 年以預測 2050 年的海平面上升。 - 僅使用數據集中從 2000 年到最近一年的數據繪製一條新的最佳擬合線。 如果上升速度繼續與 2000 年一樣,則使該線也經過 2050 年以預測 2050 年的海平面上升。 -- The x label should be `Year`, the y label should be `Sea Level (inches)`, and the title should be `Rise in Sea Level`. +- x 標籤應爲 `Year`,y 標籤應爲 `Sea Level (inches)`,標題應爲 `Rise in Sea Level`。 單元測試是在 `test_module.py` 下爲你編寫的。 @@ -46,7 +46,7 @@ dashedName: sea-level-predictor ## 數據源 -Global Average Absolute Sea Level Change, 1880-2014 from the US Environmental Protection Agency using data from CSIRO, 2015; NOAA, 2015. +全球平均絕對海平面變化,1880 - 2014 年,來自美國環境保護局,數據來源:CSIRO, 2015; NOAA, 2015。 # --hints-- diff --git a/curriculum/challenges/chinese-traditional/10-coding-interview-prep/rosetta-code/state-name-puzzle.md b/curriculum/challenges/chinese-traditional/10-coding-interview-prep/rosetta-code/state-name-puzzle.md index 841319d1bda..6ae83d11ec1 100644 --- a/curriculum/challenges/chinese-traditional/10-coding-interview-prep/rosetta-code/state-name-puzzle.md +++ b/curriculum/challenges/chinese-traditional/10-coding-interview-prep/rosetta-code/state-name-puzzle.md @@ -15,7 +15,7 @@ dashedName: state-name-puzzle Write a function to solve the challenge for a given array of actual U.S. state names, and for fictional state names. -The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `"from"` array should contain the original names and the `"to"` array should contain the resultant names. +The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `from` array should contain the original names and the `to` array should contain the resultant names. # --hints-- diff --git a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md index 47d1dd2f49f..b0e78473488 100644 --- a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md +++ b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md @@ -8,29 +8,29 @@ dashedName: book-recommendation-engine-using-knn # --description-- -You will be working on this project with Google Colaboratory. +你將使用 Google Colaboratory 來完成這個項目。 -After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link." +進入該鏈接後,在你自己的賬戶或本地創建一個筆記本的副本。 一旦你完成項目並通過測試(包括在該鏈接),請在下面提交你的項目鏈接。 如果你提交的是 Google Colaboratory 的鏈接,請確保打開鏈接共享時選擇 “anyone with the link”。 -We are still developing the interactive instructional content for the machine learning curriculum. For now, you can go through the video challenges in this certification. You may also have to seek out additional learning resources, similar to what you would do when working on a real-world project. +我們仍在開發機器學習課程的交互式課程部分。 現在,你可以通過這個認證中的視頻挑戰。 你可能還需要尋找額外的學習資源,類似於你在真實世界項目中的工作。 # --instructions-- -In this challenge, you will create a book recommendation algorithm using **K-Nearest Neighbors**. +在這個挑戰中,你將使用 **K-Nearest Neighbors** 創建一個圖書推薦算法。 -You will use the Book-Crossings dataset. This dataset contains 1.1 million ratings (scale of 1-10) of 270,000 books by 90,000 users. +你將使用 Book-Crossings 數據集。 該數據集包括 90,000 名用戶對 270,000 冊書籍的 110 萬份評分(評分從 1 至 10)。 -After importing and cleaning the data, use `NearestNeighbors` from `sklearn.neighbors` to develop a model that shows books that are similar to a given book. The Nearest Neighbors algorithm measures the distance to determine the “closeness” of instances. +導入並清理數據後,使用 `sklearn.neighbors` 中的 `NearestNeighbors` 開發一個模型,顯示與給定書籍相似的書籍。 最近鄰算法測量距離以確定實例的“接近度”。 -Create a function named `get_recommends` that takes a book title (from the dataset) as an argument and returns a list of 5 similar books with their distances from the book argument. +創建一個名爲 `get_recommends` 的函數,它將書名(來自數據集)作爲參數,並返回 5 本書的列表以及它們與書參數的距離。 -This code: +這個代碼: ```py get_recommends("The Queen of the Damned (Vampire Chronicles (Paperback))") ``` -should return: +應該返回: ```py [ @@ -45,15 +45,15 @@ should return: ] ``` -Notice that the data returned from `get_recommends()` is a list. The first element in the list is the book title passed into the function. The second element in the list is a list of five more lists. Each of the five lists contains a recommended book and the distance from the recommended book to the book passed into the function. +請注意,從 `get_recommends()` 返回的數據是一個列表。 列表中的第一個元素是傳遞給函數的書名。 列表中的第二個元素是另外五個列表的列表。 五個列表中的每一個都包含一本推薦書以及從推薦書到傳遞給函數的書的距離。 -If you graph the dataset (optional), you will notice that most books are not rated frequently. To ensure statistical significance, remove from the dataset users with less than 200 ratings and books with less than 100 ratings. +如果你繪製數據集的圖表(可選),你會注意到大多數書籍的評價並不頻繁。 爲了確保統計學上的顯著性,從數據集中刪除評分低於 200 的用戶和評分低於 100 的書籍。 -The first three cells import libraries you may need and the data to use. The final cell is for testing. Write all your code in between those cells. +前三個單元格導入你可能需要的庫和要使用的數據。 最後一個單元用於測試。 在這些單元格之間寫下所有代碼。 # --hints-- -It should pass all Python tests. +它應該通過所有的 Python 測試。 ```js diff --git a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md index 3da6ded87e9..cdf916647f6 100644 --- a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md +++ b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md @@ -8,21 +8,21 @@ dashedName: cat-and-dog-image-classifier # --description-- -You will be working on this project with Google Colaboratory. +你將使用 Google Colaboratory 來完成這個項目。 -After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link." +進入該鏈接後,在你自己的賬戶或本地創建一個筆記本的副本。 一旦你完成項目並通過測試(包括在該鏈接),請在下面提交你的項目鏈接。 如果你提交的是 Google Colaboratory 的鏈接,請確保打開鏈接共享時選擇 “anyone with the link”。 -We are still developing the interactive instructional content for the machine learning curriculum. For now, you can go through the video challenges in this certification. You may also have to seek out additional learning resources, similar to what you would do when working on a real-world project. +我們仍在開發機器學習課程的交互式課程部分。 現在,你可以通過這個認證中的視頻挑戰。 你可能還需要尋找額外的學習資源,類似於你在真實世界項目中的工作。 # --instructions-- -For this challenge, you will complete the code to classify images of dogs and cats. You will use TensorFlow 2.0 and Keras to create a convolutional neural network that correctly classifies images of cats and dogs at least 63% of the time. (Extra credit if you get it to 70% accuracy!) +在這個挑戰中,你將完成代碼,對狗和貓的圖像進行分類。 你將使用 Tensorflow 2.0 和 Keras 創建一個卷積神經網絡,該網絡至少 63% 的時間可以正確分類貓和狗的圖像。 (如果你能達到 70% 的準確率,可以加分!) -Some of the code is given to you but some code you must fill in to complete this challenge. Read the instruction in each text cell so you will know what you have to do in each code cell. +有些代碼是給你的,但有些代碼你必須填寫才能完成這個挑戰。 閱讀每個文本單元中的指令,你就會知道你在每個代碼單元中要做什麼。 -The first code cell imports the required libraries. The second code cell downloads the data and sets key variables. The third cell is the first place you will write your own code. +第一個代碼單元導入所需的庫。 第二個代碼單元下載數據並設置關鍵變量。 第三個單元格是你要寫自己代碼的第一個地方。 -The structure of the dataset files that are downloaded looks like this (You will notice that the test directory has no subdirectories and the images are not labeled): +下載的數據集文件的結構看起來是這樣的(你會注意到,測試目錄沒有子目錄,圖像也沒有標示)。 ```py cats_and_dogs @@ -35,20 +35,20 @@ cats_and_dogs |__ test: [1.jpg, 2.jpg ...] ``` -You can tweak epochs and batch size if you like, but it is not required. +如果你願意,你可以調整歷時和批次大小,但這不是必須的。 -The following instructions correspond to specific cell numbers, indicated with a comment at the top of the cell (such as `# 3`). +下面的指令對應於特定的單元格編號,在單元格的頂部用註釋表示(如 `# 3`)。 ## Cell 3 -Now it is your turn! Set each of the variables in this cell correctly. (They should no longer equal `None`.) +現在輪到你了! 正確設置此單元格中的每個變量。 (它們不應再等於 `None`。) -Create image generators for each of the three image data sets (train, validation, test). Use `ImageDataGenerator` to read / decode the images and convert them into floating point tensors. Use the `rescale` argument (and no other arguments for now) to rescale the tensors from values between 0 and 255 to values between 0 and 1. +爲三個圖像數據集(訓練、驗證、測試)中的每一個創建圖像生成器。 使用 `ImageDataGenerator` 讀取/解碼圖像並將它們轉換爲浮點張量。 使用 `rescale` 參數(目前沒有其他參數)將張量從 0 到 255 之間的值重新縮放到 0 到 1 之間的值。 -For the `*_data_gen` variables, use the `flow_from_directory` method. Pass in the batch size, directory, target size (`(IMG_HEIGHT, IMG_WIDTH)`), class mode, and anything else required. `test_data_gen` will be the trickiest one. For `test_data_gen`, make sure to pass in `shuffle=False` to the `flow_from_directory` method. This will make sure the final predictions stay is in the order that our test expects. For `test_data_gen` it will also be helpful to observe the directory structure. +對於 `*_data_gen` 變量,使用 `flow_from_directory` 方法。 傳入批處理大小、目錄、目標大小(`(IMG_HEIGHT, IMG_WIDTH)`)、類模式以及其他所需的內容。 `test_data_gen` 將是最棘手的一個。 對於 `test_data_gen`,確保將 `shuffle=False` 傳遞給 `flow_from_directory` 方法。 這將確保最終預測保持在我們的測試預期的順序。 對於 `test_data_gen`,觀察目錄結構也很有幫助。 -After you run the code, the output should look like this: +運行代碼後,輸出應如下所示: ```py Found 2000 images belonging to 2 classes. @@ -58,51 +58,51 @@ Found 50 images belonging to 1 class. ## Cell 4 -The `plotImages` function will be used a few times to plot images. It takes an array of images and a probabilities list, although the probabilities list is optional. This code is given to you. If you created the `train_data_gen` variable correctly, then running this cell will plot five random training images. +`plotImages` 函數將多次用於繪製圖像。 它需要一個圖像數組和一個概率列表,儘管概率列表是可選的。 此代碼已提供給你。 如果你正確地創建了 `train_data_gen` 變量,那麼運行這個單元將繪製五個隨機訓練圖像。 ## Cell 5 -Recreate the `train_image_generator` using `ImageDataGenerator`. +使用 `ImageDataGenerator` 重新創建 `train_image_generator`。 -Since there are a small number of training examples, there is a risk of overfitting. One way to fix this problem is by creating more training data from existing training examples by using random transformations. +由於訓練樣本數量很少,因此存在過度擬合的風險。 解決此問題的一種方法,是通過使用隨機變換,從現有訓練示例創建更多訓練數據。 -Add 4-6 random transformations as arguments to `ImageDataGenerator`. Make sure to rescale the same as before. +添加 4-6 個隨機變換作爲 `ImageDataGenerator` 的參數。 確保重新縮放與以前相同。 ## Cell 6 -You don't have to do anything for this cell. `train_data_gen` is created just like before but with the new `train_image_generator`. Then, a single image is plotted five different times using different variations. +你無需爲此單元做任何事情。 `train_data_gen` 與以前一樣創建,但使用新的 `train_image_generator`。 然後,使用不同的變化對單個圖像進行五次不同的繪製。 ## Cell 7 -In this cell, create a model for the neural network that outputs class probabilities. It should use the Keras Sequential model. It will probably involve a stack of Conv2D and MaxPooling2D layers and then a fully connected layer on top that is activated by a ReLU activation function. +在此單元格中,爲輸出類別概率的神經網絡創建一個模型。 它應該使用 Keras Sequential 模型。 它可能會涉及一堆 Conv2D 和 MaxPooling2D 層,然後是一個由 ReLU 激活函數激活的全連接層。 -Compile the model passing the arguments to set the optimizer and loss. Also pass in `metrics=['accuracy']` to view training and validation accuracy for each training epoch. +編譯模型並傳遞參數以設置優化器和損失。 同時傳入 `metrics=['accuracy']` 以查看每個訓練週期的訓練和驗證精度。 ## Cell 8 -Use the `fit` method on your `model` to train the network. Make sure to pass in arguments for `x`, `steps_per_epoch`, `epochs`, `validation_data`, and `validation_steps`. +使用 `model` 上的 `fit` 方法來訓練網絡。 確保爲 `x`、`steps_per_epoch`、`epochs`、`validation_data` 和 `validation_steps` 傳入參數。 ## Cell 9 -Run this cell to visualize the accuracy and loss of the model. +運行這個單元來觀察模型的準確性和損失。 ## Cell 10 -Now it is time to use your model to predict whether a brand new image is a cat or a dog. +現在是時候使用你的模型,來預測一個全新的圖像,是貓還是狗了。 -In this cell, get the probability that each test image (from `test_data_gen`) is a dog or a cat. `probabilities` should be a list of integers. +在此單元格中,獲取每個測試圖像(來自 `test_data_gen`)是狗或貓的概率。 `probabilities` 應該是一個整數列表。 -Call the `plotImages` function and pass in the test images and the probabilities corresponding to each test image. +調用 `plotImages` 函數並傳入測試圖像和每個測試圖像對應的概率。 -After you run the cell, you should see all 50 test images with a label showing the percentage of "sure" that the image is a cat or a dog. The accuracy will correspond to the accuracy shown in the graph above (after running the previous cell). More training images could lead to a higher accuracy. +在你運行該單元后,你應該看到所有 50 張測試圖像,並有一個標籤顯示該圖像是貓還是狗的“確定”百分比。 準確度將對應於上圖中顯示的準確度(在運行上一個單元格之後)。 更多的訓練圖像可能會導致更高的準確性。 ## Cell 11 -Run this final cell to see if you passed the challenge or if you need to keep trying. +運行這個最後的單元格,看看你是否通過了挑戰,或者你是否需要繼續努力。 # --hints-- -It should pass all Python tests. +它應該通過所有的 Python 測試。 ```js diff --git a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md index 5aa9a9e6541..af3dd4a1489 100644 --- a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md +++ b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md @@ -8,33 +8,33 @@ dashedName: linear-regression-health-costs-calculator # --description-- -You will be working on this project with Google Colaboratory. +你將使用 Google Colaboratory 來完成這個項目。 -After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link." +進入該鏈接後,在你自己的賬戶或本地創建一個筆記本的副本。 一旦你完成項目並通過測試(包括在該鏈接),請在下面提交你的項目鏈接。 如果你提交的是 Google Colaboratory 的鏈接,請確保打開鏈接共享時選擇 “anyone with the link”。 -We are still developing the interactive instructional content for the machine learning curriculum. For now, you can go through the video challenges in this certification. You may also have to seek out additional learning resources, similar to what you would do when working on a real-world project. +我們仍在開發機器學習課程的交互式課程部分。 現在,你可以通過這個認證中的視頻挑戰。 你可能還需要尋找額外的學習資源,類似於你在真實世界項目中的工作。 # --instructions-- -In this challenge, you will predict healthcare costs using a regression algorithm. +在這個挑戰中,你將使用迴歸算法預測醫療費用。 -You are given a dataset that contains information about different people including their healthcare costs. Use the data to predict healthcare costs based on new data. +你會得到一個數據集,其中包含不同人的信息,包括他們的醫療費用。 用數據來預測基於新數據的醫療費用。 -The first two cells of this notebook import libraries and the data. +此筆記本的前兩個單元格導入庫和數據。 -Make sure to convert categorical data to numbers. Use 80% of the data as the `train_dataset` and 20% of the data as the `test_dataset`. +確保將分類數據轉換爲數字。 將 80% 的數據用作 `train_dataset`,將 20% 的數據用作 `test_dataset`。 -`pop` off the "expenses" column from these datasets to create new datasets called `train_labels` and `test_labels`. Use these labels when training your model. +使用 `pop` 從這些數據集中移出“費用”列中,來創建名爲 `train_labels` 和 `test_labels` 的新數據集。 訓練模型時使用這些標籤。 -Create a model and train it with the `train_dataset`. Run the final cell in this notebook to check your model. The final cell will use the unseen `test_dataset` to check how well the model generalizes. +創建一個模型並使用 `train_dataset` 對其進行訓練。 運行本筆記本中的最後一個單元來檢查你的模型。 最後一個單元格將使用看不見的 `test_dataset` 來檢查模型的泛化程度。 -To pass the challenge, `model.evaluate` must return a Mean Absolute Error of under 3500. This means it predicts health care costs correctly within $3500. +要通過挑戰,`model.evaluate` 必須返回低於 3500 的平均絕對誤差。 這意味着它可以正確地預測醫療保健費用在 3500 美元以內。 -The final cell will also predict expenses using the `test_dataset` and graph the results. +最後一個單元格還將使用 `test_dataset` 預測費用並繪製結果圖。 # --hints-- -It should pass all Python tests. +它應該通過所有 Python 測試。 ```js diff --git a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md index 5ef1f324d1e..8c721df5a94 100644 --- a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md +++ b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md @@ -8,25 +8,25 @@ dashedName: neural-network-sms-text-classifier # --description-- -You will be working on this project with Google Colaboratory. +你將使用 Google Colaboratory 來完成這個項目。 -After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link." +進入該鏈接後,在你自己的賬戶或本地創建一個筆記本的副本。 一旦你完成項目並通過測試(包括在該鏈接),請在下面提交你的項目鏈接。 如果你提交的是 Google Colaboratory 的鏈接,請確保打開鏈接共享時選擇 “anyone with the link”。 -We are still developing the interactive instructional content for the machine learning curriculum. For now, you can go through the video challenges in this certification. You may also have to seek out additional learning resources, similar to what you would do when working on a real-world project. +我們仍在開發機器學習課程的交互式課程部分。 現在,你可以通過這個認證中的視頻挑戰。 你可能還需要尋找額外的學習資源,類似於你在真實世界項目中的工作。 # --instructions-- -In this challenge, you need to create a machine learning model that will classify SMS messages as either "ham" or "spam". A "ham" message is a normal message sent by a friend. A "spam" message is an advertisement or a message sent by a company. +在這個挑戰中,你需要創建一個機器學習模型,將短信分類爲 “ham” 或 “spam”。 “ham” 消息是朋友發送的正常消息。 “spam” 是一個公司發送的廣告或信息。 -You should create a function called `predict_message` that takes a message string as an argument and returns a list. The first element in the list should be a number between zero and one that indicates the likeliness of "ham" (0) or "spam" (1). The second element in the list should be the word "ham" or "spam", depending on which is most likely. +你應該創建一個名爲 `predict_message` 的函數,該函數接收一個消息字符串作爲參數並返回一個列表。 列表中的第一個元素應該是一個介於 0 和 1 之間的數字,表示 “ham”(0)或 “spam”(1)的可能性。 列表中的第二個元素應該是單詞 “ham” 或 “spam”,這取決於哪個最有可能。 -For this challenge, you will use the SMS Spam Collection dataset. The dataset has already been grouped into train data and test data. +對於這個挑戰,你將使用 SMS Spam Collection 數據集。 數據集已經被分組爲訓練數據和測試數據。 -The first two cells import the libraries and data. The final cell tests your model and function. Add your code in between these cells. +前兩個單元導入庫和數據。 最後一個單元測試你的模型和功能。 在這些單元格之間添加你的代碼。 # --hints-- -It should pass all Python tests. +它應該通過所有的 Python 測試。 ```js diff --git a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md index 90e2acc3fca..d6a3e83b3b4 100644 --- a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md +++ b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md @@ -8,57 +8,57 @@ dashedName: rock-paper-scissors # --description-- -For this challenge, you will create a program to play Rock, Paper, Scissors. A program that picks at random will usually win 50% of the time. To pass this challenge your program must play matches against four different bots, winning at least 60% of the games in each match. +在這個挑戰中,你將創建一個程序來玩石頭、剪刀、布。 一個隨機選取的程序通常會有 50% 的時間獲勝。 要通過這一挑戰,你的程序必須與四個不同的機器人進行對戰,並達到至少 60% 勝率。 -You will be working on this project with our Replit starter code. +你將使用我們在 Replit 的初始化項目來完成這個項目。 -We are still developing the interactive instructional part of the machine learning curriculum. For now, you will have to use other resources to learn how to pass this challenge. +我們仍在開發機器學習課程的交互式課程部分。 現在,你需要使用其他資源來學習如何通過這一挑戰。 # --instructions-- -In the file `RPS.py` you are provided with a function called `player`. The function takes an argument that is a string describing the last move of the opponent ("R", "P", or "S"). The function should return a string representing the next move for it to play ("R", "P", or "S"). +在文件 `RPS.py` 中,你會看到一個名爲 `player` 的函數。 該函數接受一個參數,該參數是一個字符串,描述了對手的最後一步(“R”、“P” 或 “S”)。 該函數應返回一個字符串,表示它要播放的下一步動作(“R”、“P”或“S”)。 -A player function will receive an empty string as an argument for the first game in a match since there is no previous play. +玩家函數將接收一個空字符串作爲比賽中第一場比賽的參數,因爲之前沒有比賽。 -The file `RPS.py` shows an example function that you will need to update. The example function is defined with two arguments (`player(prev_play, opponent_history = [])`). The function is never called with a second argument so that one is completely optional. The reason why the example function contains a second argument (`opponent_history = []`) is because that is the only way to save state between consecutive calls of the `player` function. You only need the `opponent_history` argument if you want to keep track of the opponent_history. +文件 `RPS.py` 顯示了一個你需要更新的示例函數。 示例函數使用兩個參數定義(`player(prev_play, opponent_history = [])`)。 該函數從不使用第二個參數調用,因此它是完全可選的。 示例函數包含第二個參數(`opponent_history = []`)的原因,是因爲這是在連續調用 `player` 函數之間保存狀態的唯一方法。 如果你想跟蹤對手歷史,你只需要 `opponent_history` 參數。 -*Hint: To defeat all four opponents, your program may need to have multiple strategies that change depending on the plays of the opponent.* +*提示:爲了打敗所有四個對手,你的程序可能需要有多種策略,這些策略會根據對手的棋局而改變。* -## Development +## 開發 -Do not modify `RPS_game.py`. Write all your code in `RPS.py`. For development, you can use `main.py` to test your code. +不要修改 `RPS_game.py`。 在 `RPS.py` 中編寫所有代碼。 對於開發,你可以使用 `main.py` 來測試你的代碼。 -`main.py` imports the game function and bots from `RPS_game.py`. +`main.py` 從 `RPS_game.py` 導入遊戲功能和機器人。 -To test your code, play a game with the `play` function. The `play` function takes four arguments: +要測試你的代碼,請使用 `play` 函數玩遊戲。 `play` 函數有四個參數: -- two players to play against each other (the players are actually functions) -- the number of games to play in the match -- an optional argument to see a log of each game. Set it to `True` to see these messages. +- 兩個玩家互相對戰(玩家實際上是函數) +- 比賽的比賽場數 +- 一個可選參數來查看每場比賽的日誌。 將其設置爲 `True` 以查看這些消息。 ```py play(player1, player2, num_games[, verbose]) ``` -For example, here is how you would call the function if you want `player` and `quincy` to play 1000 games against each other and you want to see the results of each game: +例如,如果你希望 `player` 和 `quincy` 互相對戰 1000 場比賽,並且你想查看每場比賽的結果,你將這樣調用該函數: ```py play(player, quincy, 1000, verbose=True) ``` -Click the "run" button and `main.py` will run. +單擊“運行”按鈕,`main.py` 將運行。 -## Testing +## 測試 -The unit tests for this project are in `test_module.py`. We imported the tests from `test_module.py` to `main.py` for your convenience. If you uncomment the last line in `main.py`, the tests will run automatically whenever you hit the "run" button. +這個項目的單元測試在 `test_module.py` 中。 爲了你的方便,我們將測試從 `test_module.py` 導入到 `main.py`。 如果你移除 `main.py` 中最後一行的註釋,則只要你點擊“運行”按鈕,測試就會自動運行。 -## Submitting +## 提交 -Copy your project's URL and submit it below. +複製項目的 URL 並在下面提交。 # --hints-- -It should pass all Python tests. +它應該通過所有的 Python 測試。 ```js diff --git a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/tensorflow/neural-networks-activation-functions.md b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/tensorflow/neural-networks-activation-functions.md index ada0426d6f0..aba5fcfb85c 100644 --- a/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/tensorflow/neural-networks-activation-functions.md +++ b/curriculum/challenges/chinese-traditional/11-machine-learning-with-python/tensorflow/neural-networks-activation-functions.md @@ -14,7 +14,7 @@ dashedName: neural-networks-activation-functions ## --text-- -Which activation function squishes values between -1 and 1? +哪個激活函數將值轉換爲在 -1 和 1 之間? ## --answers-- diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md index 1021e47fd1b..679810e89a5 100644 --- a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md @@ -7,7 +7,7 @@ dashedName: step-5 # --description-- -在 `.header` 元素下面,創建一個 `class` 設置爲 `"gallery"` 的 `div` 元素。 這個 `div` 將作爲相冊的容器。 +Below your `.header` element, create a new `div` element and assign it a `class` of `gallery`. 這個 `div` 將作爲相冊的容器。 在該 `.gallery` 元素中,創建九個 `img` 元素。 diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md index aa044de71f3..ee088d679f6 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md @@ -17,7 +17,7 @@ You should use compound assignment to add the string `Right! You win 20 gold!` t assert.match(pick.toString(), /text\.innerText\s*\+=\s*('|")Right! You win 20 gold!\1/); ``` -You should use compound assignment add `20` to the value of `gold`. +You should use compound assignment to add `20` to the value of `gold`. ```js assert.match(pick.toString(), /gold\s*\+=\s*20/); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md index 36cc5774e0e..622cea1ad3f 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md @@ -11,12 +11,12 @@ dashedName: escape-sequences-in-strings 引号不是字符串中唯一可以被转义(escaped)的字符。 使用转义字符有两个原因: -1. To allow you to use characters you may not otherwise be able to type out, such as a newline. +1. 首先是可以让你使用无法输入的字符,例如换行。 2. 其次是可以让你在一个字符串中表示多个引号,而不会出错。 我们在之前的挑战中学到了这个。 -
代码输出
\'单引号
\"双引号
\\反斜杠
\n换行符
\ttab
\rcarriage return
\b退格
\f换页符
+
代码输出
\'单引号
\"双引号
\\反斜杠
\n换行符
\t制表符
\r回车
\b退格
\f换页符
*请注意,必须对反斜杠本身进行转义,它才能显示为反斜杠。* diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 8a371bcbbee..4fed5dcabaa 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -71,7 +71,7 @@ assert( ); ``` -Global variables should not be used to cache the array. +不应使用全局变量来缓存数组。 ```js countdown(1) diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index ea22941ae38..fb77b355997 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -56,7 +56,7 @@ assert.deepStrictEqual(rangeOfNumbers(6, 9), [6, 7, 8, 9]); assert.deepStrictEqual(rangeOfNumbers(4, 4), [4]); ``` -Global variables should not be used to cache the array. +不应使用全局变量来缓存数组。 ```js rangeOfNumbers(1, 3) diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index 640e4bfb6f7..a1809d47a21 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -12,9 +12,9 @@ ES6 提供了一个新的创建对象的语法,使用关键字 classhttps://25--5-clock.freecodecamp.rocks. +**目标:** 构建一个应用,功能和 https://25--5-clock.freecodecamp.rocks 类似。 完成以下需求,并且通过所有测试。 可以使用你需要的任何库或 API。 赋予它你自己的个人风格。 diff --git a/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-drum-machine.md b/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-drum-machine.md index 710aa5c3b2f..5464dead53f 100644 --- a/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-drum-machine.md +++ b/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-drum-machine.md @@ -8,7 +8,7 @@ dashedName: build-a-drum-machine # --description-- -**Objective:** Build an app that is functionally similar to this: https://drum-machine.freecodecamp.rocks/. +**目标:** 构建一个应用,功能和 https://drum-machine.freecodecamp.rocks/ 类似。 完成以下需求,并且通过所有测试。 可以使用你需要的任何库或 API。 赋予它你自己的个人风格。 diff --git a/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-javascript-calculator.md b/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-javascript-calculator.md index fa672c96114..6a1b7a71f0a 100644 --- a/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-javascript-calculator.md +++ b/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-javascript-calculator.md @@ -8,7 +8,7 @@ dashedName: build-a-javascript-calculator # --description-- -**Objective:** Build an app that is functionally similar to this: https://javascript-calculator.freecodecamp.rocks/. +**目标:** 构建一个应用,功能和 https://javascript-calculator.freecodecamp.rocks/ 类似。 完成以下需求,并且通过所有测试。 可以使用你需要的任何库或 API。 赋予它你自己的个人风格。 diff --git a/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md b/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md index 2f1caf79892..bd14696f435 100644 --- a/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md +++ b/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md @@ -8,7 +8,7 @@ dashedName: build-a-markdown-previewer # --description-- -**Objective:** Build an app that is functionally similar to this: https://markdown-previewer.freecodecamp.rocks/. +**目标:** 构建一个应用,功能和 https://markdown-previewer.freecodecamp.rocks/ 类似。 完成以下需求,并且通过所有测试。 可以使用你需要的任何库或 API。 赋予它你自己的个人风格。 diff --git a/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-random-quote-machine.md b/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-random-quote-machine.md index a456f1d5ee6..05b0de4c82e 100644 --- a/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-random-quote-machine.md +++ b/curriculum/challenges/chinese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-random-quote-machine.md @@ -8,7 +8,7 @@ dashedName: build-a-random-quote-machine # --description-- -**Objective:** Build an app that is functionally similar to this: https://random-quote-machine.freecodecamp.rocks/. +**目标:** 构建一个应用,功能和 https://random-quote-machine.freecodecamp.rocks/ 类似。 完成以下需求,并且通过所有测试。 可以使用你需要的任何库或 API。 赋予它你自己的个人风格。 diff --git a/curriculum/challenges/chinese/03-front-end-development-libraries/jquery/learn-how-script-tags-and-document-ready-work.md b/curriculum/challenges/chinese/03-front-end-development-libraries/jquery/learn-how-script-tags-and-document-ready-work.md index 5bd46fc7b98..549e8798164 100644 --- a/curriculum/challenges/chinese/03-front-end-development-libraries/jquery/learn-how-script-tags-and-document-ready-work.md +++ b/curriculum/challenges/chinese/03-front-end-development-libraries/jquery/learn-how-script-tags-and-document-ready-work.md @@ -18,7 +18,7 @@ dashedName: learn-how-script-tags-and-document-ready-work 在 `script` 标签中添加代码 `$(document).ready(function() {`。 然后在后面(仍在该 `script` 标签内)用 `});` 闭合它。 -稍后将详细介绍 `functions`, 现在需要知道的是,只要浏览器加载页面,`function` 中放入的代码就会运行。 +稍后将详细介绍 `functions`, 重要的是要知道,在浏览器加载页面后,你放入此 `function` 的代码将立即运行。 有一点很重要,如果没有 `document ready function`,代码将在 HTML 页面呈现之前运行,这可能会导致错误。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/authentication-strategies.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/authentication-strategies.md index aa0fc4a3561..57a0431931c 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/authentication-strategies.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/authentication-strategies.md @@ -10,7 +10,7 @@ dashedName: authentication-strategies 策略是认证用户的一种方式。 如果你让用户在注册时填写了用户信息,那你就可以基于这些信息进行验证。或者也可以引入第三方登录,如 Google 或者 Github。 在这个项目中,我们将使用 Passport 中间件。 Passport 提供了一套全面的策略,支持使用用户名和密码、GitHub、谷歌等进行认证。 -`passport-local@~1.0.0` has already been added as a dependency, so add it to your server as follows: `const LocalStrategy = require('passport-local');` +已经引入 `passport-local@~1.0.0` 作为依赖,将它添加到服务器,就像这样:`const LocalStrategy = require('passport-local');` 然后,需要让 passport **使用**一个实例化的 LocalStrategy 对象,这个对象的一些设置已完成。 请注意,接下来的所有代码都应写在连接数据库的回调中,因为它们的执行都依赖数据库。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md index 032947e62c6..c2cbbd77af1 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/authentication-with-socket.io.md @@ -10,7 +10,7 @@ dashedName: authentication-with-socket-io 目前,你还无法确定连接到服务器的用户身份。 虽然 `req.user` 包含用户信息,但这个只在用户直接与服务器交互时产生。当用户通过 web socket 与服务器连接时,由于不存在 `req` 对象,我们就无法获取用户数据。 解决这个问题的方法之一是通过读取和解析请求中包含 passport session 的 cookie,然后反序列化,进而获取用户信息对象。 幸运的是,NPM 上有可以让这个复杂的流程简单化的库。 -`passport.socketio@~3.7.0`, `connect-mongo@~3.2.0`, and `cookie-parser@~1.4.5` have already been added as dependencies. Require them as `passportSocketIo`, `MongoStore`, and `cookieParser` respectively. Also, we need to initialize a new memory store, from `express-session` which we previously required. It should look like this: +`passport.socketio@~3.7.0`、`connect-mongo@~3.2.0` 和 `cookie-parser@~1.4.5` 已经被添加为依赖项。 分别请求它们为 `passportSocketIo`、`MongoStore` 和 `cookieParser`。 同时,我们需要从之前引入的 `express-session` 中初始化新的内存。 就像这样: ```js const MongoStore = require('connect-mongo')(session); @@ -65,7 +65,7 @@ console.log('user ' + socket.request.user.name + ' connected'); 它将在服务器控制台记录已连接的用户! -完成以上要求后,请提交你的页面链接。 If you're running into errors, you can check out the project up to this point https://gist.github.com/camperbot/1414cc9433044e306dd7fd0caa1c6254. +完成以上要求后,请提交你的页面链接。 如果你遇到了问题,可以参考 https://gist.github.com/camperbot/1414cc9433044e306dd7fd0caa1c6254。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md index ad639024ee8..3992e1c064f 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/clean-up-your-project-with-modules.md @@ -26,7 +26,7 @@ module.exports = function (app, myDataBase) { 现在,我们来把 server.js 中与验证相关的代码分离到 auth.js 中,例如序列化,设置验证策略等。 请正确添加依赖,并在 server.js 中调用 `auth(app, myDataBase)`。 -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out an example of the completed project. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md index ca061b69ced..214ea33fd4c 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/communicate-by-emitting.md @@ -38,7 +38,7 @@ socket.on('user count', function(data) { 现在你可以尝试启动你的 app 并登录,你会看到在客户端的控制台打印出了 “1”,这就表示目前连接到服务器的用户数为 1。 你可以试着通过打开多个 app 来验证数量是否会增加。 -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/create-new-middleware.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/create-new-middleware.md index 0e06e93dc44..851ea25e6c5 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/create-new-middleware.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/create-new-middleware.md @@ -31,7 +31,7 @@ app }); ``` -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md index 76dfac1a880..e858c0c9ddd 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/handle-a-disconnect.md @@ -22,7 +22,7 @@ socket.on('disconnect', () => { **注意:**和 `'disconnect'` 类似,所有 socket 可以发送到服务器的事件,我们都应该在有 “socket” 定义的连接监听器里处理。 -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md index 0886a14522a..ec2c5d406bc 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/hashing-your-passwords.md @@ -10,7 +10,7 @@ dashedName: hashing-your-passwords 回过头来看信息安全,你也许记得在数据库中存储明文密码是*绝对*禁止的。 现在,我们需要引入 BCrypt 来解决这个问题。 -`bcrypt@~5.0.0` has already been added as a dependency, so require it in your server. 你需要在两个步骤中使用哈希运算:注册和保存新账户,以及登录时检查密码是否正确。 +`bcrypt@~5.0.0` 已被添加为依赖项,在你的服务器中请求它。 你需要在两个步骤中使用哈希运算:注册和保存新账户,以及登录时检查密码是否正确。 目前处理注册的路由中,我们是这样把密码添加到数据库的:`password: req.body.password`。 保存哈希值的一个简单方式是在数据库逻辑中添加 `const hash = bcrypt.hashSync(req.body.password, 12);`,然后把 `req.body.password` 替换为 `password: hash`。 @@ -24,7 +24,7 @@ if (!bcrypt.compareSync(password, user.password)) { 当你需要存储密码时,这样做可以有效地提升网站的安全性。 -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md index c583e6aedcd..0065a458a82 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.md @@ -24,7 +24,7 @@ h2.center#welcome Welcome, #{username}! a(href='/logout') Logout ``` -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md index 5f657da8fc6..f38e008ed2a 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/how-to-use-passport-strategies.md @@ -18,7 +18,7 @@ dashedName: how-to-use-passport-strategies 这时,由于我们还没有实现注册功能,如果你在表单里输入了用户名和密码,路由将会重定向到主页 `/`,在服务端将会打印 `'User {USERNAME} attempted to log in.'`。 -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implement-the-serialization-of-a-passport-user.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implement-the-serialization-of-a-passport-user.md index 016d5067491..c1e46c85253 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implement-the-serialization-of-a-passport-user.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implement-the-serialization-of-a-passport-user.md @@ -10,7 +10,7 @@ dashedName: implement-the-serialization-of-a-passport-user 截至目前,我们还没有配置完数据库,因此还无法加载用户数据。 实现这个的方式很多,但对于我们的项目,一旦服务器启动,那么只要有 app 实例在运行,数据库就应一直处于连接状态。 为此,你需要在环境变量 `MONGO_URI` 中添加你的数据库地址(比如:`mongodb+srv://:@cluster0-jvwxi.mongodb.net/?retryWrites=true&w=majority`)。 我们会在 `connection.js` 文件中调用它。 -*If you are having issues setting up a free database on MongoDB Atlas, check out tutorial.* +*如果你在 MongoDB Atlas 设置免费数据库时遇到问题,请查看教程。* 现在我们想要连接到数据库,然后开始监听请求。 这样做的目的是在连接数据库之前或者出现数据库错误时,不接收任何请求。 要实现这一点,你需要在以下代码中包含序列化和应用的路由: @@ -40,7 +40,7 @@ myDB(async client => { 记得要取消 `deserializeUser` 中 `myDataBase` 的注释,并把 `doc` 添加到 `done(null, null)`。 -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md index e54d5d0a435..8b7b21cefbb 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-ii.md @@ -8,13 +8,13 @@ dashedName: implementation-of-social-authentication-ii # --description-- -设置 GitHub 验证的最后一步是创建策略本身。 `passport-github@~1.1.0` has already been added as a dependency, so require it in your `auth.js` file as `GithubStrategy` like this: `const GitHubStrategy = require('passport-github').Strategy;`. 别忘了请求和配置 `dotenv`,使用你的环境变量。 +设置 GitHub 验证的最后一步是创建策略本身。 已经添加 `passport-github@~1.1.0` 作为依赖,在 `auth.js` 中请求它,作为 `GithubStrategy`,像这样:`const GitHubStrategy = require('passport-github').Strategy;`。 别忘了请求和配置 `dotenv`,使用你的环境变量。 为了设置 GitHub 策略,我们需要在 Passport 中使用实例化的 `GitHubStrategy`,它可以接收两个参数:一个对象(包括 `clientID`、`clientSecret` 和 `callbackURL`),以及一个回调函数。在这个回调函数中,我们要处理验证成功时,判断用户是否已经在数据库中存在的逻辑,以及在用户数据库对象中最初保存哪些字段。 这种处理方式适用于绝大部分第三方验证策略,但有些策略会需要我们提供更多的信息,详情请参考相关策略的 GitHub README。 例如,Google 的验证策略会要求你提供一个 *scope*,用于标示用户成功登录后,你需要从返回的对象中获取那些信息。以及,这也需要经过用户同意,你才可以获取到。 -The current strategy we are implementing authenticates users using a GitHub account and OAuth 2.0 tokens. The client ID and secret obtained when creating an application are supplied as options when creating the strategy. The strategy also requires a `verify` callback, which receives the access token and optional refresh token, as well as `profile` which contains the authenticated user's GitHub profile. The `verify` callback must call `cb` providing a user to complete authentication. +当前策略是使用 GitHub 账户和 OAuth 2.0 令牌验证用户。 创建应用程序时获得的客户 ID 和密码在创建策略时作为选项提供。 策略还需要 `verify` 回调,接收访问令牌和可选刷新令牌, 以及包含认证用户的 GitHub 资料的 `profile`。 `verify` 回调必须调用 `cb` 提供用户完成验证。 -Here's how your new strategy should look at this point: +你的新策略应该是这样的: ```js passport.use(new GitHubStrategy({ @@ -29,13 +29,13 @@ passport.use(new GitHubStrategy({ )); ``` -Your authentication won't be successful yet, and it will actually throw an error without the database logic and callback, but it should log your GitHub profile to your console if you try it! +目前,你的验证部分不会成功。由于没有数据库的逻辑和回调函数,你的代码目前还会报错。但如果你试一试,就可以在控制台里看到输出了你的 GitHub 个人信息。 -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- -passport-github dependency should be added. +应正确添加依赖 passport-github。 ```js (getUserInput) => @@ -54,7 +54,7 @@ passport-github dependency should be added. ); ``` -passport-github should be required. +应正确请求依赖 passport-github。 ```js (getUserInput) => @@ -72,7 +72,7 @@ passport-github should be required. ); ``` -GitHub strategy should be setup correctly thus far. +到目前为止,GitHub 策略应正确设置。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-iii.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-iii.md index 885c31883b3..9c92f56ca40 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-iii.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication-iii.md @@ -42,7 +42,7 @@ myDataBase.findOneAndUpdate( 你现在应该可以登录你的应用了,试试吧。 -完成上述要求后,你可以在下方提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,你可以在下方提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication.md index 25dd414b4f9..e98de5bcf72 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication.md @@ -18,7 +18,7 @@ dashedName: implementation-of-social-authentication 在 OAuth 验证策略中,我们至少需要提供 *Client ID* 和 *Client Secret*,这样第三方平台就会获悉验证请求的来源,以及这个来源是否有效。 为此,需要去我们使用的第三方验证平台(比如 GitHub)获取这两个字段的值。 注意,我们获取到的这个值是唯一的,仅对我们的当前 app 有效——**因此,千万不要分享给别人**,更不要上传到公共仓库或者直接写在代码里。 通常,我们会把它们放在 `.env` 文件里,并通过 `process.env.GITHUB_CLIENT_ID` 获取。 对于这次挑战,我们将会使用 GitHub 作为验证平台。 -Obtaining your *Client ID and Secret* from GitHub is done in your account profile settings under 'developer settings', then 'OAuth applications'. 点击 “Register a new application(注册一个新的应用)”,设置你的应用名称,然后把你的 Replit 主页地址(**不是项目代码的 url**)粘贴到 Homepage URL。然后,回调 url 需要设置成上面 Homepage URL 里你粘贴的地址,但后面要加上 `/auth/github/callback`。 这样在用户通过 Github 验证后才能跳转到我们指定的页面。 在你的 `.env` 文件里将返回的信息保存为 `'GITHUB_CLIENT_ID'` 和 `'GITHUB_CLIENT_SECRET'`。 +首先,你需要进入账户设置里的 “developer settings(开发者设置)”板块,在 'OAuth applications' 获取 *用户 ID 和密码*。 点击 “Register a new application(注册一个新的应用)”,设置你的应用名称,然后把你的 Replit 主页地址(**不是项目代码的 url**)粘贴到 Homepage URL。然后,回调 url 需要设置成上面 Homepage URL 里你粘贴的地址,但后面要加上 `/auth/github/callback`。 这样在用户通过 Github 验证后才能跳转到我们指定的页面。 在你的 `.env` 文件里将返回的信息保存为 `'GITHUB_CLIENT_ID'` 和 `'GITHUB_CLIENT_SECRET'`。 在你的 `routes.js` 文件中,添加 `showSocialAuth: true` 到主页路由,在 `showRegistration: true` 的后面。 然后,为 `/auth/github` 和 `/auth/github/callback` 创建两个接收 GET 请求的路由。 第一个只需要通过调用 passport 来验证 `'github'`。 第二个应该调用 passport 来验证 `'github'`,但需要在失败时跳转回主页 `/`,成功时跳转到用户页面 `/profile`(跳转的逻辑与上一个项目中的逻辑一样)。 @@ -31,7 +31,7 @@ app.route('/login') }); ``` -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project up to this point https://gist.github.com/camperbot/1f7f6f76adb178680246989612bea21e. +完成上述要求后,请提交你的页面链接。 如果你遇到了问题,可以参考 https://gist.github.com/camperbot/1f7f6f76adb178680246989612bea21e。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/logging-a-user-out.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/logging-a-user-out.md index c193cc1f688..12296858f60 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/logging-a-user-out.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/logging-a-user-out.md @@ -30,11 +30,11 @@ app.use((req, res, next) => { }); ``` -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- -`req.logout()` should be called in your `/logout` route. +`req.logout()` 应在 `/logout` 路由中调用。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/registration-of-new-users.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/registration-of-new-users.md index 35709c4bd67..4419034cf4d 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/registration-of-new-users.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/registration-of-new-users.md @@ -47,7 +47,7 @@ app.route('/register') ); ``` -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 **注意:**接下来的挑战可能会在运行 *picture-in-picture*(画中画)模式的浏览器中出现问题。 如果你使用的线上 IDE 提供在 IDE 内预览 app 的功能,请考虑打开新的标签页预览。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.md index 29553b4f950..abcab969424 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/send-and-display-chat-messages.md @@ -28,7 +28,7 @@ socket.emit('chat message', messageToSend); 至此,我们已经完成发送信息到所有客户端的功能。 -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md index 24ec080a681..a71dc68eb50 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md @@ -12,7 +12,7 @@ dashedName: serialization-of-a-user-object 我们需要用到序列化和反序列化的方法来进行配置。 passport 为我们提供了 `passport.serializeUser( OURFUNCTION )` 和 `passport.deserializeUser( OURFUNCTION )` 两个方法。 -`serializeUser` 方法接收两个参数,分别是表示用户的对象和一个回调函数。 其中,回调函数的返回值应为这个用户的唯一标识符:最简单的写法就是让它返回用户的 `_id`。 它应当是唯一的,是由 MongoDB 产生的。 类似地,`deserializeUser` 也接收两个参数,分别是在序列化时生成的标识符以及一个回调函数。在回调函数里,我们需要根据根据传入的标识符(比如 \_id)返回表示用户的对象。 为了在 MongoDB 中通过 query(查询语句)获取 `_id` 字段,首先我们需要创建 `const ObjectID = require('mongodb').ObjectID;`;然后调用它:`new ObjectID(THE_ID)`。 `mongodb@~3.6.0` has already been added as a dependency. 你可以在下面的例子中看到: +`serializeUser` 方法接收两个参数,分别是表示用户的对象和一个回调函数。 其中,回调函数的返回值应为这个用户的唯一标识符:最简单的写法就是让它返回用户的 `_id`。 它应当是唯一的,是由 MongoDB 产生的。 类似地,`deserializeUser` 也接收两个参数,分别是在序列化时生成的标识符以及一个回调函数。在回调函数里,我们需要根据根据传入的标识符(比如 \_id)返回表示用户的对象。 为了在 MongoDB 中通过 query(查询语句)获取 `_id` 字段,首先我们需要创建 `const ObjectID = require('mongodb').ObjectID;`;然后调用它:`new ObjectID(THE_ID)`。 `mongodb@~3.6.0` 已经被添加为依赖项。 你可以在下面的例子中看到: ```js passport.serializeUser((user, done) => { @@ -28,7 +28,7 @@ passport.deserializeUser((id, done) => { 因此,在我们在下一步中配置 DB 前,`deserializeUser` 会抛出错误。所以,现在请先注释掉上面的代码,在 `deserializeUser` 中仅调用 `done(null, null)` 即可。 -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-a-template-engine.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-a-template-engine.md index a434380692e..92bf5e96fb6 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-a-template-engine.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-a-template-engine.md @@ -10,25 +10,25 @@ dashedName: set-up-a-template-engine 你可以采用下面的任意一种方式完成这些挑战: -- Clone this GitHub repo and complete these challenges locally. -- Use our Replit starter project to complete these challenges. +- 克隆这个 GitHub 仓库,并在本地完成这些挑战。 +- 使用我们在 Replit 上的初始化项目来完成这些挑战。 - 使用一个你选择的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。 完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 你可以在应用的模版引擎中使用静态模板文件(如那些写在 *Pug* 里的)。 在运行时,模版引擎会用服务端的真实数据替换掉模版文件中的变量, 然后将模版转译成发送给客户端的 HTML 静态文件。 这样可以轻松地构造 HTML 页面,允许在页面直接显示变量内容而不需要从客户端发送 API 请求。 -`pug@~3.0.0` has already been installed, and is listed as a dependency in your `package.json` file. +`pug@~3.0.0` 已经被安装,并且在你项目的 `package.json` 文件中作为依赖。 Express 需要知道你正在使用哪个模板引擎。 我们将使用 `set` 方法来分配 `pug` 作为 `view engine` 属性的值: `app.set('view engine', 'pug')`。 -Your page will be blank until you correctly render the index file in the `views/pug` directory. +在正确渲染 `views/pug` 目录中的索引文件之后,加载页面。 -To render the `pug` template, you need to use `res.render()` in the `/` route. Pass the file path to the `views/pug` directory as the argument to the method. The path can be a relative path (relative to views), or an absolute path, and does not require a file extension. +要渲染 `pug` 模板,你需要在 `/` 路由中使用 `res.render()`。 将文件路径作为参数传递到方法的 `views/pug` 目录。 这个路径可以是相对路径(相对于 views),也可以是绝对路径,不需要文件扩展。 -If all went as planned, your app home page will no longer be blank and will display a message indicating you've successfully rendered the Pug template! +如果一切按计划进行,你的应用程序主页将不再是空白的,并将显示一条信息,表明你已经成功地渲染了 Pug 模板! -完成以上要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成以上要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-passport.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-passport.md index e9aac7b4ff5..597ed97a7dc 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-passport.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-passport.md @@ -8,13 +8,13 @@ dashedName: set-up-passport # --description-- -现在我们来创建 *Passport*,最终我们需要用它来实现用户注册和登录。 除了 Passport,我们还会用 Express-session 来处理 session(会话)。 Express-session has a ton of advanced features you can use, but for now we're just going to use the basics! Using this middleware saves the session id as a cookie in the client and allows us to access the session data using that id on the server. This way we keep personal account information out of the cookie used by the client to verify to our server they are authenticated and just keep the *key* to access the data stored on the server. +现在我们来创建 *Passport*,最终我们需要用它来实现用户注册和登录。 除了 Passport,我们还会用 Express-session 来处理 session(会话)。 Express-session 有许多高级特性,但我们暂时只需要了解其基础功能。 在客户端,我们可以用这个中间件把 session id 储存到 cookie。同时,我们可以在服务器上通过这个 id 访问 session 数据。 通过这种方式,我们无需把用户的个人账号信息存到 cookie,来完成用户的验证。只需要用这个 id 作为 *key* 来访问服务器上用户的数据即可。 -`passport@~0.4.1` and `express-session@~1.17.1` are already installed, and are both listed as dependencies in your `package.json` file. +`passport@~0.4.1` 和 `express-session@~1.17.1` 已经安装,并且在你的 `package.json` 文件中均被列为依赖项。 -You will need to set up the session settings now and initialize Passport. Be sure to first create the variables 'session' and 'passport' to require 'express-session' and 'passport' respectively. +现在,你需要配置 session 并初始化 Passport。 请先创建变量 “session” 和 “passport” 来分别引入 “express-session” 和 “passport”。 -To set up your express app to use the session we'll define just a few basic options. Be sure to add 'SESSION_SECRET' to your .env file and give it a random value. This is used to compute the hash used to encrypt your cookie! +为了让 express 应用可以使用 session,我们需要添加一些基础选项。 请在 .env 文件中添加字段 “SESSION_SECRET”,并给它赋一个随机值, 便于加密 cookie、计算哈希。 ```js app.use(session({ @@ -25,13 +25,13 @@ app.use(session({ })); ``` -As well you can go ahead and tell your express app to **use** 'passport.initialize()' and 'passport.session()'. (For example, `app.use(passport.initialize());`) +还有,我们需要让 express **使用** “passport.initialize()” 和 “passport.session()”。 (例如,`app.use(passport.initialize());`)。 -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- -Passport and Express-session should be dependencies. +应添加 Passport 和 Express-session 作为依赖。 ```js (getUserInput) => @@ -55,7 +55,7 @@ Passport and Express-session should be dependencies. ); ``` -Dependencies should be correctly required. +依赖应正确引入。 ```js (getUserInput) => @@ -78,7 +78,7 @@ Dependencies should be correctly required. ); ``` -Express app should use new dependencies. +Express app 可以使用新的依赖。 ```js (getUserInput) => @@ -101,7 +101,7 @@ Express app should use new dependencies. ); ``` -Session and session secret should be correctly set up. +应正确设置 Session 和会话密码。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md index 365b48c155c..4b4c117b93d 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/set-up-the-environment.md @@ -10,7 +10,7 @@ dashedName: set-up-the-environment 在接下来的挑战中,我们将会用到 `chat.pug` 文件。 首先,在你的 `routes.js` 文件中为 `/chat` 添加一个处理 GET 请求的路由,并给它传入 `ensureAuthenticated`。在回调函数中,我们需要让它渲染 `chat.pug` 文件,并在响应中包含 `{ user: req.user }` 信息。 现在,请修改 `/auth/github/callback` 路由,让它可以像这样设置 user_id:`req.session.user_id = req.user.id`,并在设置完成后重定向至 `/chat`。 -`socket.io@~2.3.0` has already been added as a dependency, so require/instantiate it in your server as follows with `http` (comes built-in with Nodejs): +已添加 `socket.io@~2.3.0` 作为依赖项,在你的服务器中和 `http` (内置在 Nodejs 中)一起导入/实例化,具体如下: ```javascript const http = require('http').createServer(app); @@ -19,7 +19,7 @@ const io = require('socket.io')(http); 现在我们的 *express 应用*已经包含了 *http* 服务,接下来我们需要监听 *http* 服务的事件。 为此,我们需要把 `app.listen` 更新为 `http.listen`。 -需要处理的第一件事是监听客户端的新连接。 on 关键字就是监听这个特定事件。 It requires 2 arguments: a string containing the title of the event that's emitted, and a function with which the data is passed through. 在连接监听器中,我们用 *socket* 来代表它所包含的数据。 socket 就是指已连接到服务器的客户端。 +需要处理的第一件事是监听客户端的新连接。 on 关键字就是监听这个特定事件。 它需要 2 个参数:一个包含所发出事件标题的字符串,以及一个用于传递数据的函数。 在连接监听器中,我们用 *socket* 来代表它所包含的数据。 socket 就是指已连接到服务器的客户端。 为了可以监听服务器的连接事件,我们在数据库连接的部分加入如下代码: @@ -42,7 +42,7 @@ let socket = io(); **注意:**只有在连接到处于同一个 url/server 上的 socket 时,`io()`才可以正常执行。 如果需要连接到外部的 socket,就需要这样调用:`io.connect('URL');`。 -完成上述要求后,请提交你的页面链接。 If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,请提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/use-a-template-engines-powers.md b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/use-a-template-engines-powers.md index 8258dfbaaab..dee18d0920e 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/use-a-template-engines-powers.md +++ b/curriculum/challenges/chinese/06-quality-assurance/advanced-node-and-express/use-a-template-engines-powers.md @@ -12,9 +12,9 @@ dashedName: use-a-template-engines-powers 在 Pug 文件中,你可以用变量名来调用变量,比如写成 `#{variable_name}` 来实现行内调用,或像 `p=variable_name` 把元素与变量直接写在一起,这表示 p 元素的内容等价于这个变量。 - Pug is all about using whitespace and tabs to show nested elements and cutting down on the amount of code needed to make a beautiful site. Read the Pug documentation for more information on usage and syntax. + Pug 是关于使用空白和制表符来显示嵌套元素,并减少制作一个漂亮网站所需的代码量。 阅读 Pug 文档以获取更多关于使用和语法的信息。 - Here is an example: + 下面是一个例子: ```html @@ -38,17 +38,17 @@ dashedName: use-a-template-engines-powers ``` -Looking at our pug file `index.pug` included in your project, we used the variables `title` and `message`. +查看在你的项目中的 pug 文件 `index.pug`,我们使用了变量 `title` 和 `message`。 -To pass those along from our server, you will need to add an object as a second argument to your `res.render` with the variables and their values. For example, pass this object along setting the variables for your index view: `{title: 'Hello', message: 'Please login'}` +为了从服务器传递这些信息,你需要给 `res.render` 的第二个参数传入一个对象,其中包含变量和对应的值。 例如,在设置索引视图的变量时传递此对象:`{title: 'Hello', message: 'Please login'}`。 -It should look like: `res.render(process.cwd() + '/views/pug/index', {title: 'Hello', message: 'Please login'});` 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! +看起来应该像这样:`res.render(process.cwd() + '/views/pug/index', {title: 'Hello', message: 'Please login'});`。现在刷新页面,你应该看到那些值就像在 `index.pug` 文件中一样被渲染在页面上正确的位置。 -Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point. +完成上述要求后,你可以在下方提交你的页面链接。 如果你在运行时遇到错误,你可以查看已执行项目的当前进度。 # --hints-- -Pug should correctly render variables. +Pug 应正确地展示变量。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/assert-deep-equality-with-.deepequal-and-.notdeepequal.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/assert-deep-equality-with-.deepequal-and-.notdeepequal.md index 5517b53e85b..b6621bccddf 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/assert-deep-equality-with-.deepequal-and-.notdeepequal.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/assert-deep-equality-with-.deepequal-and-.notdeepequal.md @@ -8,7 +8,7 @@ dashedName: assert-deep-equality-with--deepequal-and--notdeepequal # --description-- -As a reminder, this project is being built upon the following starter project on Replit or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 `deepEqual()` 断言两个对象是否深度相等。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/compare-the-properties-of-two-elements.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/compare-the-properties-of-two-elements.md index 8dd5ff29952..a30d0a006c2 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/compare-the-properties-of-two-elements.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/compare-the-properties-of-two-elements.md @@ -8,15 +8,15 @@ dashedName: compare-the-properties-of-two-elements # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 # --instructions-- -Within `tests/1_unit-tests.js` under the test labelled `#8` in the `Comparisons` suite, change each `assert` to either `assert.isAbove` or `assert.isAtMost` to make the test pass (should evaluate to `true`). Do not alter the arguments passed to the asserts. +在 `tests/1_unit-tests.js` 中,在标有 `#8` 的 `Comparisons` 套件里,将每个 `assert` 改成 `assert.isAbove` 或 `assert.isAtMost` 方法,让测试通过(结果应该返回 `true`)。 不要修改传给断言的参数。 # --hints-- -All tests should pass. +应通过所有测试。 ```js (getUserInput) => @@ -30,7 +30,7 @@ All tests should pass. ); ``` -You should choose the correct method for the first assertion - `isAbove` vs. `isAtMost`. +请为第一个断言选择正确的方法 — `isAbove` 或 `isAtMost`。 ```js (getUserInput) => @@ -48,7 +48,7 @@ You should choose the correct method for the first assertion - `isAbove` vs. `is ); ``` -You should choose the correct method for the second assertion - `isAbove` vs. `isAtMost`. +请为第二个断言选择正确的方法 — `isAbove` 或 `isAtMost`。 ```js (getUserInput) => @@ -62,7 +62,7 @@ You should choose the correct method for the second assertion - `isAbove` vs. `i ); ``` -You should choose the correct method for the third assertion - `isAbove` vs. `isAtMost`. +请为第三个断言选择正确的方法 — `isAbove` 或 `isAtMost`。 ```js (getUserInput) => @@ -80,7 +80,7 @@ You should choose the correct method for the third assertion - `isAbove` vs. `is ); ``` -You should choose the correct method for the fourth assertion - `isAbove` vs. `isAtMost`. +请为第四个断言选择正确的方法 — `isAbove` 或 `isAtMost`。 ```js (getUserInput) => diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/learn-how-javascript-assertions-work.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/learn-how-javascript-assertions-work.md index 5d47ffa3a05..37ccec6ea79 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/learn-how-javascript-assertions-work.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/learn-how-javascript-assertions-work.md @@ -10,8 +10,8 @@ dashedName: learn-how-javascript-assertions-work 你可以采用下面的任意一种方式完成这些挑战: -- Clone this GitHub repo and complete these challenges locally. -- Use our Replit starter project to complete these challenges. +- 克隆这个 GitHub 仓库,并在本地完成这些挑战。 +- 使用我们在 Replit 上的初始化项目来完成这些挑战。 - 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。 完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iii---put-method.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iii---put-method.md index ac4947ce864..52457d4ad9b 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iii---put-method.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iii---put-method.md @@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-an-api-response-using-chai-http-iii---put-me # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 当你测试一个 `PUT` 请求时,你经常会随同它一起发送数据。 你在 `PUT` 请求中包含的数据被称为请求的主体。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method.md index a89308674a1..6d5cbbcad91 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method.md @@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-an-api-response-using-chai-http-iv---put-met # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 这个练习与上一个类似。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http-ii.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http-ii.md index 6ad2e13cbd3..d458e8e0c65 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http-ii.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http-ii.md @@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-api-endpoints-using-chai-http-ii # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 # --instructions-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http.md index 709237a0f57..876e4d210be 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http.md @@ -8,7 +8,7 @@ dashedName: run-functional-tests-on-api-endpoints-using-chai-http # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 Mocha 允许你使用名为 `chai-http` 的插件测试异步操作,例如调用 API 端点。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser-ii.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser-ii.md index 8aa261de9ff..5bbabfe54c5 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser-ii.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser-ii.md @@ -8,11 +8,11 @@ dashedName: run-functional-tests-using-a-headless-browser-ii # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 # --instructions-- -Within `tests/2_functional-tests.js`, in the `'Submit the surname "Vespucci" in the HTML form'` test (`// #6`), automate the following: +在 `tests/2_functional-tests.js` 中,在 `'Submit the surname "Vespucci" in the HTML form'` 测试(`// #6`),自动执行以下操作: 1. 在表格中填写姓氏 `Vespucci`。 2. 点击提交按钮 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser.md index aa83e0f6282..11d1fb32dd6 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser.md @@ -8,7 +8,7 @@ dashedName: run-functional-tests-using-a-headless-browser # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 在页面上有一个输入表单。 它将数据作为 AJAX 请求发送到 `PUT /travellers` 端点。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/simulate-actions-using-a-headless-browser.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/simulate-actions-using-a-headless-browser.md index 45cb783c184..2875a15bf8f 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/simulate-actions-using-a-headless-browser.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/simulate-actions-using-a-headless-browser.md @@ -7,7 +7,7 @@ dashedName: simulate-actions-using-a-headless-browser # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 在接下来的挑战中,你将使用无头浏览器模拟人类与页面的交互。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-for-truthiness.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-for-truthiness.md index 9109853eafa..1a3f0e84480 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-for-truthiness.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-for-truthiness.md @@ -8,7 +8,7 @@ dashedName: test-for-truthiness # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 `isTrue()` 仅当给出的值为 Boolean 的 `true` 时可以通过测试;`isNotTrue()` 则会在给出除 `true` 以外的值时通过测试。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-string-contains-a-substring.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-string-contains-a-substring.md index 070e741f017..c089bbbfd37 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-string-contains-a-substring.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-string-contains-a-substring.md @@ -8,7 +8,7 @@ dashedName: test-if-a-string-contains-a-substring # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 `include()` 和 `notInclude()` 同样可以用于字符串。 `include()` 用于断言字符串中包含某个子字符串。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-falls-within-a-specific-range.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-falls-within-a-specific-range.md index a884f1933fd..6c7f81167d7 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-falls-within-a-specific-range.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-falls-within-a-specific-range.md @@ -8,7 +8,7 @@ dashedName: test-if-a-value-falls-within-a-specific-range # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 ```javascript .approximately(actual, expected, delta, [message]) diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-a-string.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-a-string.md index 0ad6dbbaf11..0e9de993e3f 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-a-string.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-a-string.md @@ -8,7 +8,7 @@ dashedName: test-if-a-value-is-a-string # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 `isString` 或 `isNotString` 断言一个值是否为字符串。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-of-a-specific-data-structure-type.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-of-a-specific-data-structure-type.md index 8a4f77c4644..55fbb3e7cd5 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-of-a-specific-data-structure-type.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-of-a-specific-data-structure-type.md @@ -8,7 +8,7 @@ dashedName: test-if-a-value-is-of-a-specific-data-structure-type # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 `#typeOf` 断言一个值的类型符合给定的类型,这个类型与 `Object.prototype.toString` 一致。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-variable-or-function-is-defined.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-variable-or-function-is-defined.md index 1e6072a7ab8..a231ca9e5ce 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-variable-or-function-is-defined.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-variable-or-function-is-defined.md @@ -8,7 +8,7 @@ dashedName: test-if-a-variable-or-function-is-defined # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 # --instructions-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-array-contains-an-item.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-array-contains-an-item.md index 5c12314d747..117e2f2a0e8 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-array-contains-an-item.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-array-contains-an-item.md @@ -8,7 +8,7 @@ dashedName: test-if-an-array-contains-an-item # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 # --instructions-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-has-a-property.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-has-a-property.md index ac4e291289d..7a49cbc52f6 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-has-a-property.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-has-a-property.md @@ -8,7 +8,7 @@ dashedName: test-if-an-object-has-a-property # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 `property` 断言一个对象含有给定属性。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-is-an-instance-of-a-constructor.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-is-an-instance-of-a-constructor.md index f037fc61ce3..b6fa52252e3 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-is-an-instance-of-a-constructor.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-is-an-instance-of-a-constructor.md @@ -8,7 +8,7 @@ dashedName: test-if-an-object-is-an-instance-of-a-constructor # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 `#instanceOf` 断言一个对象是一个构造器的实例。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-one-value-is-below-or-at-least-as-large-as-another.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-one-value-is-below-or-at-least-as-large-as-another.md index 8e18a8a9aee..b7ed478eb08 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-one-value-is-below-or-at-least-as-large-as-another.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-one-value-is-below-or-at-least-as-large-as-another.md @@ -8,7 +8,7 @@ dashedName: test-if-one-value-is-below-or-at-least-as-large-as-another # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 # --instructions-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-assert.isok-and-assert.isnotok.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-assert.isok-and-assert.isnotok.md index 2bbf2a7a843..a08a13559ef 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-assert.isok-and-assert.isnotok.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-assert.isok-and-assert.isnotok.md @@ -8,11 +8,11 @@ dashedName: use-assert-isok-and-assert-isnotok # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 `isOk()` 用来测试值是否为真值,`isNotOk()` 用来测试值是否为假值。 -To learn more about truthy and falsy values, try our Falsy Bouncer challenge. +可以在过滤数组中的假值这个挑战中了解更多关于真值和假值的信息。 # --instructions-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-regular-expressions-to-test-a-string.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-regular-expressions-to-test-a-string.md index 4abdc4d2ef4..b904a6e977c 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-regular-expressions-to-test-a-string.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-regular-expressions-to-test-a-string.md @@ -8,7 +8,7 @@ dashedName: use-regular-expressions-to-test-a-string # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 `match()` 断言一个值匹配一个正则表达式(第二个参数)。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-double-equals-to-assert-equality.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-double-equals-to-assert-equality.md index b1c0d228cf4..2249ab95e34 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-double-equals-to-assert-equality.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-double-equals-to-assert-equality.md @@ -8,7 +8,7 @@ dashedName: use-the-double-equals-to-assert-equality # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 `equal()` 使用 `==` 比较对象。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-triple-equals-to-assert-strict-equality.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-triple-equals-to-assert-strict-equality.md index 118aad97d78..032e9968017 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-triple-equals-to-assert-strict-equality.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-triple-equals-to-assert-strict-equality.md @@ -8,7 +8,7 @@ dashedName: use-the-triple-equals-to-assert-strict-equality # --description-- -As a reminder, this project is being built upon the following starter project on Replit, or cloned from GitHub. +请注意,本项目是在 Replit 上的初始化项目的基础上进行开发,你也可以从 GitHub 上克隆。 `strictEqual()` 使用 `===` 比较对象。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/american-british-translator.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/american-british-translator.md index 59551556047..ac09a37c425 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/american-british-translator.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/american-british-translator.md @@ -8,10 +8,10 @@ dashedName: american-british-translator # --description-- -Build a full stack JavaScript app that is functionally similar to this: https://american-british-translator.freecodecamp.rocks/. 可以采用下面的任意一种方式完成这个挑战: +构建一个 JavaScript 全栈应用,在功能上与 https://american-british-translator.freecodecamp.rocks/ 类似。 可以采用下面的任意一种方式完成这个挑战: -- Clone this GitHub repo and complete your project locally. -- Use our Replit starter project to complete your project. +- 克隆这个 GitHub 仓库,并在本地完成你的项目。 +- 使用我们在 Replit 上的初始化项目来完成你的项目。 - 使用您选择的站点生成器来完成项目。 并确保包含了我们 GitHub 仓库的所有文件。 当完成本项目,请确认有一个可以公开访问的正常运行 demo 。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/issue-tracker.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/issue-tracker.md index f4192eb3cf1..e118d484203 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/issue-tracker.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/issue-tracker.md @@ -8,10 +8,10 @@ dashedName: issue-tracker # --description-- -Build a full stack JavaScript app that is functionally similar to this: https://issue-tracker.freecodecamp.rocks/. 可以采用下面的任意一种方式完成这个挑战: +构建一个 JavaScript 全栈应用,在功能上与 https://issue-tracker.freecodecamp.rocks/ 类似。 可以采用下面的任意一种方式完成这个挑战: -- Clone this GitHub repo and complete your project locally. -- Use this Replit starter project to complete your project. +- 克隆这个 GitHub 仓库,并在本地完成你的项目。 +- 使用我们的 Replit 初始化项目来完成你的项目。 - 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。 完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/metric-imperial-converter.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/metric-imperial-converter.md index cc9f9c624f9..29ea9f71dd3 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/metric-imperial-converter.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/metric-imperial-converter.md @@ -8,10 +8,10 @@ dashedName: metric-imperial-converter # --description-- -Build a full stack JavaScript app that is functionally similar to this: https://metric-imperial-converter.freecodecamp.rocks/. 可以采用下面的任意一种方式完成这个挑战: +构建一个 JavaScript 全栈应用,在功能上与 https://metric-imperial-converter.freecodecamp.rocks/ 类似。 可以采用下面的任意一种方式完成这个挑战: -- Clone this GitHub repo and complete your project locally. -- Use our Replit starter project to complete your project. +- 克隆这个 GitHub 仓库,并在本地完成你的项目。 +- 使用我们在 Replit 上的初始化项目来完成你的项目。 - 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。 完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/personal-library.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/personal-library.md index 7f9b3030fb8..fd68940d56e 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/personal-library.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/personal-library.md @@ -8,10 +8,10 @@ dashedName: personal-library # --description-- -Build a full stack JavaScript app that is functionally similar to this: https://personal-library.freecodecamp.rocks/. 可以采用下面的任意一种方式完成这个挑战: +构建一个 JavaScript 全栈应用,在功能上与 https://personal-library.freecodecamp.rocks/ 类似。 可以采用下面的任意一种方式完成这个挑战: -- Clone this GitHub repo and complete your project locally. -- Use our Replit starter project to complete your project. +- 克隆这个 GitHub 仓库,并在本地完成你的项目。 +- 使用我们在 Replit 上的初始化项目来完成你的项目 - 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。 完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。 diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md index 29ba42e8369..7128996eda2 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md @@ -8,10 +8,10 @@ dashedName: sudoku-solver # --description-- -Build a full stack JavaScript app that is functionally similar to this: https://sudoku-solver.freecodecamp.rocks/. 可以采用下面的任意一种方式完成这个挑战: +构建一个 JavaScript 全栈应用,在功能上与 https://sudoku-solver.freecodecamp.rocks/ 类似。 可以采用下面的任意一种方式完成这个挑战: -- Clone this GitHub repo and complete your project locally. -- Use our Replit starter project to complete your project. +- 克隆这个 GitHub 仓库,并在本地完成你的项目。 +- 使用我们在 Replit 上的初始化项目来完成你的项目。 - 使用一个你喜欢的站点生成器来完成项目。 需要确定包含了我们 GitHub 仓库的所有文件。 完成本项目后,请将一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后在 `Solution Link` 框中提交你的项目 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。 @@ -270,7 +270,7 @@ async (getUserInput) => { }; ``` -If the object submitted to `/api/check` is missing `puzzle`, `coordinate` or `value`, the returned value will be `{ error: 'Required field(s) missing' }` +如果提交给 `/api/check` 的对象缺失 `puzzle`、`coordinate` 或 `value`,那么返回的值将是 `{ error: 'Required field(s) missing' }`。 ```js async (getUserInput) => { @@ -324,7 +324,7 @@ async (getUserInput) => { }; ``` -If the `value` submitted to `/api/check` is not a number between 1 and 9, the returned value will be `{ error: 'Invalid value' }` +如果提交给 `/api/check` 的 `value` 不是一个介于 1 到 9 之间的数字,则返回的值将是 `{ error: 'Invalid value' }`。 ```js async (getUserInput) => { @@ -371,7 +371,7 @@ async (getUserInput) => { }; ``` -所有 14 项功能测试都已完成并通过。 See `/tests/2_functional-tests.js` for the expected functionality you should write tests for. +所有 14 项功能测试都已完成并通过。 请参阅 `/tests/2_functional-tests.js` 来了解你应该编写的测试的功能。 ```js async (getUserInput) => { diff --git a/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/files-as-a-sequence.md b/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/files-as-a-sequence.md index fd33ec4f494..e6dafddd2d3 100644 --- a/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/files-as-a-sequence.md +++ b/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/files-as-a-sequence.md @@ -14,7 +14,7 @@ dashedName: files-as-a-sequence 更多资源: -\- Exercise +\- 练习 # --question-- diff --git a/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/intermediate-expressions.md b/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/intermediate-expressions.md index 766b4e06a8f..89074ac4b18 100644 --- a/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/intermediate-expressions.md +++ b/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/intermediate-expressions.md @@ -14,9 +14,9 @@ dashedName: intermediate-expressions 更多资源: -\- Exercise 1 +\- 练习 1 -\- Exercise 2 +\- 练习 2 # --question-- diff --git a/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/introduction-why-program.md b/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/introduction-why-program.md index 23d120aa8fe..8eb62629b0c 100644 --- a/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/introduction-why-program.md +++ b/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/introduction-why-program.md @@ -18,9 +18,9 @@ dashedName: introduction-why-program 更多资源: -\- Install Python on Windows +\- 在 Windows 上安装 Python -\- Install Python on MacOS +\- 在 MacOS 上安装 Python # --question-- diff --git a/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/iterations-more-patterns.md b/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/iterations-more-patterns.md index 36d7c92d74c..b1582356001 100644 --- a/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/iterations-more-patterns.md +++ b/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/iterations-more-patterns.md @@ -14,7 +14,7 @@ dashedName: iterations-more-patterns 更多资源: -\- Exercise +\- 练习 # --question-- diff --git a/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/networking-web-scraping-with-python.md b/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/networking-web-scraping-with-python.md index 30e900cc2a7..1293e5db58f 100644 --- a/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/networking-web-scraping-with-python.md +++ b/curriculum/challenges/chinese/07-scientific-computing-with-python/python-for-everybody/networking-web-scraping-with-python.md @@ -14,11 +14,11 @@ dashedName: networking-web-scraping-with-python 更多资料: -\- Exercise: socket1 +\- 练习:socket1 -\- Exercise: urllib +\- 练习:urllib -\- Exercise: urllinks +\- 练习:urllinks # --question-- diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md index 44c6f8bb428..b5b41d8d864 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md @@ -22,11 +22,11 @@ dashedName: page-view-time-series-visualizer 使用数据完成以下任务: -- 使用 Pandas 从 “fcc-forum-pageviews.csv” 导入数据。 Set the index to the `date` column. +- 使用 Pandas 从 “fcc-forum-pageviews.csv” 导入数据。 将索引设置为 `date` 列。 - 通过过滤掉页面浏览量位于数据集前 2.5% 或数据集后 2.5% 的日期来清理数据。 -- 创建一个 `draw_line_plot` 函数,该函数使用 Matplotlib 绘制类似于“examples/Figure_1.png”的折线图。 The title should be `Daily freeCodeCamp Forum Page Views 5/2016-12/2019`. The label on the x axis should be `Date` and the label on the y axis should be `Page Views`. -- 创建一个 `draw_bar_plot` 函数,用于绘制类似于“examples/Figure_2.png”的条形图。 它应该显示按年份分组的每个月的平均每日页面浏览量。 The legend should show month labels and have a title of `Months`. On the chart, the label on the x axis should be `Years` and the label on the y axis should be `Average Page Views`. -- 创建一个 `draw_box_plot` 函数,该函数使用 Seaborn 绘制两个相邻的箱形图,类似于“examples/Figure_3.png”。 这些箱线图应显示值在给定年份或月份内的分布情况以及随时间推移的比较情况。 The title of the first chart should be `Year-wise Box Plot (Trend)` and the title of the second chart should be `Month-wise Box Plot (Seasonality)`. Make sure the month labels on bottom start at `Jan` and the x and y axis are labeled correctly. 样板文件包括准备数据的命令。 +- 创建一个 `draw_line_plot` 函数,该函数使用 Matplotlib 绘制类似于“examples/Figure_1.png”的折线图。 标题应为 `Daily freeCodeCamp Forum Page Views 5/2016-12/2019`。 x 轴上的标签应为 `Date`,y 轴上的标签应为 `Page Views`。 +- 创建一个 `draw_bar_plot` 函数,用于绘制类似于“examples/Figure_2.png”的条形图。 它应该显示按年份分组的每个月的平均每日页面浏览量。 图例应显示月份标签并具有 `Months` 标题。 在图表上,x 轴上的标签应为 `Years`,y 轴上的标签应为 `Average Page Views`。 +- 创建一个 `draw_box_plot` 函数,该函数使用 Seaborn 绘制两个相邻的箱形图,类似于“examples/Figure_3.png”。 这些箱线图应显示值在给定年份或月份内的分布情况以及随时间推移的比较情况。 第一个图表的标题应为 `Year-wise Box Plot (Trend)`,第二个图表的标题应为 `Month-wise Box Plot (Seasonality)`。 确保底部的月份标签从 `Jan` 开始,并且 x 和 y 轴标记正确。 样板文件包括准备数据的命令。 对于每个图表,请确保使用数据框的副本。 单元测试是在 `test_module.py` 下为你编写的。 diff --git a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md index 6828dabb92e..b8a10169a5c 100644 --- a/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md +++ b/curriculum/challenges/chinese/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md @@ -23,10 +23,10 @@ dashedName: sea-level-predictor 使用数据完成以下任务: - 使用 Pandas 从 `epa-sea-level.csv` 导入数据。 -- Use matplotlib to create a scatter plot using the `Year` column as the x-axis and the `CSIRO Adjusted Sea Level` column as the y-axix. +- 使用 matplotlib 创建散点图,使用 `Year` 列作为 x 轴,将 `CSIRO Adjusted Sea Level` 列作为 y 轴。 - 使用 `scipy.stats` 中的 `linregress` 函数来获得最佳拟合线的斜率和 y 截距。 在散点图的顶部绘制最佳拟合线。 使线穿过 2050 年以预测 2050 年的海平面上升。 - 仅使用数据集中从 2000 年到最近一年的数据绘制一条新的最佳拟合线。 如果上升速度继续与 2000 年一样,则使该线也经过 2050 年以预测 2050 年的海平面上升。 -- The x label should be `Year`, the y label should be `Sea Level (inches)`, and the title should be `Rise in Sea Level`. +- x 标签应为 `Year`,y 标签应为 `Sea Level (inches)`,标题应为 `Rise in Sea Level`。 单元测试是在 `test_module.py` 下为你编写的。 @@ -46,7 +46,7 @@ dashedName: sea-level-predictor ## 数据源 -Global Average Absolute Sea Level Change, 1880-2014 from the US Environmental Protection Agency using data from CSIRO, 2015; NOAA, 2015. +全球平均绝对海平面变化,1880 - 2014 年,来自美国环境保护局,数据来源:CSIRO, 2015; NOAA, 2015。 # --hints-- diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md index 841319d1bda..6ae83d11ec1 100644 --- a/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md +++ b/curriculum/challenges/chinese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md @@ -15,7 +15,7 @@ dashedName: state-name-puzzle Write a function to solve the challenge for a given array of actual U.S. state names, and for fictional state names. -The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `"from"` array should contain the original names and the `"to"` array should contain the resultant names. +The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `from` array should contain the original names and the `to` array should contain the resultant names. # --hints-- diff --git a/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md b/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md index 14eb0bf582d..4a1f5a7caa6 100644 --- a/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md +++ b/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md @@ -8,29 +8,29 @@ dashedName: book-recommendation-engine-using-knn # --description-- -You will be working on this project with Google Colaboratory. +你将使用 Google Colaboratory 来完成这个项目。 -After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link." +进入该链接后,在你自己的账户或本地创建一个笔记本的副本。 一旦你完成项目并通过测试(包括在该链接),请在下面提交你的项目链接。 如果你提交的是 Google Colaboratory 的链接,请确保打开链接共享时选择 “anyone with the link”。 -We are still developing the interactive instructional content for the machine learning curriculum. For now, you can go through the video challenges in this certification. You may also have to seek out additional learning resources, similar to what you would do when working on a real-world project. +我们仍在开发机器学习课程的交互式课程部分。 现在,你可以通过这个认证中的视频挑战。 你可能还需要寻找额外的学习资源,类似于你在真实世界项目中的工作。 # --instructions-- -In this challenge, you will create a book recommendation algorithm using **K-Nearest Neighbors**. +在这个挑战中,你将使用 **K-Nearest Neighbors** 创建一个图书推荐算法。 -You will use the Book-Crossings dataset. This dataset contains 1.1 million ratings (scale of 1-10) of 270,000 books by 90,000 users. +你将使用 Book-Crossings 数据集。 该数据集包括 90,000 名用户对 270,000 册书籍的 110 万份评分(评分从 1 至 10)。 -After importing and cleaning the data, use `NearestNeighbors` from `sklearn.neighbors` to develop a model that shows books that are similar to a given book. The Nearest Neighbors algorithm measures the distance to determine the “closeness” of instances. +导入并清理数据后,使用 `sklearn.neighbors` 中的 `NearestNeighbors` 开发一个模型,显示与给定书籍相似的书籍。 最近邻算法测量距离以确定实例的“接近度”。 -Create a function named `get_recommends` that takes a book title (from the dataset) as an argument and returns a list of 5 similar books with their distances from the book argument. +创建一个名为 `get_recommends` 的函数,它将书名(来自数据集)作为参数,并返回 5 本书的列表以及它们与书参数的距离。 -This code: +这个代码: ```py get_recommends("The Queen of the Damned (Vampire Chronicles (Paperback))") ``` -should return: +应该返回: ```py [ @@ -45,15 +45,15 @@ should return: ] ``` -Notice that the data returned from `get_recommends()` is a list. The first element in the list is the book title passed into the function. The second element in the list is a list of five more lists. Each of the five lists contains a recommended book and the distance from the recommended book to the book passed into the function. +请注意,从 `get_recommends()` 返回的数据是一个列表。 列表中的第一个元素是传递给函数的书名。 列表中的第二个元素是另外五个列表的列表。 五个列表中的每一个都包含一本推荐书以及从推荐书到传递给函数的书的距离。 -If you graph the dataset (optional), you will notice that most books are not rated frequently. To ensure statistical significance, remove from the dataset users with less than 200 ratings and books with less than 100 ratings. +如果你绘制数据集的图表(可选),你会注意到大多数书籍的评价并不频繁。 为了确保统计学上的显著性,从数据集中删除评分低于 200 的用户和评分低于 100 的书籍。 -The first three cells import libraries you may need and the data to use. The final cell is for testing. Write all your code in between those cells. +前三个单元格导入你可能需要的库和要使用的数据。 最后一个单元用于测试。 在这些单元格之间写下所有代码。 # --hints-- -It should pass all Python tests. +它应该通过所有的 Python 测试。 ```js diff --git a/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md b/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md index 3c0ea2a6d5e..d68bf071a0e 100644 --- a/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md +++ b/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md @@ -8,21 +8,21 @@ dashedName: cat-and-dog-image-classifier # --description-- -You will be working on this project with Google Colaboratory. +你将使用 Google Colaboratory 来完成这个项目。 -After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link." +进入该链接后,在你自己的账户或本地创建一个笔记本的副本。 一旦你完成项目并通过测试(包括在该链接),请在下面提交你的项目链接。 如果你提交的是 Google Colaboratory 的链接,请确保打开链接共享时选择 “anyone with the link”。 -We are still developing the interactive instructional content for the machine learning curriculum. For now, you can go through the video challenges in this certification. You may also have to seek out additional learning resources, similar to what you would do when working on a real-world project. +我们仍在开发机器学习课程的交互式课程部分。 现在,你可以通过这个认证中的视频挑战。 你可能还需要寻找额外的学习资源,类似于你在真实世界项目中的工作。 # --instructions-- -For this challenge, you will complete the code to classify images of dogs and cats. You will use TensorFlow 2.0 and Keras to create a convolutional neural network that correctly classifies images of cats and dogs at least 63% of the time. (Extra credit if you get it to 70% accuracy!) +在这个挑战中,你将完成代码,对狗和猫的图像进行分类。 你将使用 Tensorflow 2.0 和 Keras 创建一个卷积神经网络,该网络至少 63% 的时间可以正确分类猫和狗的图像。 (如果你能达到 70% 的准确率,可以加分!) -Some of the code is given to you but some code you must fill in to complete this challenge. Read the instruction in each text cell so you will know what you have to do in each code cell. +有些代码是给你的,但有些代码你必须填写才能完成这个挑战。 阅读每个文本单元中的指令,你就会知道你在每个代码单元中要做什么。 -The first code cell imports the required libraries. The second code cell downloads the data and sets key variables. The third cell is the first place you will write your own code. +第一个代码单元导入所需的库。 第二个代码单元下载数据并设置关键变量。 第三个单元格是你要写自己代码的第一个地方。 -The structure of the dataset files that are downloaded looks like this (You will notice that the test directory has no subdirectories and the images are not labeled): +下载的数据集文件的结构看起来是这样的(你会注意到,测试目录没有子目录,图像也没有标示)。 ```py cats_and_dogs @@ -35,20 +35,20 @@ cats_and_dogs |__ test: [1.jpg, 2.jpg ...] ``` -You can tweak epochs and batch size if you like, but it is not required. +如果你愿意,你可以调整历时和批次大小,但这不是必须的。 -The following instructions correspond to specific cell numbers, indicated with a comment at the top of the cell (such as `# 3`). +下面的指令对应于特定的单元格编号,在单元格的顶部用注释表示(如 `# 3`)。 ## Cell 3 -Now it is your turn! Set each of the variables in this cell correctly. (They should no longer equal `None`.) +现在轮到你了! 正确设置此单元格中的每个变量。 (它们不应再等于 `None`。) -Create image generators for each of the three image data sets (train, validation, test). Use `ImageDataGenerator` to read / decode the images and convert them into floating point tensors. Use the `rescale` argument (and no other arguments for now) to rescale the tensors from values between 0 and 255 to values between 0 and 1. +为三个图像数据集(训练、验证、测试)中的每一个创建图像生成器。 使用 `ImageDataGenerator` 读取/解码图像并将它们转换为浮点张量。 使用 `rescale` 参数(目前没有其他参数)将张量从 0 到 255 之间的值重新缩放到 0 到 1 之间的值。 -For the `*_data_gen` variables, use the `flow_from_directory` method. Pass in the batch size, directory, target size (`(IMG_HEIGHT, IMG_WIDTH)`), class mode, and anything else required. `test_data_gen` will be the trickiest one. For `test_data_gen`, make sure to pass in `shuffle=False` to the `flow_from_directory` method. This will make sure the final predictions stay is in the order that our test expects. For `test_data_gen` it will also be helpful to observe the directory structure. +对于 `*_data_gen` 变量,使用 `flow_from_directory` 方法。 传入批处理大小、目录、目标大小(`(IMG_HEIGHT, IMG_WIDTH)`)、类模式以及其他所需的内容。 `test_data_gen` 将是最棘手的一个。 对于 `test_data_gen`,确保将 `shuffle=False` 传递给 `flow_from_directory` 方法。 这将确保最终预测保持在我们的测试预期的顺序。 对于 `test_data_gen`,观察目录结构也很有帮助。 -After you run the code, the output should look like this: +运行代码后,输出应如下所示: ```py Found 2000 images belonging to 2 classes. @@ -58,51 +58,51 @@ Found 50 images belonging to 1 class. ## Cell 4 -The `plotImages` function will be used a few times to plot images. It takes an array of images and a probabilities list, although the probabilities list is optional. This code is given to you. If you created the `train_data_gen` variable correctly, then running this cell will plot five random training images. +`plotImages` 函数将多次用于绘制图像。 它需要一个图像数组和一个概率列表,尽管概率列表是可选的。 此代码已提供给你。 如果你正确地创建了 `train_data_gen` 变量,那么运行这个单元将绘制五个随机训练图像。 ## Cell 5 -Recreate the `train_image_generator` using `ImageDataGenerator`. +使用 `ImageDataGenerator` 重新创建 `train_image_generator`。 -Since there are a small number of training examples, there is a risk of overfitting. One way to fix this problem is by creating more training data from existing training examples by using random transformations. +由于训练样本数量很少,因此存在过度拟合的风险。 解决此问题的一种方法,是通过使用随机变换,从现有训练示例创建更多训练数据。 -Add 4-6 random transformations as arguments to `ImageDataGenerator`. Make sure to rescale the same as before. +添加 4-6 个随机变换作为 `ImageDataGenerator` 的参数。 确保重新缩放与以前相同。 ## Cell 6 -You don't have to do anything for this cell. `train_data_gen` is created just like before but with the new `train_image_generator`. Then, a single image is plotted five different times using different variations. +你无需为此单元做任何事情。 `train_data_gen` 与以前一样创建,但使用新的 `train_image_generator`。 然后,使用不同的变化对单个图像进行五次不同的绘制。 ## Cell 7 -In this cell, create a model for the neural network that outputs class probabilities. It should use the Keras Sequential model. It will probably involve a stack of Conv2D and MaxPooling2D layers and then a fully connected layer on top that is activated by a ReLU activation function. +在此单元格中,为输出类别概率的神经网络创建一个模型。 它应该使用 Keras Sequential 模型。 它可能会涉及一堆 Conv2D 和 MaxPooling2D 层,然后是一个由 ReLU 激活函数激活的全连接层。 -Compile the model passing the arguments to set the optimizer and loss. Also pass in `metrics=['accuracy']` to view training and validation accuracy for each training epoch. +编译模型并传递参数以设置优化器和损失。 同时传入 `metrics=['accuracy']` 以查看每个训练周期的训练和验证精度。 ## Cell 8 -Use the `fit` method on your `model` to train the network. Make sure to pass in arguments for `x`, `steps_per_epoch`, `epochs`, `validation_data`, and `validation_steps`. +使用 `model` 上的 `fit` 方法来训练网络。 确保为 `x`、`steps_per_epoch`、`epochs`、`validation_data` 和 `validation_steps` 传入参数。 ## Cell 9 -Run this cell to visualize the accuracy and loss of the model. +运行这个单元来观察模型的准确性和损失。 ## Cell 10 -Now it is time to use your model to predict whether a brand new image is a cat or a dog. +现在是时候使用你的模型,来预测一个全新的图像,是猫还是狗了。 -In this cell, get the probability that each test image (from `test_data_gen`) is a dog or a cat. `probabilities` should be a list of integers. +在此单元格中,获取每个测试图像(来自 `test_data_gen`)是狗或猫的概率。 `probabilities` 应该是一个整数列表。 -Call the `plotImages` function and pass in the test images and the probabilities corresponding to each test image. +调用 `plotImages` 函数并传入测试图像和每个测试图像对应的概率。 -After you run the cell, you should see all 50 test images with a label showing the percentage of "sure" that the image is a cat or a dog. The accuracy will correspond to the accuracy shown in the graph above (after running the previous cell). More training images could lead to a higher accuracy. +在你运行该单元后,你应该看到所有 50 张测试图像,并有一个标签显示该图像是猫还是狗的“确定”百分比。 准确度将对应于上图中显示的准确度(在运行上一个单元格之后)。 更多的训练图像可能会导致更高的准确性。 ## Cell 11 -Run this final cell to see if you passed the challenge or if you need to keep trying. +运行这个最后的单元格,看看你是否通过了挑战,或者你是否需要继续努力。 # --hints-- -It should pass all Python tests. +它应该通过所有的 Python 测试。 ```js diff --git a/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md b/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md index 1cf49022b61..386e643b4df 100644 --- a/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md +++ b/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md @@ -8,33 +8,33 @@ dashedName: linear-regression-health-costs-calculator # --description-- -You will be working on this project with Google Colaboratory. +你将使用 Google Colaboratory 来完成这个项目。 -After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link." +进入该链接后,在你自己的账户或本地创建一个笔记本的副本。 一旦你完成项目并通过测试(包括在该链接),请在下面提交你的项目链接。 如果你提交的是 Google Colaboratory 的链接,请确保打开链接共享时选择 “anyone with the link”。 -We are still developing the interactive instructional content for the machine learning curriculum. For now, you can go through the video challenges in this certification. You may also have to seek out additional learning resources, similar to what you would do when working on a real-world project. +我们仍在开发机器学习课程的交互式课程部分。 现在,你可以通过这个认证中的视频挑战。 你可能还需要寻找额外的学习资源,类似于你在真实世界项目中的工作。 # --instructions-- -In this challenge, you will predict healthcare costs using a regression algorithm. +在这个挑战中,你将使用回归算法预测医疗费用。 -You are given a dataset that contains information about different people including their healthcare costs. Use the data to predict healthcare costs based on new data. +你会得到一个数据集,其中包含不同人的信息,包括他们的医疗费用。 用数据来预测基于新数据的医疗费用。 -The first two cells of this notebook import libraries and the data. +此笔记本的前两个单元格导入库和数据。 -Make sure to convert categorical data to numbers. Use 80% of the data as the `train_dataset` and 20% of the data as the `test_dataset`. +确保将分类数据转换为数字。 将 80% 的数据用作 `train_dataset`,将 20% 的数据用作 `test_dataset`。 -`pop` off the "expenses" column from these datasets to create new datasets called `train_labels` and `test_labels`. Use these labels when training your model. +使用 `pop` 从这些数据集中移出“费用”列中,来创建名为 `train_labels` 和 `test_labels` 的新数据集。 训练模型时使用这些标签。 -Create a model and train it with the `train_dataset`. Run the final cell in this notebook to check your model. The final cell will use the unseen `test_dataset` to check how well the model generalizes. +创建一个模型并使用 `train_dataset` 对其进行训练。 运行本笔记本中的最后一个单元来检查你的模型。 最后一个单元格将使用看不见的 `test_dataset` 来检查模型的泛化程度。 -To pass the challenge, `model.evaluate` must return a Mean Absolute Error of under 3500. This means it predicts health care costs correctly within $3500. +要通过挑战,`model.evaluate` 必须返回低于 3500 的平均绝对误差。 这意味着它可以正确地预测医疗保健费用在 3500 美元以内。 -The final cell will also predict expenses using the `test_dataset` and graph the results. +最后一个单元格还将使用 `test_dataset` 预测费用并绘制结果图。 # --hints-- -It should pass all Python tests. +它应该通过所有 Python 测试。 ```js diff --git a/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md b/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md index 066dad631c7..fcbe5781d4d 100644 --- a/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md +++ b/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md @@ -8,25 +8,25 @@ dashedName: neural-network-sms-text-classifier # --description-- -You will be working on this project with Google Colaboratory. +你将使用 Google Colaboratory 来完成这个项目。 -After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link." +进入该链接后,在你自己的账户或本地创建一个笔记本的副本。 一旦你完成项目并通过测试(包括在该链接),请在下面提交你的项目链接。 如果你提交的是 Google Colaboratory 的链接,请确保打开链接共享时选择 “anyone with the link”。 -We are still developing the interactive instructional content for the machine learning curriculum. For now, you can go through the video challenges in this certification. You may also have to seek out additional learning resources, similar to what you would do when working on a real-world project. +我们仍在开发机器学习课程的交互式课程部分。 现在,你可以通过这个认证中的视频挑战。 你可能还需要寻找额外的学习资源,类似于你在真实世界项目中的工作。 # --instructions-- -In this challenge, you need to create a machine learning model that will classify SMS messages as either "ham" or "spam". A "ham" message is a normal message sent by a friend. A "spam" message is an advertisement or a message sent by a company. +在这个挑战中,你需要创建一个机器学习模型,将短信分类为 “ham” 或 “spam”。 “ham” 消息是朋友发送的正常消息。 “spam” 是一个公司发送的广告或信息。 -You should create a function called `predict_message` that takes a message string as an argument and returns a list. The first element in the list should be a number between zero and one that indicates the likeliness of "ham" (0) or "spam" (1). The second element in the list should be the word "ham" or "spam", depending on which is most likely. +你应该创建一个名为 `predict_message` 的函数,该函数接收一个消息字符串作为参数并返回一个列表。 列表中的第一个元素应该是一个介于 0 和 1 之间的数字,表示 “ham”(0)或 “spam”(1)的可能性。 列表中的第二个元素应该是单词 “ham” 或 “spam”,这取决于哪个最有可能。 -For this challenge, you will use the SMS Spam Collection dataset. The dataset has already been grouped into train data and test data. +对于这个挑战,你将使用 SMS Spam Collection 数据集。 数据集已经被分组为训练数据和测试数据。 -The first two cells import the libraries and data. The final cell tests your model and function. Add your code in between these cells. +前两个单元导入库和数据。 最后一个单元测试你的模型和功能。 在这些单元格之间添加你的代码。 # --hints-- -It should pass all Python tests. +它应该通过所有的 Python 测试。 ```js diff --git a/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md b/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md index 7f882a150f9..da205f1423b 100644 --- a/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md +++ b/curriculum/challenges/chinese/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md @@ -8,57 +8,57 @@ dashedName: rock-paper-scissors # --description-- -For this challenge, you will create a program to play Rock, Paper, Scissors. A program that picks at random will usually win 50% of the time. To pass this challenge your program must play matches against four different bots, winning at least 60% of the games in each match. +在这个挑战中,你将创建一个程序来玩石头、剪刀、布。 一个随机选取的程序通常会有 50% 的时间获胜。 要通过这一挑战,你的程序必须与四个不同的机器人进行对战,并达到至少 60% 胜率。 -You will be working on this project with our Replit starter code. +你将使用我们在 Replit 的初始化项目来完成这个项目。 -We are still developing the interactive instructional part of the machine learning curriculum. For now, you will have to use other resources to learn how to pass this challenge. +我们仍在开发机器学习课程的交互式课程部分。 现在,你需要使用其他资源来学习如何通过这一挑战。 # --instructions-- -In the file `RPS.py` you are provided with a function called `player`. The function takes an argument that is a string describing the last move of the opponent ("R", "P", or "S"). The function should return a string representing the next move for it to play ("R", "P", or "S"). +在文件 `RPS.py` 中,你会看到一个名为 `player` 的函数。 该函数接受一个参数,该参数是一个字符串,描述了对手的最后一步(“R”、“P” 或 “S”)。 该函数应返回一个字符串,表示它要播放的下一步动作(“R”、“P”或“S”)。 -A player function will receive an empty string as an argument for the first game in a match since there is no previous play. +玩家函数将接收一个空字符串作为比赛中第一场比赛的参数,因为之前没有比赛。 -The file `RPS.py` shows an example function that you will need to update. The example function is defined with two arguments (`player(prev_play, opponent_history = [])`). The function is never called with a second argument so that one is completely optional. The reason why the example function contains a second argument (`opponent_history = []`) is because that is the only way to save state between consecutive calls of the `player` function. You only need the `opponent_history` argument if you want to keep track of the opponent_history. +文件 `RPS.py` 显示了一个你需要更新的示例函数。 示例函数使用两个参数定义(`player(prev_play, opponent_history = [])`)。 该函数从不使用第二个参数调用,因此它是完全可选的。 示例函数包含第二个参数(`opponent_history = []`)的原因,是因为这是在连续调用 `player` 函数之间保存状态的唯一方法。 如果你想跟踪对手历史,你只需要 `opponent_history` 参数。 -*Hint: To defeat all four opponents, your program may need to have multiple strategies that change depending on the plays of the opponent.* +*提示:为了打败所有四个对手,你的程序可能需要有多种策略,这些策略会根据对手的棋局而改变。* -## Development +## 开发 -Do not modify `RPS_game.py`. Write all your code in `RPS.py`. For development, you can use `main.py` to test your code. +不要修改 `RPS_game.py`。 在 `RPS.py` 中编写所有代码。 对于开发,你可以使用 `main.py` 来测试你的代码。 -`main.py` imports the game function and bots from `RPS_game.py`. +`main.py` 从 `RPS_game.py` 导入游戏功能和机器人。 -To test your code, play a game with the `play` function. The `play` function takes four arguments: +要测试你的代码,请使用 `play` 函数玩游戏。 `play` 函数有四个参数: -- two players to play against each other (the players are actually functions) -- the number of games to play in the match -- an optional argument to see a log of each game. Set it to `True` to see these messages. +- 两个玩家互相对战(玩家实际上是函数) +- 比赛的比赛场数 +- 一个可选参数来查看每场比赛的日志。 将其设置为 `True` 以查看这些消息。 ```py play(player1, player2, num_games[, verbose]) ``` -For example, here is how you would call the function if you want `player` and `quincy` to play 1000 games against each other and you want to see the results of each game: +例如,如果你希望 `player` 和 `quincy` 互相对战 1000 场比赛,并且你想查看每场比赛的结果,你将这样调用该函数: ```py play(player, quincy, 1000, verbose=True) ``` -Click the "run" button and `main.py` will run. +单击“运行”按钮,`main.py` 将运行。 -## Testing +## 测试 -The unit tests for this project are in `test_module.py`. We imported the tests from `test_module.py` to `main.py` for your convenience. If you uncomment the last line in `main.py`, the tests will run automatically whenever you hit the "run" button. +这个项目的单元测试在 `test_module.py` 中。 为了你的方便,我们将测试从 `test_module.py` 导入到 `main.py`。 如果你移除 `main.py` 中最后一行的注释,则只要你点击“运行”按钮,测试就会自动运行。 -## Submitting +## 提交 -Copy your project's URL and submit it below. +复制项目的 URL 并在下面提交。 # --hints-- -It should pass all Python tests. +它应该通过所有的 Python 测试。 ```js diff --git a/curriculum/challenges/chinese/11-machine-learning-with-python/tensorflow/neural-networks-activation-functions.md b/curriculum/challenges/chinese/11-machine-learning-with-python/tensorflow/neural-networks-activation-functions.md index 935adc37e66..ac3a257ca8a 100644 --- a/curriculum/challenges/chinese/11-machine-learning-with-python/tensorflow/neural-networks-activation-functions.md +++ b/curriculum/challenges/chinese/11-machine-learning-with-python/tensorflow/neural-networks-activation-functions.md @@ -14,7 +14,7 @@ dashedName: neural-networks-activation-functions ## --text-- -Which activation function squishes values between -1 and 1? +哪个激活函数将值转换为在 -1 和 1 之间? ## --answers-- diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md index c1dd4df8750..73f70747f5b 100644 --- a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md @@ -7,7 +7,7 @@ dashedName: step-5 # --description-- -在 `.header` 元素下面,创建一个 `class` 设置为 `"gallery"` 的 `div` 元素。 这个 `div` 将作为相册的容器。 +Below your `.header` element, create a new `div` element and assign it a `class` of `gallery`. 这个 `div` 将作为相册的容器。 在该 `.gallery` 元素中,创建九个 `img` 元素。 diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md index aa044de71f3..ee088d679f6 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md @@ -17,7 +17,7 @@ You should use compound assignment to add the string `Right! You win 20 gold!` t assert.match(pick.toString(), /text\.innerText\s*\+=\s*('|")Right! You win 20 gold!\1/); ``` -You should use compound assignment add `20` to the value of `gold`. +You should use compound assignment to add `20` to the value of `gold`. ```js assert.match(pick.toString(), /gold\s*\+=\s*20/); diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/state-name-puzzle.md b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/state-name-puzzle.md index 841319d1bda..6ae83d11ec1 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/state-name-puzzle.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/rosetta-code/state-name-puzzle.md @@ -15,7 +15,7 @@ dashedName: state-name-puzzle Write a function to solve the challenge for a given array of actual U.S. state names, and for fictional state names. -The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `"from"` array should contain the original names and the `"to"` array should contain the resultant names. +The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `from` array should contain the original names and the `to` array should contain the resultant names. # --hints-- diff --git a/curriculum/challenges/espanol/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md b/curriculum/challenges/espanol/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md index 901e6258437..f51cb28731c 100644 --- a/curriculum/challenges/espanol/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md +++ b/curriculum/challenges/espanol/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md @@ -7,7 +7,7 @@ dashedName: step-5 # --description-- -Debajo de tu elemento `.header`, crea un nuevo elemento `div` y asígnale un `class` con el valor `"gallery"`. Este `div` actuará como contenedor de las imágenes de la galería. +Below your `.header` element, create a new `div` element and assign it a `class` of `gallery`. Este `div` actuará como contenedor de las imágenes de la galería. Dentro de ese elemento `.gallery`, crea nueve elementos `img`. diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md index df4f572ee5f..50d1fd11732 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md @@ -17,7 +17,7 @@ You should use compound assignment to add the string `Right! You win 20 gold!` t assert.match(pick.toString(), /text\.innerText\s*\+=\s*('|")Right! You win 20 gold!\1/); ``` -You should use compound assignment add `20` to the value of `gold`. +You should use compound assignment to add `20` to the value of `gold`. ```js assert.match(pick.toString(), /gold\s*\+=\s*20/); diff --git a/curriculum/challenges/german/10-coding-interview-prep/rosetta-code/state-name-puzzle.md b/curriculum/challenges/german/10-coding-interview-prep/rosetta-code/state-name-puzzle.md index 841319d1bda..6ae83d11ec1 100644 --- a/curriculum/challenges/german/10-coding-interview-prep/rosetta-code/state-name-puzzle.md +++ b/curriculum/challenges/german/10-coding-interview-prep/rosetta-code/state-name-puzzle.md @@ -15,7 +15,7 @@ dashedName: state-name-puzzle Write a function to solve the challenge for a given array of actual U.S. state names, and for fictional state names. -The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `"from"` array should contain the original names and the `"to"` array should contain the resultant names. +The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `from` array should contain the original names and the `to` array should contain the resultant names. # --hints-- diff --git a/curriculum/challenges/german/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md b/curriculum/challenges/german/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md index 396c7018c48..5c7df32233e 100644 --- a/curriculum/challenges/german/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md +++ b/curriculum/challenges/german/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md @@ -7,7 +7,7 @@ dashedName: step-5 # --description-- -Below your `.header` element, create a new `div` element and assign it a `class` of `"gallery"`. This `div` will act as a container for the gallery images. +Below your `.header` element, create a new `div` element and assign it a `class` of `gallery`. This `div` will act as a container for the gallery images. Inside that `.gallery` element, create nine `img` elements. diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md index aa044de71f3..ee088d679f6 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md @@ -17,7 +17,7 @@ You should use compound assignment to add the string `Right! You win 20 gold!` t assert.match(pick.toString(), /text\.innerText\s*\+=\s*('|")Right! You win 20 gold!\1/); ``` -You should use compound assignment add `20` to the value of `gold`. +You should use compound assignment to add `20` to the value of `gold`. ```js assert.match(pick.toString(), /gold\s*\+=\s*20/); diff --git a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/state-name-puzzle.md b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/state-name-puzzle.md index fcb7b68f6d7..6eb9fec20e4 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/state-name-puzzle.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/rosetta-code/state-name-puzzle.md @@ -15,7 +15,7 @@ dashedName: state-name-puzzle Scrivi una funzione per risolvere la sfida per un dato array di veri nomi di stati americani, e per nomi di stati fittizi. -La funzione dovrebbe restituire un array. Ogni elemento deve essere un oggetto in questa forma: `{"from":[],"to":[]}`. L'array `"from"` dovrebbe contenere i nomi originali e l'array `"to"` dovrebbe contenere i nomi risultanti. +La funzione dovrebbe restituire un array. Ogni elemento deve essere un oggetto in questa forma: `{"from":[],"to":[]}`. The `from` array should contain the original names and the `to` array should contain the resultant names. # --hints-- diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md index 41cd24b991f..bbd99011293 100644 --- a/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md @@ -7,7 +7,7 @@ dashedName: step-5 # --description-- -Al di sotto dell'elemento `.header`, crea un nuovo elemento `div` con un attributo `class` del valore di `gallery`. Questo `div` fungerà da contenitore per le immagini della galleria. +Below your `.header` element, create a new `div` element and assign it a `class` of `gallery`. Questo `div` fungerà da contenitore per le immagini della galleria. In quest'elemento `.gallery`, crea nove elementi `img`. diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md index 0ad9b25421d..06b1aa5cc06 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md @@ -17,7 +17,7 @@ You should use compound assignment to add the string `Right! You win 20 gold!` t assert.match(pick.toString(), /text\.innerText\s*\+=\s*('|")Right! You win 20 gold!\1/); ``` -You should use compound assignment add `20` to the value of `gold`. +You should use compound assignment to add `20` to the value of `gold`. ```js assert.match(pick.toString(), /gold\s*\+=\s*20/); diff --git a/curriculum/challenges/japanese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md b/curriculum/challenges/japanese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md index 699e816215e..df4f072bc32 100644 --- a/curriculum/challenges/japanese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md +++ b/curriculum/challenges/japanese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md @@ -15,7 +15,7 @@ dashedName: state-name-puzzle Write a function to solve the challenge for a given array of actual U.S. state names, and for fictional state names. -The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `"from"` array should contain the original names and the `"to"` array should contain the resultant names. +The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `from` array should contain the original names and the `to` array should contain the resultant names. # --hints-- diff --git a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md index 929dff53a89..1cbd75c713f 100644 --- a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md +++ b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md @@ -7,7 +7,7 @@ dashedName: step-5 # --description-- -Below your `.header` element, create a new `div` element and assign it a `class` of `"gallery"`. This `div` will act as a container for the gallery images. +Below your `.header` element, create a new `div` element and assign it a `class` of `gallery`. This `div` will act as a container for the gallery images. Inside that `.gallery` element, create nine `img` elements. diff --git a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e9928.md b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e9928.md index c78d7d590a6..d158e468602 100644 --- a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e9928.md +++ b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e9928.md @@ -7,11 +7,11 @@ dashedName: step-95 # --description-- -With CSS variables you can change values without searching everywhere in the stylesheet. Change the `--window-color1` value to `#bb99ff`. +CSS 変数を使用すると、スタイルシートの中をくまなく探す手間をかけずに値を変更できます。 `--window-color1` の値を `#bb99ff` に変更してください。 # --hints-- -You should change the value of `--window-color1` to `#bb99ff`. +`--window-color1` の値を `#bb99ff` に変更する必要があります。 ```js assert.equal(new __helpers.CSSHelp(document).getStyle(":root")?.getPropertyValue("--window-color1")?.trim(), "#bb99ff"); diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md index aa044de71f3..ee088d679f6 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md @@ -17,7 +17,7 @@ You should use compound assignment to add the string `Right! You win 20 gold!` t assert.match(pick.toString(), /text\.innerText\s*\+=\s*('|")Right! You win 20 gold!\1/); ``` -You should use compound assignment add `20` to the value of `gold`. +You should use compound assignment to add `20` to the value of `gold`. ```js assert.match(pick.toString(), /gold\s*\+=\s*20/); diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-125-palindromic-sums.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-125-palindromic-sums.md index dd12fdd0fad..cea3aca1f65 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-125-palindromic-sums.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-125-palindromic-sums.md @@ -12,10 +12,10 @@ O número palíndromo 595 é interessante, porque ele pode ser escrito como a so Existem exatamente onze palíndromos abaixo de mil que podem ser escritos como somas quadradas consecutivas. A soma destes palíndromos é 4164. Observe que $1 = 0^2 + 1^2$ não foi incluído pois este problema está interessado nos quadrados de inteiros positivos. -Find the sum of all the numbers less than the `limit` that are both palindromic and can be written as the sum of consecutive squares. +Calcule a soma de todos os números menores que `limit` que sejam palíndromos e que possam ser escritos como a soma de quadrados consecutivos. # --hints-- -`palindromicSums(100000000)` should return `2906969179`. +`palindromicSums(100000000)` deve retornar `2906969179`. ```js @@ -23,13 +23,13 @@ assert.strictEqual(palindromicSums(100000000), 2906969179); ``` -`palindromicSums(100)` should return `137`. +`palindromicSums(100)` deve retornar `137`. ```js assert.strictEqual(palindromicSums(100), 137); ``` -`palindromicSums(1000)` should return `4164`. +`palindromicSums(1000)` deve retornar `4164`. ```js assert.strictEqual(palindromicSums(1000),4164); diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md index 8b44d0e5775..9225df89da0 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/rosetta-code/state-name-puzzle.md @@ -15,7 +15,7 @@ dashedName: state-name-puzzle Escreva uma função para resolver o desafio para um array dado de nomes de estados dos EUA reais e para nomes de estados fictícios. -A função deve retornar um array. Cada elemento deve ser um objeto neste formato: `{"from":[],"to":[]}`. O array `"from"` deve conter os nomes originais e o array `"to"` deve conter os nomes resultantes. +A função deve retornar um array. Cada elemento deve ser um objeto neste formato: `{"from":[],"to":[]}`. O array `from` deve conter os nomes originais e o array `to` deve conter os nomes resultantes. # --hints-- diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md index 9e5edbac058..5b737983d46 100644 --- a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md @@ -7,7 +7,7 @@ dashedName: step-5 # --description-- -Abaixo do elemento `.header`, crie outro elemento `div` e atribua a ele uma `class` de `"gallery"`. Essa `div` atuará como um contêiner para as imagens da galeria. +Abaixo do elemento `.header`, crie outro elemento `div` e atribua a ele uma `class` de `gallery`. Essa `div` atuará como um contêiner para as imagens da galeria. Dentro de `.gallery`, crie nove elementos `img`. diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23d1c5f1c93161f3582ae.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23d1c5f1c93161f3582ae.md index 7d9867b26c7..3970f777b33 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23d1c5f1c93161f3582ae.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23d1c5f1c93161f3582ae.md @@ -1,24 +1,24 @@ --- id: 62a23d1c5f1c93161f3582ae -title: Step 6 +title: Passo 6 challengeType: 0 dashedName: step-6 --- # --description-- -Similar to your `#stats` element, your `#monsterStats` element needs two `span` elements. Give them the class `stat` and give the first element the text `Monster Name:` and the second the text `Health:`. After the text in each, add a `strong` element with an empty nested `span` element. +Semelhante ao elemento `#stats`, o elemento `#monsterStats` necessita de dois elementos `span`. Dê a eles a classe `stat` e dê ao primeiro elemento o texto `Monster Name:` e ao segundo o texto `Health:`. Após o texto de cada um, adicione um elemento `strong` com um elemento `span` vazio aninhado. # --hints-- -Your `monsterStats` element should have two `span` elements. +O elemento `monsterStats` deve ter dois elementos `span`. ```js const spans = document.querySelectorAll(`#monsterStats > span`); assert.equal(spans.length, 2); ``` -Your new `span` elements should both have a `class` value of `stat`. +Os novos elementos `span` devem ter um valor de `class` de `stat`. ```js const spans = document.querySelectorAll(`#monsterStats > span`); @@ -26,21 +26,21 @@ assert.equal(spans[0].className, 'stat'); assert.equal(spans[1].className, 'stat'); ``` -Your first `span` element should have the text `Monster Name:`. Make sure the spacing is correct. +O primeiro elemento `span` deve ter o texto `Monster Name:`. Certifique-se de que o espaçamento está correto. ```js const spans = document.querySelectorAll(`#monsterStats > span`); assert.equal(spans[0].innerText, 'Monster Name: '); ``` -Your second `span` element should have the text `Health:`. Make sure the spacing is correct. +O segundo elemento `span` deve ter o texto `Health:`. Certifique-se de que o espaçamento está correto. ```js const spans = document.querySelectorAll(`#monsterStats > span`); assert.equal(spans[1].textContent, 'Health: '); ``` -Your first `span` element should have a `strong` element with an empty nested `span` element. +O primeiro elemento `span` deve ter um elemento `strong` com um elemento `span` vazio aninhado. ```js const spans = document.querySelectorAll(`#monsterStats > span`); @@ -50,7 +50,7 @@ assert.exists(strong); assert.exists(span); ``` -Your second `span` element should have a `strong` element with an empty nested `span` element. +O segundo elemento `span` deve ter um elemento `strong` com um elemento `span` vazio aninhado. ```js const spans = document.querySelectorAll(`#monsterStats > span`); @@ -60,7 +60,7 @@ assert.exists(strong); assert.exists(span); ``` -Your `strong` and `span` elements should come after the text. +Os elementos `strong` e `span` devem vir após o texto. ```js const spans = document.querySelectorAll(`#monsterStats > span`); diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24190868ca51c0b6e83c7.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24190868ca51c0b6e83c7.md index deec272509f..115c68f2fab 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24190868ca51c0b6e83c7.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24190868ca51c0b6e83c7.md @@ -1,52 +1,52 @@ --- id: 62a24190868ca51c0b6e83c7 -title: Step 13 +title: Passo 13 challengeType: 0 dashedName: step-13 --- # --description-- -Hide your `#monsterStats` element for now. Do not change any of the other styling. +Oculte seu elemento `#monsterStats` por enquanto. Não mude nenhum outro estilo. # --hints-- -You should have a `#monsterStats` selector. +Você deve ter um seletor `#monsterStats`. ```js const monsterStats = new __helpers.CSSHelp(document).getStyle('#monsterStats'); assert.exists(monsterStats); ``` -Your `#monsterStats` selector should have a `display` property of `none`. +O seletor `#monsterStats` deve ter a propriedade `display` de `none`. ```js const display = new __helpers.CSSHelp(document).getStyle('#monsterStats')?.getPropertyValue('display'); assert.equal(display, 'none'); ``` -Your `#monsterStats` selector should have a `border` of `1px solid black`. +O seletor `#monsterStats` deve ter uma `border` de `1px solid black`. ```js const border = new __helpers.CSSHelp(document).getStyle('#monsterStats')?.getPropertyValue('border'); assert.equal(border, '1px solid black'); ``` -Your `#monsterStats` selector should have `5px` of padding. +O seletor `#monsterStats` deve ter `5px` de preenchimento. ```js const padding = new __helpers.CSSHelp(document).getStyle('#monsterStats')?.getPropertyValue('padding'); assert.equal(padding, '5px'); ``` -Your `#monsterStats` selector should have a `color` of `white`. +O seletor `#monsterStats` deve ter o atributo `color` com o valor `white`. ```js const color = new __helpers.CSSHelp(document).getStyle('#monsterStats')?.getPropertyValue('color'); assert.equal(color, 'white'); ``` -Your `#monsterStats` selector should have a `background-color` of `red`. +O seletor `#monsterStats` deve ter o atributo `background-color` com o valor `red`. ```js const background = new __helpers.CSSHelp(document).getStyle('#monsterStats')?.getPropertyValue('background-color'); diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b365f1cdeb33efc2502e.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b365f1cdeb33efc2502e.md index 63ecefac153..a93af9c4594 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b365f1cdeb33efc2502e.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b365f1cdeb33efc2502e.md @@ -1,25 +1,25 @@ --- id: 62a3b365f1cdeb33efc2502e -title: Step 23 +title: Passo 23 challengeType: 0 dashedName: step-23 --- # --description-- -You have been declaring your variables with the `var` keyword. However, in modern JavaScript it is best practice to use the `let` keyword instead. This fixes several unusual behaviors with `var` that can make your code difficult to debug. +Você vem declarando as variáveis com a palavra-chave `var`. No entanto, em JavaScript moderno, é a melhor prática usar a palavra-chave `let` em vez disso. Isso corrige vários comportamentos incomuns com `var` que podem tornar o código difícil de depurar. -Change all of your `var` keywords to `let`. +Altere todas as palavras-chave `var` para `let`. # --hints-- -You should not have any `var` keywords in your code. +Você não deve ter palavras-chave `var` no código. ```js assert.notMatch(code, /var/); ``` -You should use the `let` keyword to declare your `xp` variable. +Você deve usar a palavra-chave `let` para declarar a variável `xp`. ```js assert.match(code, /let xp/); diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c23e6b511f22ed71197a.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c23e6b511f22ed71197a.md index 6b26d69619b..6ff0fec5a08 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c23e6b511f22ed71197a.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c23e6b511f22ed71197a.md @@ -1,23 +1,23 @@ --- id: 62a7c23e6b511f22ed71197a -title: Step 49 +title: Passo 49 challengeType: 0 dashedName: step-49 --- # --description-- -You need to wrap the text `Store` in double quotes. Because your string is already wrapped in double quotes, you'll need to escape the quotes around `Store`. You can escape them with a backslash `\`. Here is an example: +Você precisa encapsular o texto `Store` com aspas duplas. Como a string já está entre aspas duplas, você precisará escapar as aspas duplas em `Store`. Você pode escapá-las com uma barra invertida `\`. Aqui está um exemplo: ```js const escapedString = "Naomi likes to play \"Zelda\" sometimes."; ``` -Wrap the text `Store` in double quotes within your `text.innerText` line. +Encapsule o texto `Store` com aspas duplas dentro da linha `text.innerText`. # --hints-- -You should wrap the text `Store` in double quotes. +Você deve encapsular o texto `Store` com aspas duplas. ```js assert.match(goTown.toString(), /text\.innerText\s*=\s*"You are in the town square. You see a sign that says \\"Store\\"."/); diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md index 7f2575cbb11..b3c63b5db69 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md @@ -1,25 +1,25 @@ --- id: 62a8c8cee8e5cf2e001789b4 -title: Step 84 +title: Passo 84 challengeType: 0 dashedName: step-84 --- # --description-- -The value of the `currentWeapon` variable corresponds to an index in the `weapons` array. The player starts with a `stick`, since `currentWeapon` starts at `0` and `weapons[0]` is the `stick` weapon. +O valor da variável `currentWeapon` corresponde a um índice no array `weapons`. O jogador começa com um `stick`, já que `currentWeapon` começa em `0` e `weapons[0]` é a arma `stick`. -In the `buyWeapon` function, add one to `currentWeapon` - the user is buying the next weapon in the `weapons` array. +Na função `buyWeapon`, adicione um a `currentWeapon` – o usuário está comprando a próxima arma no array `weapons`. # --hints-- -You should use compound assignment to add one to `currentWeapon`. +Você deve usar a atribuição composta para adicionar um a `currentWeapon`. ```js assert.match(buyWeapon.toString(), /currentWeapon\s*\+=\s*1/); ``` -Your `buyWeapon` function should increase `currentWeapon` by `1`. +A função `buyWeapon` deve aumentar `currentWeapon` em `1`. ```js gold = 30; @@ -28,7 +28,7 @@ buyWeapon(); assert.equal(currentWeapon, 1); ``` -Your code should be in your `if` statement. +O código deve estar na instrução `if`. ```js gold = 20; diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md index aa331ca8991..22548a63227 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md @@ -1,29 +1,29 @@ --- id: 62a8dfcf7fb1044d2f478fd1 -title: Step 111 +title: Passo 111 challengeType: 0 dashedName: step-111 --- # --description-- -Following the same pattern, use that code in the `fightBeast` and `fightDragon` functions. Remember that `beast` is at index `1` and `dragon` is at index `2`. Also remove the `console.log` call from your `fightDragon` function. +Seguindo o mesmo padrão, use esse código nas funções `fightBeast` e `fightDragon`. Lembre-se de que `beast` está no índice `1` e `dragon` está no índice `2`. Também remova a chamada a `console.log` da função `fightDragon`. # --hints-- -You should set `fighting` to `1` in your `fightBeast` function. +Você deve definir `fighting` como `1` na função `fightBeast`. ```js assert.match(fightBeast.toString(), /fighting\s*=\s*1;/); ``` -You should set `fighting` to `2` in your `fightDragon` function. +Você deve definir `fighting` como `2` na função `fightDragon`. ```js assert.match(fightDragon.toString(), /fighting\s*=\s*2;/); ``` -You should remove the `console.log` from your `fightDragon` function. +Você deve remover `console.log` da função `fightDragon`. ```js assert.notMatch(fightDragon.toString(), /console\.log/); diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e49f4df7af5ae2d7a616.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e49f4df7af5ae2d7a616.md index 687f2f04e57..51799b63852 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e49f4df7af5ae2d7a616.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e49f4df7af5ae2d7a616.md @@ -1,35 +1,35 @@ --- id: 62a8e49f4df7af5ae2d7a616 -title: Step 121 +title: Passo 121 challengeType: 0 dashedName: step-121 --- # --description-- -Set `monsterHealth` to `monsterHealth` minus the power of the player's current weapon. Remember you have the `currentWeapon` variable and the `power` property. +Defina `monsterHealth` como `monsterHealth` menos o poder da arma atual do jogador. Lembre-se de que você tem a variável `currentWeapon` e a propriedade `power`. # --hints-- -You should use compound assignment to modify the `monsterHealth` variable. +Você deve usar atribuição composta para modificar a variável `monsterHealth`. ```js assert.match(attack.toString(), /monsterHealth\s*-=/); ``` -You should use bracket notation with `currentWeapon` to access `weapons`. +Você deve usar notação de colchete com `currentWeapon` para acessar `weapons`. ```js assert.match(attack.toString(), /weapons\[currentWeapon\]/); ``` -You should use dot notation to access the `power` property of `weapons[currentWeapon]`. +Você deve usar notação de ponto para acessar a propriedade `power` de `weapons[currentWeapon]`. ```js assert.match(attack.toString(), /weapons\[currentWeapon\]\.power/); ``` -You should subtract the `power` of the current weapon from `monsterHealth`. +Você deve subtrair `power` da arma atual de `monsterHealth`. ```js assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power/); diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md index 97ce39a4821..05a98b8fc52 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md @@ -11,7 +11,7 @@ In your `attack` function, below the `health` variable create an `if` statement. # --hints-- -You should add an `if` statement which calls `isMonsterHit` in the condition. +Você deve adicionar uma instrução `if` que chama `isMonsterHit` à condição. ```js assert.match(attack.toString(), /if\s*\(\s*isMonsterHit\s*\(\s*\)/) diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md index aa044de71f3..ee088d679f6 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md @@ -17,7 +17,7 @@ You should use compound assignment to add the string `Right! You win 20 gold!` t assert.match(pick.toString(), /text\.innerText\s*\+=\s*('|")Right! You win 20 gold!\1/); ``` -You should use compound assignment add `20` to the value of `gold`. +You should use compound assignment to add `20` to the value of `gold`. ```js assert.match(pick.toString(), /gold\s*\+=\s*20/); diff --git a/curriculum/challenges/ukrainian/10-coding-interview-prep/rosetta-code/state-name-puzzle.md b/curriculum/challenges/ukrainian/10-coding-interview-prep/rosetta-code/state-name-puzzle.md index da2468a2898..8f6f7b614cf 100644 --- a/curriculum/challenges/ukrainian/10-coding-interview-prep/rosetta-code/state-name-puzzle.md +++ b/curriculum/challenges/ukrainian/10-coding-interview-prep/rosetta-code/state-name-puzzle.md @@ -15,7 +15,7 @@ dashedName: state-name-puzzle Write a function to solve the challenge for a given array of actual U.S. state names, and for fictional state names. -The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `"from"` array should contain the original names and the `"to"` array should contain the resultant names. +The function should return an array. Each element should be an object in this form: `{"from":[],"to":[]}`. The `from` array should contain the original names and the `to` array should contain the resultant names. # --hints-- diff --git a/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md b/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md index 88fc0e8d702..016e2641eae 100644 --- a/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md +++ b/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-css-flexbox-by-building-a-photo-gallery/61537c9eecea6a335db6da79.md @@ -7,7 +7,7 @@ dashedName: step-5 # --description-- -Під елементом `.header` створіть новий елемент `div` та призначте йому `class` зі значенням `"gallery"`. Цей `div` діятиме як контейнер для зображень галереї. +Below your `.header` element, create a new `div` element and assign it a `class` of `gallery`. Цей `div` діятиме як контейнер для зображень галереї. В цьому елементі `.gallery` створіть дев'ять елементів `img`. diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md index e62bc015ddf..d0558037a6d 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md @@ -17,7 +17,7 @@ You should use compound assignment to add the string `Right! You win 20 gold!` t assert.match(pick.toString(), /text\.innerText\s*\+=\s*('|")Right! You win 20 gold!\1/); ``` -You should use compound assignment add `20` to the value of `gold`. +You should use compound assignment to add `20` to the value of `gold`. ```js assert.match(pick.toString(), /gold\s*\+=\s*20/);