From e76c05d2cbd5dbd131405f8f5553a38153fdef93 Mon Sep 17 00:00:00 2001 From: Nitiema Allassane Date: Tue, 22 Apr 2025 09:41:33 +0000 Subject: [PATCH 1/3] Translate two missing sentences in the article 'promise-error-handling'. Issue #510 --- 1-js/11-async/04-promise-error-handling/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/11-async/04-promise-error-handling/article.md b/1-js/11-async/04-promise-error-handling/article.md index bd9d5ef8d..1d165acc8 100644 --- a/1-js/11-async/04-promise-error-handling/article.md +++ b/1-js/11-async/04-promise-error-handling/article.md @@ -102,7 +102,7 @@ Dans un `try...catch` classique nous pouvons analyser l'erreur et peut-être la Si nous utilisons `throw` dans `.catch`, alors le contrôle passe au gestionnaire d'erreur suivant qui est plus proche. Et si nous gérons l'erreur et finissons normalement, alors elle continue jusqu'au gestionnaire `.then` le plus proche. -In the example below the `.catch` successfully handles the error: +Dans l’exemple ci-dessous, le `.catch` gère correctement l’erreur: ```js run // l'exécution: catch -> then @@ -149,7 +149,7 @@ new Promise((resolve, reject) => { }); ``` -The execution jumps from the first `.catch` `(*)` to the next one `(**)` down the chain. +L’exécution passe du premier `.catch` `(*)` au suivant `(**)` plus bas dans la chaîne. ## Rejets non traités From 323293648b9dc33b9638b624db1b50cec29fa054 Mon Sep 17 00:00:00 2001 From: Nitiema Allassane Date: Tue, 22 Apr 2025 19:32:31 +0000 Subject: [PATCH 2/3] =?UTF-8?q?translate=20Promise.any=20section=20into=20?= =?UTF-8?q?French=20=E2=80=93=20Issue=20#501?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1-js/11-async/05-promise-api/article.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/1-js/11-async/05-promise-api/article.md b/1-js/11-async/05-promise-api/article.md index dfc3ae573..22fb6708a 100644 --- a/1-js/11-async/05-promise-api/article.md +++ b/1-js/11-async/05-promise-api/article.md @@ -219,15 +219,15 @@ La première promesse a été la plus rapide, donc, elle est devenue le résulta ## Promise.any -Similar to `Promise.race`, but waits only for the first fulfilled promise and gets its result. If all of the given promises are rejected, then the returned promise is rejected with [`AggregateError`](mdn:js/AggregateError) - a special error object that stores all promise errors in its `errors` property. +Semblable à `Promise.race`, mais attend uniquement la première promesse résolue et récupère son résultat. Si toutes les promesses données sont rejetées, alors la promesse retournée est rejetée avec un [`AggregateError`](mdn:js/AggregateError) - un objet d'erreur spécial qui stocke toutes les erreurs des promesses dans sa propriété `errors`. -The syntax is: +La syntaxe est : ```js let promise = Promise.any(iterable); ``` -For instance, here the result will be `1`: +Par exemple, ici le résultat sera `1` : ```js run Promise.any([ @@ -237,9 +237,9 @@ Promise.any([ ]).then(alert); // 1 ``` -The first promise here was fastest, but it was rejected, so the second promise became the result. After the first fulfilled promise "wins the race", all further results are ignored. +La première promesse ici a été la plus rapide, mais elle a été rejetée, donc la deuxième promesse est devenue le résultat. Une fois que la première promesse remplie "remporte la course", tous les résultats suivants sont ignorés. -Here's an example when all promises fail: +Voici un exemple où toutes les promesses échouent : ```js run Promise.any([ @@ -252,7 +252,7 @@ Promise.any([ }); ``` -As you can see, error objects for failed promises are available in the `errors` property of the `AggregateError` object. +Comme vous pouvez le voir, les objets d’erreur des promesses échouées sont disponibles dans la propriété `errors` de l’objet `AggregateError`. ## Promise.resolve/reject From 85721b02f12d9c274bfff83cfebe82b2ed12ef1c Mon Sep 17 00:00:00 2001 From: Nitiema Allassane Date: Wed, 23 Apr 2025 02:29:47 +0000 Subject: [PATCH 3/3] Traduction de quelques phrases pas encore traduites dans l'artcle 'Promisification: Issue: #501' --- 1-js/11-async/06-promisify/article.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/1-js/11-async/06-promisify/article.md b/1-js/11-async/06-promisify/article.md index eae87a9b4..5fa9ec486 100644 --- a/1-js/11-async/06-promisify/article.md +++ b/1-js/11-async/06-promisify/article.md @@ -31,7 +31,7 @@ Nous allons créer une nouvelle fonction `loadScriptPromise(src)`, qui fait la m En d'autres termes, nous le transmettons uniquement `src` (pas de `callback`) et obtenons une promesse en retour, qui se résout avec `script` lorsque le chargement est réussi, et sinon rejette avec l'erreur. -Here it is: +Voici : ```js let loadScriptPromise = function(src) { return new Promise((resolve, reject) => { @@ -56,9 +56,9 @@ Nous l'appellerons `promisify (f)` : il accepte une fonction à promettre `f` et ```js function promisify(f) { - return function (...args) { // return a wrapper-function (*) + return function (...args) { // retourne une fonction enveloppante (*) return new Promise((resolve, reject) => { - function callback(err, result) { // our custom callback for f (**) + function callback(err, result) { // notre fonction de rappel personnalisée pour f (**) if (err) { reject(err); } else {