Skip to content

Commit 2c635cc

Browse files
Merge pull request #69 from Haeresis/plugin
Traduction de `plugins.md`
2 parents 99d0204 + e5a2147 commit 2c635cc

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/v2/guide/plugins.md

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,81 @@
11
---
2-
title: Plugins (En)
2+
title: Plugins
33
type: guide
44
order: 18
55
---
66

7-
## Writing a Plugin
7+
## Écrire un plugin
88

9-
<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>
9+
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 :
1010

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

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

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

17-
4. Add some Vue instance methods by attaching them to Vue.prototype.
17+
4. Ajouter des méthodes d'instance de Vue en les reliant au prototype de Vue.
1818

19-
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)
19+
5. Fournir une bibliothèque avec sa propre API, qui injecte en même temps certains éléments précédemment cités. Par ex. [vue-router](https://github.com/vuejs/vue-router)
2020

21-
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:
21+
Un plugin Vue.js doit exposer une méthode `install`. Cette méthode sera appelée avec le constructeur de `Vue` en tant que premier argument, avec les options possibles suivantes :
2222

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

30-
// 2. add a global asset
30+
// 2. ajouter une ressource global
3131
Vue.directive('my-directive', {
3232
bind (el, binding, vnode, oldVnode) {
33-
// something logic ...
33+
// de la logique de code...
3434
}
3535
...
3636
})
3737

38-
// 3. inject some component options
38+
// 3. injecter des options de composant
3939
Vue.mixin({
4040
created: function () {
41-
// something logic ...
41+
// de la logique de code...
4242
}
4343
...
4444
})
4545

46-
// 4. add an instance method
46+
// 4. ajouter une méthode d'instance
4747
Vue.prototype.$myMethod = function (options) {
48-
// something logic ...
48+
// de la logique de code...
4949
}
5050
}
5151
```
5252

53-
## Using a Plugin
53+
## Utiliser un plugin
5454

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

5757
``` js
58-
// calls `MyPlugin.install(Vue)`
58+
// appel `MyPlugin.install(Vue)`
5959
Vue.use(MyPlugin)
6060
```
6161

62-
You can optionally pass in some options:
62+
Vous pouvez optionnellement passer certaines options :
6363

6464
``` js
6565
Vue.use(MyPlugin, { someOption: true })
6666
```
6767

68-
`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.
68+
`Vue.use` empêchera automatiquement l'utilisation du même plugin plusieurs fois. Ainsi appeler de multiple fois le même plugin ne l'installera qu'une fois.
6969

70-
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:
70+
Certains plugins fournis officiellement par Vue.js comme `vue-router` appelle automatiquement `Vue.use()` si `Vue` est disponible en tant que variable globale. Cependant, dans un environnement modulaire comme avec CommonJS, vous devrez toujours manuellement appeler `Vue.use()` :
7171

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

77-
// Don't forget to call this
77+
// N'oubliez pas de l'appeler
7878
Vue.use(VueRouter)
7979
```
8080

81-
Checkout [awesome-vue](https://github.com/vuejs/awesome-vue#components--libraries) for a huge collection of community-contributed plugins and libraries.
81+
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é.

0 commit comments

Comments
 (0)