Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traduction de actions.md #12

Merged
merged 6 commits into from
May 23, 2017
Merged

Traduction de actions.md #12

merged 6 commits into from
May 23, 2017

Conversation

MachinisteWeb
Copy link
Member

C'est parti pour de l'action !

Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>

- Instead of mutating the state, actions commit mutations.
- Actions can contain arbitrary asynchronous operations.
- Au lieu de modifier le state, les actions committent des mutations.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modifier l'état

actent des

@@ -25,9 +25,9 @@ const store = new Vuex.Store({
})
```

Action handlers receive a context object which exposes the same set of methods/properties on the store instance, so you can call `context.commit` to commit a mutation, or access the state and getters via `context.state` and `context.getters`. We will see why this context object is not the store instance itself when we introduce [Modules](modules.md) later.
Les handlers d'action reçoivent un objet contexte qui expose le même set de méthodes/propriétés que l'instance du store, donc vous pouvez appeler `context.commit` pour commiter une mutation, ou accéder au state et aux getters via `context.state` et `context.getters`. Nous verrons pourquoi cet objet contexte n'est pas l'instance du store elle-même lorsque nous présenterons les [Modules](moduels.md) plus tard.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

les gestionnaires d'action

les mêmes méthodes/propriétés

acter une mutation

accéder à l'état et aux accesseurs

modules.md

@@ -37,15 +37,15 @@ actions: {
}
```

### Dispatching Actions
### Dispatcher des actions dans les composants
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Propager des

@@ -57,32 +57,31 @@ actions: {
}
```

Actions support the same payload format and object-style dispatch:
Les actions prennent en charge le même format de payload et *object-style dispatch* :
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

également en charge les paramètres additionnels (« payload ») et les objets pour propager :


``` js
// dispatch with a payload
// dispatcher avec un payload
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

propager avec un paramètre additionnel


### Dispatching Actions in Components
### Dispatcher des actions dans les composants
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Propager


You can dispatch actions in components with `this.$store.dispatch('xxx')`, or use the `mapActions` helper which maps component methods to `store.dispatch` calls (requires root `store` injection):
Vous pouvez dispatcher des actions dans les composants avec `this.$store.dispatch('xxx')`, ou en utilisant le helper `mapActions` qui attache les méthodes du composant aux appels de `store.dispatch` (nécessite l'injection de `store` à la racine) :
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pouvez propager

la fonction utilitaire


The first thing to know is that `store.dispatch` can handle Promise returned by the triggered action handler and it also returns Promise:
La première chose à savoir est que `store.dispatch` retourne la valeur retournée par le handler de l'action déclenchée, vous pouvez donc retourner une Promise :
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

peut gérer la Promesse (« Promise ») retournée par le gestionnaire d'action déclenché et par conséquent vous pouvez également retourner une Promesse :


``` js
// assuming getData() and getOtherData() return Promises
// sachant que getData() et getOtherData() retournent des Promises
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getData() et getOtherData()

Promesses

@@ -175,4 +175,4 @@ actions: {
}
```

> It's possible for a `store.dispatch` to trigger multiple action handlers in different modules. In such a case the returned value will be a Promise that resolves when all triggered handlers have been resolved.
> Il est possible pour un `store.dispatch` de déclencher plusieurs handlers d'action dans différents modules. Dans ce genre de cas, la valeur retournée sera une Promise qui se résoud quand tous les handlers déclenchés ont été résolus.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gestionnaires d'action

une Promesse

gestionnaires déclenchés

@@ -25,9 +25,9 @@ const store = new Vuex.Store({
})
```

Action handlers receive a context object which exposes the same set of methods/properties on the store instance, so you can call `context.commit` to commit a mutation, or access the state and getters via `context.state` and `context.getters`. We will see why this context object is not the store instance itself when we introduce [Modules](modules.md) later.
Les handlers d'action reçoivent un objet contexte qui expose le même set de méthodes/propriétés que l'instance du store, donc vous pouvez appeler `context.commit` pour commiter une mutation, ou accéder au state et aux getters via `context.state` et `context.getters`. Nous verrons pourquoi cet objet contexte n'est pas l'instance du store elle-même lorsque nous présenterons les [Modules](moduels.md) plus tard.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expose le même ensemble de méthodes/propriétés

elle-même, lorsque

@@ -94,11 +94,11 @@ actions: {
}
```

Note we are performing a flow of asynchronous operations, and recording the side effects (state mutations) of the action by committing them.
Notez que nous procédons à un flux d'opérations asynchrones, et enregistrons les effets de bord (mutation du state) de l'action en les committant.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

les actant

Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
@MachinisteWeb
Copy link
Member Author

Merci pour tes retours @Kocal, c'est dans la boite !

@MachinisteWeb MachinisteWeb merged commit ae44a29 into working May 23, 2017
@MachinisteWeb MachinisteWeb deleted the actions branch May 23, 2017 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants