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 advanced/scroll-behavior.md #11

Merged
merged 3 commits into from
May 27, 2017
Merged

Traduction de advanced/scroll-behavior.md #11

merged 3 commits into from
May 27, 2017

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented May 24, 2017

No description provided.

Copy link
Member

@MachinisteWeb MachinisteWeb left a comment

Choose a reason for hiding this comment

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

Génial ! Voice mes quelques retours !


When using client-side routing, we may want to scroll to top when navigating to a new route, or preserve the scrolling position of history entries just like real page reload does. `vue-router` allows you to achieve these and even better, allows you to completely customize the scroll behavior on route navigation.
En utilisant le routage côté client, nous pourrions vouloir défiler jusqu'au haut de la page lorsqu'on navigue à une nouvelle route, ou alors préserver la position du défilement des entrées de l'historique comme le ferait une page réelle. `vue-router` vous permet de faire cela et en mieux, ainsi que de changer le comportement du défilement pendant la navigation.
Copy link
Member

Choose a reason for hiding this comment

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

qu'au haut de page

ou

qu'en haut de la page

met le mieux est encore

nous pourrions vouloir faire défiler la page jusqu'en haut

Naviguer vers semble plus naturel (Aller à / Naviguer vers)

navigue vers une nouvelle route

Copy link
Member

Choose a reason for hiding this comment

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

Il me semble que le « even better » se réfère à la suite. Je pencherai pour

vous permet de faire cela et, encore mieux, vous permet de changer le

Copy link
Member Author

Choose a reason for hiding this comment

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

J'ai un peu buté à propos du haut de la page, j'avais pensé qu'on disait souvent « le pied de page », et cela pouvait donc s'appliquer pour le « haut de page ».


``` js
const router = new VueRouter({
routes: [...],
scrollBehavior (to, from, savedPosition) {
// return desired position
// retourne la position désirée
Copy link
Member

Choose a reason for hiding this comment

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

on retourne

ou

retourner

dépend de ce que tu as décidez dans le reste de la documentation


- `{ x: number, y: number }`
Copy link
Member

@MachinisteWeb MachinisteWeb May 27, 2017

Choose a reason for hiding this comment

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

Peux tu m'indiquer d'autres endroit dans les documentations ou la majuscule est utilisée ? Sinon remet les minuscules

Car dans beaucoup de documentation, la lettre majuscule est utilisée car les relecteurs font soit référence au « Primitif Type Number » ou « Primitif Type String » ou alors parce qu'ils ne connaissent pas suffisamment le JavaScript et se réfèrent à leur habitude class object-oriended et non prototype object-oriented.

Une manière conventionnelle d'écrire le typage des primitives est celui retournée par typeof sur une primitive « number », « string » « boolean » sans majuscule pour bien différencier de l'instance d'« object »

  • new Object() ou {} // opérande object (typeof) d'instance Object (instanceof)
  • new String("Coucou") // opérande object (typeof) d'instance String (instanceof)
  • "Coucou" ou new String("Coucou").valueOf() ou new String("Coucou").toString()// opérande primitif de type string (typeof)

Aussi pour moi ils font bien référence à une primitive. Mais si tu as vu ça ailleurs, dit moi !

Copy link
Member Author

Choose a reason for hiding this comment

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

Merci pour l'explication !
Pendant la traduction dans mes précédentes PR, j'ai remarqué qu'« Array » était utilisé en tant que "simple nom", et non pour définir le type d'une variable => https://github.com/vuejs-fr/vue-router/pull/7/files#diff-64b2b82de4b10a5b398aaee86543b445L69

Je vais repasser aux minuscules

Copy link
Member

@MachinisteWeb MachinisteWeb May 27, 2017

Choose a reason for hiding this comment

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

Ok. il faisait donc référence à l'« instanceof » Array d'un « typeof » object. On conserve bien les minuscules.


If a falsy value or an empty object is returned, no scrolling will happen.
Si une valeur équivalente à `false` ou un objet vide est retourné, aucun défilement ne sera produit.
Copy link
Member

Choose a reason for hiding this comment

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

retournée

Copy link
Member Author

Choose a reason for hiding this comment

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

Je laisse retourné, le masculin l'emporte sur le féminin 😎

Copy link
Member

@MachinisteWeb MachinisteWeb May 27, 2017

Choose a reason for hiding this comment

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

Tu as tout à fait raison :) C'était un falsy commentaire XD

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahah 😛


``` js
scrollBehavior (to, from, savedPosition) {
return { x: 0, y: 0 }
}
```

This will simply make the page scroll to top for all route navigations.
Cela permettra de défiler jusqu'au haut de page à chaque navigation à travers les routes.
Copy link
Member

Choose a reason for hiding this comment

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

en haut de la page

ou

au haut de page


Returning the `savedPosition` will result in a native-like behavior when navigating with back/forward buttons:
Retourner l'objet `savedPosition` résultera en un comportement quasi-natif en naviguant avec les boutons précédents/suivants :
Copy link
Member

Choose a reason for hiding this comment

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

un espace en trop entre quasi-natif et en naviguant

@@ -46,7 +46,7 @@ scrollBehavior (to, from, savedPosition) {
}
```

If you want to simulate the "scroll to anchor" behavior:
Si vous voulez simuler le comportement "défiler à l'ancre" :
Copy link
Member

Choose a reason for hiding this comment

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

« aller à l'ancre »


``` js
scrollBehavior (to, from, savedPosition) {
return { x: 0, y: 0 }
}
```

This will simply make the page scroll to top for all route navigations.
Cela permettra de défiler au haut de la page à chaque navigation à travers les routes.
Copy link
Member

Choose a reason for hiding this comment

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

en haut de la page

ou

au haut de page

@Kocal Kocal merged commit 33d758c into vuejs-fr:working May 27, 2017
@Kocal Kocal deleted the advanced/scroll-behavior.md branch May 27, 2017 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants