Skip to content

Commit 92e839f

Browse files
authored
Merge pull request #673 from reactjs/l10n-fr-new-pages
RSC Reference pages
2 parents 14cda72 + b0be835 commit 92e839f

File tree

4 files changed

+113
-114
lines changed

4 files changed

+113
-114
lines changed

src/components/MDX/MDXComponents.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function CodeStep({children, step}: {children: any; step: number}) {
6060
}
6161

6262
const P = (p: JSX.IntrinsicElements['p']) => (
63-
<p className="whitespace-pre-wrap my-4" {...p} />
63+
<p className="whitespace-pre-wrap my-4 text-pretty" {...p} />
6464
);
6565

6666
const Strong = (strong: JSX.IntrinsicElements['strong']) => (
@@ -71,7 +71,7 @@ const OL = (p: JSX.IntrinsicElements['ol']) => (
7171
<ol className="ms-6 my-3 list-decimal" {...p} />
7272
);
7373
const LI = (p: JSX.IntrinsicElements['li']) => (
74-
<li className="leading-relaxed mb-1" {...p} />
74+
<li className="leading-relaxed mb-1 text-pretty" {...p} />
7575
);
7676
const UL = (p: JSX.IntrinsicElements['ul']) => (
7777
<ul className="ms-6 my-3 list-disc" {...p} />

src/content/reference/rsc/directives.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ canary: true
55

66
<Canary>
77

8-
Ces directives ne sont utiles que si vous [utilisez React Server Components](/learn/start-a-new-react-project#bleeding-edge-react-frameworks) ou créez une bibliothèque compatible avec eux.
8+
Ces directives ne sont utiles que si vous [utilisez les Composants Serveur](/learn/start-a-new-react-project#bleeding-edge-react-frameworks) ou créez une bibliothèque compatible avec eux.
99

1010
</Canary>
1111

1212
<Intro>
1313

14-
Les directives fournissent des instructions à destination des [*bundlers* compatibles avec React Server Components](/learn/start-a-new-react-project#bleeding-edge-react-frameworks).
14+
Les directives fournissent des instructions à destination des [*bundlers* compatibles avec les Composants Serveur](/learn/start-a-new-react-project#bleeding-edge-react-frameworks).
1515

1616
</Intro>
1717

src/content/reference/rsc/server-actions.md

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,41 @@
11
---
2-
title: Server Actions
2+
title: Actions Serveur
33
canary: true
44
---
55

6-
{/* FIXME:L10N */}
7-
86
<Intro>
97

10-
Server Actions allow Client Components to call async functions executed on the server.
8+
Les Actions Serveur permettent aux Composants Client d'appeler des fonctions asynchrones exécutées côté serveur.
119

1210
</Intro>
1311

1412
<InlineToc />
1513

1614
<Note>
1715

18-
#### How do I build support for Server Actions? {/*how-do-i-build-support-for-server-actions*/}
16+
#### Comment prendre en charge les Actions Serveur ? {/*how-do-i-build-support-for-server-actions*/}
1917

20-
While Server Actions in React 19 are stable and will not break between major versions, the underlying APIs used to implement Server Actions in a React Server Components bundler or framework do not follow semver and may break between minors in React 19.x.
18+
Même si les Actions Serveur dans React 19 sont stables et ne casseront pas la compatibilité entre les versions majeures, les API sous-jacentes utilisées pour implémenter les Actions Serveur au sein d'un *bundler* ou framework compatible avec les React Server Components ne suivent pas, elles, le versionnage sémantique et sont susceptibles de casser la compatibilité entre les versions mineures de React 19.x.
2119

22-
To support Server Actions as a bundler or framework, we recommend pinning to a specific React version, or using the Canary release. We will continue working with bundlers and frameworks to stabilize the APIs used to implement Server Actions in the future.
20+
Pour prendre en charge les Actions Serveur dans un *bundler* ou framework, nous vous conseillons de figer React sur une version spécifique, ou d'utiliser une version Canari. Nous allons continuer à collaborer avec les *bundlers* et frameworks pour stabiliser les API utilisées pour implémenter les Actions Serveur à l'avenir.
2321

2422
</Note>
2523

26-
When a Server Action is defined with the `"use server"` directive, your framework will automatically create a reference to the server function, and pass that reference to the Client Component. When that function is called on the client, React will send a request to the server to execute the function, and return the result.
24+
Lorsqu'une Action Serveur est définie au moyen d'une directive `"use server"`, votre framework crée automatiquement une référence à la fonction serveur, et la passe au Composant Client. Lorsque cette fonction sera appelée côté client, React réagira en envoyant une requête au serveur pour exécuter cette fonction, et en renvoyant le résultat.
2725

28-
Server Actions can be created in Server Components and passed as props to Client Components, or they can be imported and used in Client Components.
26+
Les Actions Serveur peuvent être créées dans les Composants Serveur et passées comme props à des Composants Client, ou peuvent être directement importées et utilisées dans des Composants Client.
2927

30-
### Creating a Server Action from a Server Component {/*creating-a-server-action-from-a-server-component*/}
28+
### Créer une Action Serveur à partir d'un Composant Serveur {/*creating-a-server-action-from-a-server-component*/}
3129

32-
Server Components can define Server Actions with the `"use server"` directive:
30+
Les Composants Serveur peuvent définir des Actions Serveur au moyen de la directive `"use server"` :
3331

3432
```js [[2, 7, "'use server'"], [1, 5, "createNoteAction"], [1, 12, "createNoteAction"]]
35-
// Server Component
33+
// Composant Serveur
3634
import Button from './Button';
3735

3836
function EmptyNote () {
3937
async function createNoteAction() {
40-
// Server Action
38+
// Action Serveur
4139
'use server';
4240

4341
await db.notes.create();
@@ -47,24 +45,24 @@ function EmptyNote () {
4745
}
4846
```
4947

50-
When React renders the `EmptyNote` Server Component, it will create a reference to the `createNoteAction` function, and pass that reference to the `Button` Client Component. When the button is clicked, React will send a request to the server to execute the `createNoteAction` function with the reference provided:
48+
Lorsque React affichera le Composant Serveur `EmptyNote`, il créera une référence à la fonction `createNoteAction` et passera cette référence au Composant Client `Button`. Lorsqu'on cliquera sur le bouton, React enverra la requête au serveur pour exécuter la fonction `createNoteAction` avec la référence fournie :
5149

5250
```js {5}
5351
"use client";
5452

5553
export default function Button({onClick}) {
5654
console.log(onClick);
5755
// {$$typeof: Symbol.for("react.server.reference"), $$id: 'createNoteAction'}
58-
return <button onClick={() => onClick()}>Create Empty Note</button>
56+
return <button onClick={() => onClick()}>Créer une note vide</button>
5957
}
6058
```
6159

62-
For more, see the docs for [`"use server"`](/reference/rsc/use-server).
60+
Pour en savoir plus, consultez la documentation de [`"use server"`](/reference/rsc/use-server).
6361

6462

65-
### Importing Server Actions from Client Components {/*importing-server-actions-from-client-components*/}
63+
### Importer des Actions Serveur depuis des Composants Client {/*importing-server-actions-from-client-components*/}
6664

67-
Client Components can import Server Actions from files that use the `"use server"` directive:
65+
Les Composants Client peuvent importer des Actions Serveur depuis des modules utilisant la directive `"use server"` :
6866

6967
```js [[1, 3, "createNoteAction"]]
7068
"use server";
@@ -75,7 +73,7 @@ export async function createNoteAction() {
7573

7674
```
7775

78-
When the bundler builds the `EmptyNote` Client Component, it will create a reference to the `createNoteAction` function in the bundle. When the `button` is clicked, React will send a request to the server to execute the `createNoteAction` function using the reference provided:
76+
Lorsque le *bundler* construit le Composant Client `EmptyNote`, il injecte dans le *bundle* une référence à la fonction `createNoteAction`. Lorsqu'on cliquera sur le `button`, React enverra une requête au serveur pour exécuter la fonction `createNoteAction` au moyen de la référence fournie :
7977

8078
```js [[1, 2, "createNoteAction"], [1, 5, "createNoteAction"], [1, 7, "createNoteAction"]]
8179
"use client";
@@ -88,18 +86,18 @@ function EmptyNote() {
8886
}
8987
```
9088

91-
For more, see the docs for [`"use server"`](/reference/rsc/use-server).
89+
Pour en savoir plus, consultez la documentation de [`"use server"`](/reference/rsc/use-server).
9290

93-
### Composing Server Actions with Actions {/*composing-server-actions-with-actions*/}
91+
### Composer les Actions Serveur au moyen des Actions {/*composing-server-actions-with-actions*/}
9492

95-
Server Actions can be composed with Actions on the client:
93+
Les Actions Serveur peuvent être composées avec des Actions côté client :
9694

9795
```js [[1, 3, "updateName"]]
9896
"use server";
9997

10098
export async function updateName(name) {
10199
if (!name) {
102-
return {error: 'Name is required'};
100+
return {error: 'Le nom est requis'};
103101
}
104102
await db.users.updateName(name);
105103
}
@@ -130,21 +128,21 @@ function UpdateName() {
130128
return (
131129
<form action={submitAction}>
132130
<input type="text" name="name" disabled={isPending}/>
133-
{state.error && <span>Failed: {state.error}</span>}
131+
{state.error && <span>Échec : {state.error}</span>}
134132
</form>
135133
)
136134
}
137135
```
138136

139-
This allows you to access the `isPending` state of the Server Action by wrapping it in an Action on the client.
137+
Ça vous permet d'accéder à l'état `isPending` de l'Action Serveur en l'enrobant dans une Action côté client.
140138

141-
For more, see the docs for [Calling a Server Action outside of `<form>`](/reference/rsc/use-server#calling-a-server-action-outside-of-form)
139+
Pour en savoir plus, allez lire [Appeler une Action Serveur hors d'un `<form>`](/reference/rsc/use-server#calling-a-server-action-outside-of-form).
142140

143-
### Form Actions with Server Actions {/*form-actions-with-server-actions*/}
141+
### Actions de formulaire et Actions Serveur {/*form-actions-with-server-actions*/}
144142

145-
Server Actions work with the new Form features in React 19.
143+
Les Actions Serveur peuvent interagir avec des fonctionnalités de formulaire de React 19.
146144

147-
You can pass a Server Action to a Form to automatically submit the form to the server:
145+
Vous pouvez passer une Action Serveur à un formulaire pour envoyer automatiquement le formulaire au serveur :
148146

149147

150148
```js [[1, 3, "updateName"], [1, 7, "updateName"]]
@@ -161,13 +159,13 @@ function UpdateName() {
161159
}
162160
```
163161

164-
When the Form submission succeeds, React will automatically reset the form. You can add `useActionState` to access the pending state, last response, or to support progressive enhancement.
162+
Lorsque l'envoi du formulaire aura réussi, React réinitialisera automatiquement le formulaire. Vous pouvez ajouter `useActionState` pour accéder à l'état d'attente, consulter la dernière réponse connue, ou prendre en charge l'amélioration progressive.
165163

166-
For more, see the docs for [Server Actions in Forms](/reference/rsc/use-server#server-actions-in-forms).
164+
Pour en savoir plus, allez lire [Les Actions Serveur dans les formulaires](/reference/rsc/use-server#server-actions-in-forms).
167165

168-
### Server Actions with `useActionState` {/*server-actions-with-use-action-state*/}
166+
### Actions Serveur et `useActionState` {/*server-actions-with-use-action-state*/}
169167

170-
You can compose Server Actions with `useActionState` for the common case where you just need access to the action pending state and last returned response:
168+
Vous pouvez composer des Actions Serveur avec `useActionState` pour le cas classique où vous avez juste besoin d'accéder à l'état en attente de l'action et à sa dernière réponse connue :
171169

172170
```js [[1, 3, "updateName"], [1, 6, "updateName"], [2, 6, "submitAction"], [2, 9, "submitAction"]]
173171
"use client";
@@ -180,19 +178,19 @@ function UpdateName() {
180178
return (
181179
<form action={submitAction}>
182180
<input type="text" name="name" disabled={isPending}/>
183-
{state.error && <span>Failed: {state.error}</span>}
181+
{state.error && <span>Échec : {state.error}</span>}
184182
</form>
185183
);
186184
}
187185
```
188186

189-
When using `useActionState` with Server Actions, React will also automatically replay form submissions entered before hydration finishes. This means users can interact with your app even before the app has hydrated.
187+
Lorsque vous utilisez `useActionState` avec des Actions Serveur, React rejoue automatiquement les envois de formulaire réalisés avant la fin de l'hydratation. Ça signifie que les utilisateurs peuvent interagir avec votre appli avant même qu'elle soit hydratée.
190188

191-
For more, see the docs for [`useActionState`](/reference/react-dom/hooks/useFormState).
189+
Pour en savoir plus, consultez la documentation de [`useActionState`](/reference/react-dom/hooks/useFormState).
192190

193-
### Progressive enhancement with `useActionState` {/*progressive-enhancement-with-useactionstate*/}
191+
### Amélioration progressive avec `useActionState` {/*progressive-enhancement-with-useactionstate*/}
194192

195-
Server Actions also support progressive enhancement with the third argument of `useActionState`.
193+
Les Actions Serveur prennent aussi en charge l'amélioration progressive grâce au troisième argument de `useActionState`.
196194

197195
```js [[1, 3, "updateName"], [1, 6, "updateName"], [2, 6, "/name/update"], [3, 6, "submitAction"], [3, 9, "submitAction"]]
198196
"use client";
@@ -210,6 +208,6 @@ function UpdateName() {
210208
}
211209
```
212210

213-
When the <CodeStep step={2}>permalink</CodeStep> is provided to `useActionState`, React will redirect to the provided URL if the form is submitted before the JavaScript bundle loads.
211+
Lorsqu'un <CodeStep step={2}>permalien</CodeStep> est fourni à `useActionState`, React redirigera sur l'URL fournie si le formulaire est envoyé avant que le *bundle* JavaScript soit chargé.
214212

215-
For more, see the docs for [`useActionState`](/reference/react-dom/hooks/useFormState).
213+
Apprenez-en davantage dans la documentation de [`useActionState`](/reference/react-dom/hooks/useFormState).

0 commit comments

Comments
 (0)