Skip to content

Commit

Permalink
chore(i18n,learn): processed translations (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
camperbot authored Jan 8, 2025
1 parent 7eca12f commit c321719
Show file tree
Hide file tree
Showing 159 changed files with 1,401 additions and 824 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ dashedName: step-24
你應該創建一個帶有類 `task``div` 元素。

```js
assert.match(code, /<div\s+class\s*=\s*('|")task\1/)
const splitted = code.split(/tasksContainer\s*\.\s*innerHTML\s*\+=\s*`/)[1]
const matched = __helpers.removeJSComments(splitted).match(/<div(?<attributes>.*?)>\s*<\/\s*div\s*>/);
assert.match(matched?.groups.attributes, /\s+class\s*=\s*('|")task\1(\s|$)/);
```
你的 `div` 元素應該具有 `id` `${id}`
```js
assert.match(code, /<div\s+class\s*=\s*('|")task\1\s*id\s*=\s*('|")\$\{id\}\2\s*>\s*<\/div>/)
const splitted = code.split(/tasksContainer\s*\.\s*innerHTML\s*\+=\s*`/)[1]
const matched = __helpers.removeJSComments(splitted).match(/<div(?<attributes>.*?)>\s*<\/\s*div\s*>/);
assert.match(matched?.groups.attributes, /\s+id\s*=\s*('|")\$\{id\}\1(\s|$)/);
```
# --seed--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ dashedName: word-problems

\- <a href="https://lyryx.com/subjects/business/business-mathematics/" target="_blank" rel="noopener noreferrer nofollow">《商業數學分步手冊(2021)》,作者 Jean-Paul Oliver</a>

\- <a href="https://openstax.org/details/books/algebra-and-trigonometry" target="_blank" rel="noopener noreferrer nofollow">《代數與三角學》,作者 Jay Abramson</a>
\- <a href="https://cdn.freecodecamp.org/curriculum/college-algebra/AlgebraAndTrigonometry-OP_1tE6R5r.pdf" target="_blank" rel="noopener noreferrer nofollow">Algebra and Trigonometry by Jay Abramson</a> - sourced from OpenStax under <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank">Creative Commons Attribution 4.0 International (CC BY 4.0)</a>

It is also possible to download the Algebra and Trigonometry textbook from the <a href="https://openstax.org/details/books/algebra-and-trigonometry" target="_blank" rel="noopener noreferrer nofollow">OpenStax website</a>. You will need to find the correct textbook and then download the PDF. The page numbers for the assignment are based on the first link for this book.

# --assignment--

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ dashedName: introduction-to-college-algebra-with-python

\- <a href="https://lyryx.com/subjects/business/business-mathematics/" target="_blank" rel="noopener noreferrer nofollow">《商業數學分步手冊(2021)》,作者 Jean-Paul Oliver</a>

\- <a href="https://openstax.org/details/books/algebra-and-trigonometry" target="_blank" rel="noopener noreferrer nofollow">《代數與三角學》,作者 Jay Abramson</a>
\- <a href="https://cdn.freecodecamp.org/curriculum/college-algebra/AlgebraAndTrigonometry-OP_1tE6R5r.pdf" target="_blank" rel="noopener noreferrer nofollow">Algebra and Trigonometry by Jay Abramson</a> - sourced from OpenStax under <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank">Creative Commons Attribution 4.0 International (CC BY 4.0)</a>

It is also possible to download the Algebra and Trigonometry textbook from the <a href="https://openstax.org/details/books/algebra-and-trigonometry" target="_blank" rel="noopener noreferrer nofollow">OpenStax website</a>. You will need to find the correct textbook and then download the PDF. The page numbers for the assignment are based on the first link for this book.

# --assignment--

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Because the IDEs are not installed correctly.

### --feedback--

TOm is not frustrated about instalation.
Tom is not frustrated about installation.

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Fulfill the user stories below and get all the tests to pass to complete the lab

**用戶需求:**

1. You should have a `getBookmarks` function that returns the `bookmarks` array stored in the local storage. If the `bookmarks` key has not been set yet, the `getBookmarks` function should return an empty array.
1. You should have a `getBookmarks` function that returns the `bookmarks` array stored in the local storage. If the `bookmarks` key has not been set yet, or it doesn't contain a valid array with bookmarks, the `getBookmarks` function should return an empty array.
1. The `bookmarks` key stored in the local storage should be an array of bookmark objects. Each bookmark object should have three keys: `name`, `category`, and `url`.
1. You should have a function named `displayOrCloseForm` that toggles the `hidden` class on `#main-section` and `#form-section`.
1. When you click `#add-bookmark-button`, you should update the inner text of `.category-name` to be the value of the selected option from `#category-dropdown` and call `displayOrCloseForm` to display the form section and hide the main section.
Expand All @@ -24,10 +24,10 @@ Fulfill the user stories below and get all the tests to pass to complete the lab
1. You should have a function named `displayOrHideCategory` that toggles the `hidden` class on `#main-section` and `#bookmark-list-section`.
1. When you click `#view-category-button`, you should update the inner text of `.category-name` to be the value of the selected option from `#category-dropdown`, modify the inner HTML of `#category-list` according to the user stories below, and call the `displayOrHideCategory` function.
1. If none of the bookmarks in local storage have the category, you should set the inner HTML of the `#category-list` to a `p` element with the text `No Bookmarks Found`.
1. If one or more bookmarks in local storage have the selected category you should add a radio button with `id` and `value` attributes set to the bookmark name to the `#category-list`'s inner HTML for each of those bookmarks.
1. If one or more bookmarks in local storage have the selected category, you should add a radio button with `id` and `value` attributes, and set to the bookmark name to the `#category-list`'s inner HTML for each of those bookmarks. Additionally, each radio button should have the same `name` attribute.
1. Each radio button should have a corresponding label containing an anchor element with the bookmark name and the `href` attribute set to the bookmark URL.
1. When you click `#close-list-button`, you should run your function to hide the `#bookmark-list-section` and display the main section.
1. When you click `#delete-bookmark-button`, you should delete the bookmark corresponding to the selected radio button from the local storage and update the displayed bookmark list.
1. When you click the `#close-list-button`, you should run your function to hide the `#bookmark-list-section` and display the main section.
1. When you click the `#delete-bookmark-button`, you should delete the bookmark corresponding to the selected radio button and appropriate category from the local storage and update the displayed bookmark list.

# --hints--

Expand Down Expand Up @@ -69,6 +69,24 @@ try {
}
```

When the `bookmarks` key in the `localStorage` does not contain a valid array of bookmark objects, the `getBookmarks` function should return an empty array.

```js
try {
localStorage.setItem("bookmarks", 'invalid');
const arrayFromInvalidValue = getBookmarks();
assert.isArray(arrayFromInvalidValue);
assert.isEmpty(arrayFromInvalidValue);

localStorage.setItem("bookmarks", JSON.stringify([{name: "example1", category: "news", notUrl: "example1.com"}]));
const arrayFromInvalidArray = getBookmarks();
assert.isArray(arrayFromInvalidArray)
assert.isEmpty(arrayFromInvalidArray)
} finally {
resetLocalStorage();
}
```

You should have a function named `displayOrCloseForm`.

```js
Expand Down Expand Up @@ -201,7 +219,7 @@ try {
}
```

When you click `#view-category-button`, you should modify `#category-list`'s inner HTML by adding a radio button having the `id` and `value` attributes set to the bookmark name for each bookmark in the selected category.
When you click the `#view-category-button`, you should modify the `#category-list` element's inner HTML by adding a radio button. The radio button should have the `id` and `value` attributes set to the bookmark name for each bookmark in the selected category. Additionally, each radio button should have the same `name` attribute.

```js
try {
Expand All @@ -214,6 +232,8 @@ try {
assert.strictEqual(bookmarksDisplayed[0].value, "example1");
assert.strictEqual(bookmarksDisplayed[1].id, "example4");
assert.strictEqual(bookmarksDisplayed[1].value, "example4");
assert.isOk(bookmarksDisplayed[0].name)
assert.strictEqual(bookmarksDisplayed[0].name, bookmarksDisplayed[1].name);
} finally {
resetLocalStorage();
}
Expand Down Expand Up @@ -262,7 +282,49 @@ closeListButtonTest.dispatchEvent(new Event("click"));
assert.strictEqual(getHidden("bookmark list"), "bookmark list");
```

When you click `#delete-bookmark-button`, you should delete the bookmark corresponding to the selected radio button from the local storage and update the displayed bookmark list.
When you click the `#close-list-button` and then open any category, the `#category-list` should contain only data relevant for the selected category, without duplicating entries.

```js
setLocalStorage();
try {
categoryDropdownTest.value = "miscellaneous";
viewCategoryButtonTest.dispatchEvent(new Event("click"));
const categoryList = document.getElementById("category-list").innerHTML;
assert.strictEqual(categoryList, "<p>No Bookmarks Found</p>");

closeListButtonTest.dispatchEvent(new Event("click"));
categoryDropdownTest.value = "news";
viewCategoryButtonTest.dispatchEvent(new Event("click"));

const newsBookmarks = document.querySelectorAll('#category-list input[type="radio"]');
assert.lengthOf(newsBookmarks, 2);
assert.strictEqual(newsBookmarks[0].id, "example1");
assert.strictEqual(newsBookmarks[0].value, "example1");
assert.strictEqual(newsBookmarks[1].id, "example4");
assert.strictEqual(newsBookmarks[1].value, "example4");

closeListButtonTest.dispatchEvent(new Event("click"));
categoryDropdownTest.value = "work";
viewCategoryButtonTest.dispatchEvent(new Event("click"));

const workBookmarks = document.querySelectorAll('#category-list input[type="radio"]');
assert.lengthOf(workBookmarks, 1);
assert.strictEqual(workBookmarks[0].id, "example3");
assert.strictEqual(workBookmarks[0].value, "example3");

categoryDropdownTest.value = "miscellaneous";
viewCategoryButtonTest.dispatchEvent(new Event("click"));

const paragraphs = document.querySelectorAll("#category-list p");
assert.lengthOf(paragraphs, 1);
assert.strictEqual(paragraphs[0].innerText, "No Bookmarks Found");
} finally {
resetLocalStorage();
clearCategoryList();
}
```

When you click the `#delete-bookmark-button`, you should delete the bookmark corresponding to the selected radio button and appropriate category from the local storage and update the displayed bookmark list.

```js
setLocalStorage();
Expand All @@ -282,6 +344,16 @@ try {
const expected = [{name: "example2", category: "entertainment", url: "example2.com"}, {name: "example3", category: "work", url: "example3.com"}, {name: "example4", category: "news", url: "example4.com"}];
assert.deepEqual(getBookmarks(), expected);

localStorage.setItem("bookmarks", JSON.stringify([{name: "duplicated-name", category: "news", url: "example1.com"}, {name: "duplicated-name", category: "entertainment", url: "example2.com"}]));

categoryDropdownTest.value = "entertainment";
viewCategoryButtonTest.dispatchEvent(new Event("click"));
const radioForDuplicate = document.querySelector('#category-list input[type="radio"]');
radioForDuplicate.checked = true;

deleteBookmarkButtonTest.dispatchEvent(new Event("click"));

assert.deepEqual(getBookmarks(), [{name: "duplicated-name", category: "news", url: "example1.com"}])
} finally {
resetLocalStorage();
}
Expand Down Expand Up @@ -529,7 +601,26 @@ const addBookmarkButtonForm = document.getElementById("add-bookmark-button-form"
const categoryList = document.getElementById("category-list");
const closeListButton = document.getElementById("close-list-button");
const deleteBookmarkButton = document.getElementById("delete-bookmark-button");
const getBookmarks = () => JSON.parse(localStorage.getItem("bookmarks")) || [];

const getBookmarks = () => {
try {
const parsed = JSON.parse(localStorage.getItem("bookmarks"));
if (
Array.isArray(parsed) &&
parsed.every(
(item) =>
item.hasOwnProperty("category") &&
item.hasOwnProperty("name") &&
item.hasOwnProperty("url"),
)
) {
return parsed;
}
return [];
} catch {
return [];
}
};

const displayOrCloseForm = () => {
mainSection.classList.toggle("hidden");
Expand Down Expand Up @@ -570,12 +661,7 @@ const displayOrHideCategory = () => {
const fillBookmarkList = () => {
categoryHeading[1].innerText = categoryDropdown.value.charAt(0).toUpperCase()
+ categoryDropdown.value.slice(1);
const bookmarksToDisplay = getBookmarks().filter((i) => {
if (i.category === categoryDropdown.value) {
return true
}
return false
});
const bookmarksToDisplay = getBookmarks().filter((i) => i.category === categoryDropdown.value);
if (bookmarksToDisplay.length) {
categoryList.innerHTML = '';
for (const bookmark of bookmarksToDisplay) {
Expand Down Expand Up @@ -604,7 +690,7 @@ const deleteBookmark = () => {
for (const radioBookmark of radioBookmarks) {
if (radioBookmark.checked) {
const bookmarks = getBookmarks();
const indexToRemove = bookmarks.findIndex(i => i.name == radioBookmark.value);
const indexToRemove = bookmarks.findIndex(i => i.name == radioBookmark.value && i.category === categoryDropdown.value);
bookmarks.splice(indexToRemove, 1);
localStorage.setItem("bookmarks", JSON.stringify(bookmarks));
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ With `2024` as the value of the `year` variable, the `result` should be `2024 is
assert.strictEqual(isLeapYear(2024), '2024 is a leap year.');
```

With `2000` as the value of the `year` variable, the `result` should be `2000 is a leap year.`.

```js
assert.strictEqual(isLeapYear(2000), '2000 is a leap year.');
```

With `1900` as the value of the `year` variable, the `result` should be `1900 is not a leap year.`.

```js
Expand All @@ -74,7 +80,7 @@ assert.match(__helpers.removeJSComments(code), /isLeapYear\(\s*year\s*\)/);
You should store the result of calling the `isLeapYear` function in a variable named `result`.

```js
assert.match(__helpers.removeJSComments(code), /const\s+result\s*=\s*isLeapYear\(\s*year\s*\)/);
assert.match(__helpers.removeJSComments(code), /(?:var|let|const)\s+result\s*=\s*isLeapYear\(\s*year\s*\)/);
```

You should output the `result` to the console using `console.log()`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ for (let e of listItems) {
The anchor element of your first list item should wrap the text `Group Travels`.
```js
assert.equal(document.querySelectorAll('a')[0]?.innerText, 'Group Travels');
assert.equal(document.querySelectorAll('li > a')[0]?.innerText, 'Group Travels');
```
The anchor element of your second list item should wrap the text `Private Tours`.
```js
assert.equal(document.querySelectorAll('a')[1]?.innerText, 'Private Tours');
assert.equal(document.querySelectorAll('li > a')[1]?.innerText, 'Private Tours');
```
You should have an `h2` element after your unordered list.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,36 +86,36 @@ All of the above.

## --text--

What is the recommended strategy for pacing yourself through the freeCodeCamp certification coursework?
What makes each freeCodeCamp certification unique?

## --answers--

Code for several hours one day a week.
It has its own unique verification URL.

### --feedback--

Learning to code is a marathon, not a sprint.
Think about the features mentioned that verify authenticity and uniqueness.

---

Code for half an hour every day.

---

Complete all coursework in one month.
It has its own unique serial number.

### --feedback--

Learning to code is a marathon, not a sprint.
Think about the features mentioned that verify authenticity and uniqueness.

---

Work only on weekends.
It has its own QR code.

### --feedback--

Learning to code is a marathon, not a sprint.
Think about the features mentioned that verify authenticity and uniqueness.

---

All of the above.

## --video-solution--

2
4
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: 672d269da46786225e3fe3fd
title: What Is the Purpose of Functions, and How Do They Work?
challengeType: 11
videoId: sU2mIGNjBtc
videoId: maLeO3YCqxs
dashedName: what-is-the-purpose-of-functions-and-how-do-they-work
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,35 +86,35 @@ Remember, you can pass a second argument to the method to control where the sear

## --text--

What type of function is `indexOf` in JavaScript?
What type of method is `indexOf` in JavaScript?

## --answers--

A standalone function.

### --feedback--

Methods are functions that belong to specific objects in JavaScript.
Consider the type of object that deals with text in JavaScript.

---

A method of the `Array` object.
A method of the `Date` object.

### --feedback--

Methods are functions that belong to specific objects in JavaScript.
Consider the type of object that deals with text in JavaScript.

---

A method of the `String` object.

---

A mathematical function.
A method of the `Math` object.

### --feedback--

Methods are functions that belong to specific objects in JavaScript.
Consider the type of object that deals with text in JavaScript.

## --video-solution--

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Which selector is correct to target the next sibling of an `img`?

#### --text--

Which selector is correct to target all siblings of an `img`?
Which selector is correct to target all siblings preceded by an `img` element?

#### --distractors--

Expand Down
Loading

0 comments on commit c321719

Please sign in to comment.