-
Notifications
You must be signed in to change notification settings - Fork 1
Relecture state.md
#8
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
Conversation
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merci pour la PR ~
Quelques remarques notamment sur la traduction de state
et de store
. Je ne sais plus si on s'était mis d'accord sur une traduction FR de ces termes-là ou non.
D'ailleurs, ça serait bien de les rajouter ici vuejs-fr/v2.vuejs.org#4
docs/en/state.md
Outdated
@@ -2,16 +2,16 @@ | |||
|
|||
### Single State Tree | |||
|
|||
Vuex uses a **single state tree** - that is, this single object contains all your application level state and serves as the "single source of truth". This also means usually you will have only one store for each application. A single state tree makes it straightforward to locate a specific piece of state, and allows us to easily take snapshots of the current app state for debugging purposes. | |||
Vuex utilise un **single state tree** — cet unique objet contient tout le state au niveau applicatif et sert de "source unique de vérité". Cela signifie également que vous n'aurez qu'un seul store pour chaque application. Un _single state tree_ rend rapide la localisation d'une partie de state spécifique, et nous permet de facilement prendre des instantanés du state actuel de l'application à des fins de debugging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contient tout l'état
vous n'aurez qu'un seul gestionnaire d'état
une partie d'état spécifique
des instantanés de l'état actuel
docs/en/state.md
Outdated
|
||
The single state tree does not conflict with modularity - in later chapters we will discuss how to split your state and mutations into sub modules. | ||
Le _single state tree_ n'entre pas en conflit avec la modularité — dans les prochains chapitres, nous examinerons comment séparer votre state et vos mutations dans des sous-modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
votre état
docs/en/state.md
Outdated
|
||
### Getting Vuex State into Vue Components | ||
### Récupérer le state Vuex dans des composants Vue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Récupérer l'état
docs/en/state.md
Outdated
|
||
So how do we display state inside the store in our Vue components? Since Vuex stores are reactive, the simplest way to "retrieve" state from it is simply returning some store state from within a [computed property](http://vuejs.org/guide/computed.html): | ||
Alors, comment affichons-nous le state du store dans nos composants Vue ? Puisque les stores Vuex sont réactifs, la façon la plus simple d'y "récupérer" le state est de simplement retourner une partie du state depuis une [computed property](http://vuejs.org/guide/computed.html) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state/store
docs/en/state.md
Outdated
@@ -43,7 +43,7 @@ const app = new Vue({ | |||
}) | |||
``` | |||
|
|||
By providing the `store` option to the root instance, the store will be injected into all child components of the root and will be available on them as `this.$store`. Let's update our `Counter` implementation: | |||
En fournissant l'option `store` à l'instance racine, le store sera injecté dans tous les composants enfants de la racine et sera disponible sur ceux-ci avec `this.$store`. Mettons à jours notre implémentation de `Counter` : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sur ces derniers
Mettons à jour
docs/en/state.md
Outdated
@@ -2,16 +2,16 @@ | |||
|
|||
### Single State Tree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arbre d'état unique
docs/en/state.md
Outdated
@@ -2,16 +2,16 @@ | |||
|
|||
### Single State Tree | |||
|
|||
Vuex uses a **single state tree** - that is, this single object contains all your application level state and serves as the "single source of truth". This also means usually you will have only one store for each application. A single state tree makes it straightforward to locate a specific piece of state, and allows us to easily take snapshots of the current app state for debugging purposes. | |||
Vuex utilise un **single state tree** — cet unique objet contient tout le state au niveau applicatif et sert de "source unique de vérité". Cela signifie également que vous n'aurez qu'un seul store pour chaque application. Un _single state tree_ rend rapide la localisation d'une partie de state spécifique, et nous permet de facilement prendre des instantanés du state actuel de l'application à des fins de debugging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vuex utilise un arbre d'état unique, c'est-à-dire que
tout l'état
« source de vérité unique »
Un arbre d'état unique rend la localisation d'une partie spécifique de l'état rapide et permet
de l'état
débogage
docs/en/state.md
Outdated
|
||
The single state tree does not conflict with modularity - in later chapters we will discuss how to split your state and mutations into sub modules. | ||
Le _single state tree_ n'entre pas en conflit avec la modularité — dans les prochains chapitres, nous examinerons comment séparer votre state et vos mutations dans des sous-modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L'arbre d'état unique
modularité. Dans
votre état et vos mutations
docs/en/state.md
Outdated
|
||
### Getting Vuex State into Vue Components | ||
### Récupérer le state Vuex dans des composants Vue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Récupération d'état Vuex dans des composants Vue
docs/en/state.md
Outdated
|
||
So how do we display state inside the store in our Vue components? Since Vuex stores are reactive, the simplest way to "retrieve" state from it is simply returning some store state from within a [computed property](http://vuejs.org/guide/computed.html): | ||
Alors, comment affichons-nous le state du store dans nos composants Vue ? Puisque les stores Vuex sont réactifs, la façon la plus simple d'y "récupérer" le state est de simplement retourner une partie du state depuis une [computed property](http://vuejs.org/guide/computed.html) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/en/state.md
Outdated
'count' | ||
]) | ||
``` | ||
|
||
### Object Spread Operator | ||
|
||
Note that `mapState` returns an object. How do we use it in combination with other local computed properties? Normally, we'd have to use a utility to merge multiple objects into one so that we can pass the final object to `computed`. However with the [object spread operator](https://github.com/sebmarkbage/ecmascript-rest-spread) (which is a stage-3 ECMAScript proposal), we can greatly simplify the syntax: | ||
Notez que `mapState` renvoie un objet. Comment l'utiliser en complément des autres computed properties locales ? Normalement, il faudrait utiliser un outil pour fusionner les multiples objets en un seul afin de passer cet objet final à `computed`. Cependant avec le [object spread operator](https://github.com/sebmarkbage/ecmascript-rest-spread) (qui est une proposition stage-3 ECMASCript), nous pouvons grandement simplifier la syntaxe : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
propriétés calculées
docs/en/state.md
Outdated
'count' | ||
]) | ||
``` | ||
|
||
### Object Spread Operator | ||
|
||
Note that `mapState` returns an object. How do we use it in combination with other local computed properties? Normally, we'd have to use a utility to merge multiple objects into one so that we can pass the final object to `computed`. However with the [object spread operator](https://github.com/sebmarkbage/ecmascript-rest-spread) (which is a stage-3 ECMAScript proposal), we can greatly simplify the syntax: | ||
Notez que `mapState` renvoie un objet. Comment l'utiliser en complément des autres computed properties locales ? Normalement, il faudrait utiliser un outil pour fusionner les multiples objets en un seul afin de passer cet objet final à `computed`. Cependant avec le [object spread operator](https://github.com/sebmarkbage/ecmascript-rest-spread) (qui est une proposition stage-3 ECMASCript), nous pouvons grandement simplifier la syntaxe : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/en/state.md
Outdated
|
||
``` js | ||
computed: { | ||
localComputed () { /* ... */ }, | ||
// mix this into the outer object with the object spread operator | ||
// rajouter cet objet dans l'objet `computed` avec l'object spread operator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l'opérateur de décomposition
docs/en/state.md
Outdated
...mapState({ | ||
// ... | ||
}) | ||
} | ||
``` | ||
|
||
### Components Can Still Have Local State | ||
### Les composants peuvent toujours avoir un state local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
état local
docs/en/state.md
Outdated
|
||
Using Vuex doesn't mean you should put **all** the state in Vuex. Although putting more state into Vuex makes your state mutations more explicit and debuggable, sometimes it could also make the code more verbose and indirect. If a piece of state strictly belongs to a single component, it could be just fine leaving it as local state. You should weigh the trade-offs and make decisions that fit the development needs of your app. | ||
Utiliser Vuex ne signifie pas que vous devez mettre **tout** votre state dans Vuex. Bien que le fait de mettre plus de state dans Vuex rende vos mutations de state plus explicites et plus debuggables, parfois il peut aussi rendre le code plus verbeux et indirect. Si une partie de state appartient directement à un seul composant, il est parfaitement sain de la laisser dans le state local. Assurez vous de prendre en compte les avantages et inconvénients d'une telle décision afin de vous adaptez le mieux aux besoins de votre application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
votre état
plus d'état dans Vuex
mutation d'état
debogable
d'état appartient
l'état local
de vous adapter au mieux aux besoins de votre application.
Merci @Kocal, il y a juste store qu'on va conserver tel quel étant donné qu'on a pris le parti de ne pas le traduire. Je te laisse approuver :) |
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
Relecture du fichier state.md