chore: manual translations (#42811)

This commit is contained in:
Nicholas Carrigan (he/him)
2021-07-09 21:23:54 -07:00
committed by GitHub
parent a3395269a0
commit c4fd49e5b7
806 changed files with 8935 additions and 4378 deletions

View File

@@ -11,7 +11,7 @@ dashedName: exercise-tracker
Build a full stack JavaScript app that is functionally similar to this: <https://exercise-tracker.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-exercisetracker/) and complete your project locally.
- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-exercisetracker) to complete your project.
- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-exercisetracker) to complete your project.
- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
@@ -29,12 +29,12 @@ You should provide your own project, not the example URL.
};
```
You can `POST` to `/api/exercise/new-user` with form data `username` to create a new user. The returned response will be an object with `username` and `_id` properties.
You can `POST` to `/api/users` with form data `username` to create a new user. The returned response will be an object with `username` and `_id` properties.
```js
async (getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/exercise/new-user', {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
@@ -49,12 +49,12 @@ async (getUserInput) => {
};
```
You can make a `GET` request to `api/exercise/users` to get an array of all users. Each element in the array is an object containing a user's `username` and `_id`.
You can make a `GET` request to `/api/users` to get an array of all users. Each element in the array is an object containing a user's `username` and `_id`.
```js
async (getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/exercise/users');
const res = await fetch(url + '/api/users');
if (res.ok) {
const data = await res.json();
assert.isArray(data);
@@ -66,12 +66,12 @@ async (getUserInput) => {
};
```
You can `POST` to `/api/exercise/add` with form data `userId=_id`, `description`, `duration`, and optionally `date`. If no date is supplied, the current date will be used. The response returned will be the user object with the exercise fields added.
You can `POST` to `/api/users/:_id/exercises` with form data `description`, `duration`, and optionally `date`. If no date is supplied, the current date will be used. The response returned will be the user object with the exercise fields added.
```js
async (getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/exercise/new-user', {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
@@ -85,10 +85,10 @@ async (getUserInput) => {
_id,
date: 'Mon Jan 01 1990'
};
const addRes = await fetch(url + '/api/exercise/add', {
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}&date=1990-01-01`
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-01`
});
if (addRes.ok) {
const actual = await addRes.json();
@@ -102,12 +102,12 @@ async (getUserInput) => {
};
```
You can make a `GET` request to `/api/exercise/log` with a parameter of `userId=_id` to retrieve a full exercise log of any user. The returned response will be the user object with a `log` array of all the exercises added. Each log item has the `description`, `duration`, and `date` properties.
You can make a `GET` request to `/api/users/:_id/logs` to retrieve a full exercise log of any user. The returned response will be the user object with a `log` array of all the exercises added. Each log item has the `description`, `duration`, and `date` properties.
```js
async (getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/exercise/new-user', {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
@@ -121,13 +121,13 @@ async (getUserInput) => {
_id,
date: new Date().toDateString()
};
const addRes = await fetch(url + '/api/exercise/add', {
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}`
body: `description=${expected.description}&duration=${expected.duration}`
});
if (addRes.ok) {
const logRes = await fetch(url + `/api/exercise/log?userId=${_id}`);
const logRes = await fetch(url + `/api/users/${_id}/logs`);
if (logRes.ok) {
const { log } = await logRes.json();
assert.isArray(log);
@@ -144,12 +144,12 @@ async (getUserInput) => {
};
```
A request to a user's log (`/api/exercise/log`) returns an object with a `count` property representing the number of exercises returned.
A request to a user's log (`/api/users/:_id/logs`) returns an object with a `count` property representing the number of exercises returned.
```js
async (getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/exercise/new-user', {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
@@ -163,13 +163,13 @@ async (getUserInput) => {
_id,
date: new Date().toDateString()
};
const addRes = await fetch(url + '/api/exercise/add', {
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}`
body: `description=${expected.description}&duration=${expected.duration}`
});
if (addRes.ok) {
const logRes = await fetch(url + `/api/exercise/log?userId=${_id}`);
const logRes = await fetch(url + `/api/users/${_id}/logs`);
if (logRes.ok) {
const { count } = await logRes.json();
assert(count);
@@ -185,12 +185,12 @@ async (getUserInput) => {
};
```
You can add `from`, `to` and `limit` parameters to a `/api/exercise/log` request to retrieve part of the log of any user. `from` and `to` are dates in `yyyy-mm-dd` format. `limit` is an integer of how many logs to send back.
You can add `from`, `to` and `limit` parameters to a `/api/users/:_id/logs` request to retrieve part of the log of any user. `from` and `to` are dates in `yyyy-mm-dd` format. `limit` is an integer of how many logs to send back.
```js
async (getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/exercise/new-user', {
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
@@ -204,19 +204,19 @@ async (getUserInput) => {
_id,
date: new Date().toDateString()
};
const addExerciseRes = await fetch(url + '/api/exercise/add', {
const addExerciseRes = await fetch(url + `/api/users/${_id}/exercises`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}&date=1990-01-01`
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-01`
});
const addExerciseTwoRes = await fetch(url + '/api/exercise/add', {
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `userId=${_id}&description=${expected.description}&duration=${expected.duration}&date=1990-01-02`
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-02`
});
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
const logRes = await fetch(
url + `/api/exercise/log?userId=${_id}&from=1989-12-31&to=1990-01-03`
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-03`
);
if (logRes.ok) {
const { log } = await logRes.json();
@@ -226,7 +226,7 @@ async (getUserInput) => {
throw new Error(`${logRes.status} ${logRes.statusText}`);
}
const limitRes = await fetch(
url + `/api/exercise/log?userId=${_id}&limit=1`
url + `/api/users/${_id}/logs?limit=1`
);
if (limitRes.ok) {
const { log } = await limitRes.json();

View File

@@ -11,7 +11,7 @@ dashedName: file-metadata-microservice
Build a full stack JavaScript app that is functionally similar to this: <https://file-metadata-microservice.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-filemetadata/) and complete your project locally.
- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-filemetadata) to complete your project.
- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-filemetadata) to complete your project.
- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field.

View File

@@ -11,7 +11,7 @@ dashedName: request-header-parser-microservice
Build a full stack JavaScript app that is functionally similar to this: <https://request-header-parser-microservice.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-headerparser/) and complete your project locally.
- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-headerparser) to complete your project.
- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-headerparser) to complete your project.
- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.

View File

@@ -11,7 +11,7 @@ dashedName: timestamp-microservice
Build a full stack JavaScript app that is functionally similar to this: <https://timestamp-microservice.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-timestamp/) and complete your project locally.
- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-timestamp) to complete your project.
- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-timestamp) to complete your project.
- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field.
@@ -28,11 +28,11 @@ You should provide your own project, not the example URL.
};
```
A request to `/api/timestamp/:date?` with a valid date should return a JSON object with a `unix` key that is a Unix timestamp of the input date in milliseconds
A request to `/api/:date?` with a valid date should return a JSON object with a `unix` key that is a Unix timestamp of the input date in milliseconds
```js
(getUserInput) =>
$.get(getUserInput('url') + '/api/timestamp/2016-12-25').then(
$.get(getUserInput('url') + '/api/2016-12-25').then(
(data) => {
assert.equal(
data.unix,
@@ -46,11 +46,11 @@ A request to `/api/timestamp/:date?` with a valid date should return a JSON obje
);
```
A request to `/api/timestamp/:date?` with a valid date should return a JSON object with a `utc` key that is a string of the input date in the format: `Thu, 01 Jan 1970 00:00:00 GMT`
A request to `/api/:date?` with a valid date should return a JSON object with a `utc` key that is a string of the input date in the format: `Thu, 01 Jan 1970 00:00:00 GMT`
```js
(getUserInput) =>
$.get(getUserInput('url') + '/api/timestamp/2016-12-25').then(
$.get(getUserInput('url') + '/api/2016-12-25').then(
(data) => {
assert.equal(
data.utc,
@@ -64,11 +64,11 @@ A request to `/api/timestamp/:date?` with a valid date should return a JSON obje
);
```
A request to `/api/timestamp/1451001600000` should return `{ unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }`
A request to `/api/1451001600000` should return `{ unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }`
```js
(getUserInput) =>
$.get(getUserInput('url') + '/api/timestamp/1451001600000').then(
$.get(getUserInput('url') + '/api/1451001600000').then(
(data) => {
assert(
data.unix === 1451001600000 &&
@@ -85,7 +85,7 @@ Your project can handle dates that can be successfully parsed by `new Date(date_
```js
(getUserInput) =>
$.get(getUserInput('url') + '/api/timestamp/05 October 2011').then(
$.get(getUserInput('url') + '/api/05 October 2011').then(
(data) => {
assert(
data.unix === 1317772800000 &&
@@ -102,12 +102,12 @@ If the input date string is invalid, the api returns an object having the struct
```js
(getUserInput) =>
$.get(getUserInput('url') + '/api/timestamp/this-is-not-a-date').then(
$.get(getUserInput('url') + '/api/this-is-not-a-date').then(
(data) => {
assert.equal(data.error.toLowerCase(), 'invalid date');
},
(xhr) => {
throw new Error(xhr.responseText);
assert(xhr.responseJSON.error.toLowerCase() === 'invalid date');
}
);
```
@@ -116,7 +116,7 @@ An empty date parameter should return the current time in a JSON object with a `
```js
(getUserInput) =>
$.get(getUserInput('url') + '/api/timestamp').then(
$.get(getUserInput('url') + '/api').then(
(data) => {
var now = Date.now();
assert.approximately(data.unix, now, 20000);
@@ -131,7 +131,7 @@ An empty date parameter should return the current time in a JSON object with a `
```js
(getUserInput) =>
$.get(getUserInput('url') + '/api/timestamp').then(
$.get(getUserInput('url') + '/api').then(
(data) => {
var now = Date.now();
var serverTime = new Date(data.utc).getTime();

View File

@@ -11,7 +11,7 @@ dashedName: url-shortener-microservice
Build a full stack JavaScript app that is functionally similar to this: <https://url-shortener-microservice.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-urlshortener/) and complete your project locally.
- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-urlshortener) to complete your project.
- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-urlshortener) to complete your project.
- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field.
@@ -34,26 +34,22 @@ You should provide your own project, not the example URL.
};
```
You can POST a URL to `/api/shorturl/new` and get a JSON response with `original_url` and `short_url` properties. Here's an example: `{ original_url : 'https://freeCodeCamp.org', short_url : 1}`
You can POST a URL to `/api/shorturl` and get a JSON response with `original_url` and `short_url` properties. Here's an example: `{ original_url : 'https://freeCodeCamp.org', short_url : 1}`
```js
async (getUserInput) => {
const url = getUserInput('url');
const urlVariable = Date.now();
const res = await fetch(url + '/api/shorturl/new/', {
const fullUrl = `${url}/?v=${urlVariable}`
const res = await fetch(url + '/api/shorturl', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `url=https://timestamp-microservice.freecodecamp.rocks/api/timestamp/${urlVariable}`
body: `url=${fullUrl}`
});
if (res.ok) {
const { short_url, original_url } = await res.json();
assert.isNotNull(short_url);
assert.match(
original_url,
new RegExp(
`https://timestamp-microservice.freecodecamp.rocks/api/timestamp/${urlVariable}`
)
);
assert.strictEqual(original_url, `${url}/?v=${urlVariable}`);
} else {
throw new Error(`${res.status} ${res.statusText}`);
}
@@ -66,11 +62,12 @@ When you visit `/api/shorturl/<short_url>`, you will be redirected to the origin
async (getUserInput) => {
const url = getUserInput('url');
const urlVariable = Date.now();
const fullUrl = `${url}/?v=${urlVariable}`
let shortenedUrlVariable;
const postResponse = await fetch(url + '/api/shorturl/new/', {
const postResponse = await fetch(url + '/api/shorturl', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `url=https://timestamp-microservice.freecodecamp.rocks/api/timestamp/${urlVariable}`
body: `url=${fullUrl}`
});
if (postResponse.ok) {
const { short_url } = await postResponse.json();
@@ -84,10 +81,7 @@ async (getUserInput) => {
if (getResponse) {
const { redirected, url } = getResponse;
assert.isTrue(redirected);
assert.strictEqual(
url,
`https://timestamp-microservice.freecodecamp.rocks/api/timestamp/${urlVariable}`
);
assert.strictEqual(url,fullUrl);
} else {
throw new Error(`${getResponse.status} ${getResponse.statusText}`);
}
@@ -99,7 +93,7 @@ If you pass an invalid URL that doesn't follow the valid `http://www.example.com
```js
async (getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/shorturl/new/', {
const res = await fetch(url + '/api/shorturl', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `url=ftp:/john-doe.org`