Skip to content

Traduction de plugins.md #69

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

Merged
merged 4 commits into from
Jun 22, 2017
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions src/v2/guide/plugins.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
---
title: Plugins (En)
title: Plugins
type: guide
order: 18
---

## Writing a Plugin
## Écrire un plugin

<p class="tip">**Cette page est en cours de traduction française. Revenez une autre fois pour lire une traduction achevée ou [participez à la traduction française ici](https://github.com/vuejs-fr/vuejs.org).**</p><p>Plugins usually add global-level functionality to Vue. There is no strictly defined scope for a plugin - there are typically several types of plugins you can write:</p>
Les plugins sont habituellement ajoutés au niveau des fonctionnalités globales de Vue. Il y a un cadre strictement défini pour un plugin, et il y a divers types de plugins que vous pouvez écrire pour :

Choose a reason for hiding this comment

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

pour un plugin et il y a divers types de plugins que vous pouvez écrire pour :

Enlever la virgule après plugin, normalement, le mot et n'est pas précédé d'une virgule

Copy link
Member Author

Choose a reason for hiding this comment

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

Tout à fait


1. Add some global methods or properties. e.g. [vue-custom-element](https://github.com/karol-f/vue-custom-element)
1. Ajouter plusieurs méthodes globales ou propriétés. Par ex. [vue-custom-element](https://github.com/karol-f/vue-custom-element)

2. Add one or more global assets: directives/filters/transitions etc. e.g. [vue-touch](https://github.com/vuejs/vue-touch)
2. Ajouter une ou plusieurs fonctionnalités : directives/filters/transitions, etc. Par ex. [vue-touch](https://github.com/vuejs/vue-touch)

Choose a reason for hiding this comment

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

directives, filtres, transitions, etc.

Séparer par des virgules et traduction de filters en filtres


3. Add some component options by global mixin. e.g. [vuex](https://github.com/vuejs/vuex)
3. Ajouter plusieurs options de composant avec un mixin global. Par ex. [vuex](https://github.com/vuejs/vuex)

4. Add some Vue instance methods by attaching them to Vue.prototype.
4. Ajouter plusieurs méthodes d'instance de Vue attachées au prototype de Vue.

Choose a reason for hiding this comment

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

Ajouter plusieurs des méthodes d'instance de Vue attachées en les reliant au prototype de Vue.


5. A library that provides an API of its own, while at the same time injecting some combination of the above. e.g. [vue-router](https://github.com/vuejs/vue-router)
5. Fournir une bibliothèque avec sa propre API, qui injecte en même temps certains des éléments précédemment cités. Par ex. [vue-router](https://github.com/vuejs/vue-router)

Choose a reason for hiding this comment

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

certains des éléments précédemment cités


A Vue.js plugin should expose an `install` method. The method will be called with the `Vue` constructor as the first argument, along with possible options:
Un plugin Vue.js doit exposer une méthode `install`. Cette méthode va être appelée avec le constructeur de `Vue` en tant que premier argument, avec les options possibles suivantes :

Choose a reason for hiding this comment

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

Cette méthode sera va être appelée


``` js
MyPlugin.install = function (Vue, options) {
// 1. add global method or property
// 1. ajouter une méthode globale ou une propriété
Vue.myGlobalMethod = function () {
// something logic ...
// de la logique de code...
}

// 2. add a global asset
// 2. ajouter des fonctionnalités

Choose a reason for hiding this comment

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

ajouter une ressource global des fonctionnalités

ressource me parait une meilleure traduction

Vue.directive('my-directive', {
bind (el, binding, vnode, oldVnode) {
// something logic ...
// de la logique de code...
}
...
})

// 3. inject some component options
// 3. injecter des options de composant
Vue.mixin({
created: function () {
// something logic ...
// de la logique de code...
}
...
})

// 4. add an instance method
// 4. ajouter des méthodes d'instance

Choose a reason for hiding this comment

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

ajouter des méthodes une méthode d'instance

Vue.prototype.$myMethod = function (options) {
// something logic ...
// de la logique de code...
}
}
```

## Using a Plugin
## Utiliser un plugin

Use plugins by calling the `Vue.use()` global method:
Utiliser un plugin en appelant la méthode globale `Vue.use()` :

Choose a reason for hiding this comment

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

Une fois n'est pas coutume, l'usage de l'infinitif fait de toutes ces phrases des phrases nominales, ce qui selon moi est en rupture avec le reste du guide. Je préfère largement l'usage de l'impératif, mais je pense qu'on aura du mal à se mettre d'accord

Copy link
Member Author

@MachinisteWeb MachinisteWeb Jun 22, 2017

Choose a reason for hiding this comment

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

J'y songe, j'y songe. Je médite, je médite. Naturellement j'utilise l'impératif alors pour le moment je reste consistant avec moi-même. Il me faudrait un chantier dédié (PR) pour bien cerner les nuances j'imagine. J'en ai également déjà parlé mais c'est pas ma priorité. Je m'inspirerais de l'API p-e car je pense bien que tu utilises l'infinitif.


``` js
// calls `MyPlugin.install(Vue)`
// appel `MyPlugin.install(Vue)`

Choose a reason for hiding this comment

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

appelle

Vue.use(MyPlugin)
```

You can optionally pass in some options:
Vous pouvez optionnellement passer certaines options :

``` js
Vue.use(MyPlugin, { someOption: true })
```

`Vue.use` automatically prevents you from using the same plugin more than once, so calling it multiple times on the same plugin will install the plugin only once.
`Vue.use` va automatiquement vous empécher d'utiliser plusieurs fois le même plugin, ainsi appeler de multiple fois le même plugin ne l'installera qu'une fois.

Choose a reason for hiding this comment

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

Vue.use va empêchera automatiquement vous empécher d'utiliser plusieurs fois le même plugin


Some plugins provided by Vue.js official plugins such as `vue-router` automatically calls `Vue.use()` if `Vue` is available as a global variable. However in a module environment such as CommonJS, you always need to call `Vue.use()` explicitly:
Certains plugins fournis officiellement par Vue.js comme `vue-router` appelle `Vue.use()` si `Vue` est disponible en tant que variable globale. Cependant, dans un environnement par module comme avec CommonJS, vous devrez toujours manuellement appeler `Vue.use()` :

Choose a reason for hiding this comment

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

comme vue-router appelle automatiquement Vue.use()

il manque le mot automatiquement

environnement par module comme avec CommonJS

proposition : environnement modulaire comme CommonJS

Copy link
Member Author

Choose a reason for hiding this comment

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

Bon pour moi


``` js
// When using CommonJS via Browserify or webpack
// En utilisant CommonJS depuis Browserify ou webpack
var Vue = require('vue')
var VueRouter = require('vue-router')

// Don't forget to call this
// N'oubliez pas de l'appeler
Vue.use(VueRouter)
```

Checkout [awesome-vue](https://github.com/vuejs/awesome-vue#components--libraries) for a huge collection of community-contributed plugins and libraries.
Consultez [awesome-vue](https://github.com/vuejs/awesome-vue#components--libraries) pour une large collection de plugin et bibliothèque fournis par la contribution de la communauté.

Choose a reason for hiding this comment

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

plugins et bibliothèques