-
Notifications
You must be signed in to change notification settings - Fork 103
Traduction forms.md #35
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
Changes from all commits
0aa076f
8398675
ee28734
d2e9883
4d1dab4
9c4cd1d
1da096b
0ccb6dd
8bef84d
2dd5a79
357a6f8
beead5b
35d8430
46c88e6
acc0e8c
7d33cd3
ba8ac57
036bf2f
07f1f0d
80525f9
c6542c8
0598b8b
1541722
c169ed8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
--- | ||
title: Form Input Bindings | ||
title: Liaisons sur les champs de formulaire | ||
type: guide | ||
order: 10 | ||
--- | ||
|
||
## Basic Usage | ||
## Usage basique | ||
|
||
<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>You can use the `v-model` directive to create two-way data bindings on form input and textarea elements. It automatically picks the correct way to update the element based on the input type. Although a bit magical, `v-model` is essentially syntax sugar for updating data on user input events, plus special care for some edge cases. | ||
Vous pouvez utiliser la directive `v-model` pour créer une liaison de données bidirectionnelle sur les champs de formulaire (input, select ou textarea). Elle choisira automatiquement la bonne manière de mettre à jour l'élément en fonction du type de champ. Bien qu'un peu magique, `v-model` est essentiellement du sucre syntaxique pour mettre à jour les données lors des évènements de saisie utilisateur sur les champs, ainsi que quelques traitements spéciaux pour certains cas particuliers. | ||
|
||
<p class="tip">`v-model` doesn't care about the initial value provided to an input or a textarea. It will always treat the Vue instance data as the source of truth.</p> | ||
<p class="tip">`v-model` ne prend pas en compte la valeur initiale (attribut "value") fournie pour un champ. Elle traitera toujours les données de l'instance de vue comme la source de vérité.</p> | ||
|
||
<p class="tip" id="vmodel-ime-tip">For languages that require an [IME](https://en.wikipedia.org/wiki/Input_method) (Chinese, Japanese, Korean etc.), you'll notice that `v-model` doesn't get updated during IME composition. If you want to cater for these updates as well, use `input` event instead.</p> | ||
<p class="tip" id="vmodel-ime-tip">Pour les langues qui requièrent une [méthode de saisie (IME)](https://fr.wikipedia.org/wiki/M%C3%A9thode_d%27entr%C3%A9e) (chinois, japonais, coréen etc...), vous remarquerez que `v-model` ne sera pas mise à jour durant l'exécution de la méthode de saisie.</p> | ||
|
||
### Text | ||
### Texte | ||
|
||
``` html | ||
<input v-model="message" placeholder="edit me"> | ||
<p>Message is: {{ message }}</p> | ||
<input v-model="message" placeholder="modifiez-moi"> | ||
<p>Le message est : {{ message }}</p> | ||
``` | ||
|
||
{% raw %} | ||
<div id="example-1" class="demo"> | ||
<input v-model="message" placeholder="edit me"> | ||
<p>Message is: {{ message }}</p> | ||
<input v-model="message" placeholder="modifiez-moi"> | ||
<p>Le message est : {{ message }}</p> | ||
</div> | ||
<script> | ||
new Vue({ | ||
|
@@ -34,21 +34,21 @@ new Vue({ | |
</script> | ||
{% endraw %} | ||
|
||
### Multiline text | ||
### Texte multiligne | ||
|
||
``` html | ||
<span>Multiline message is:</span> | ||
<span>Le message multiligne est :</span> | ||
<p style="white-space: pre">{{ message }}</p> | ||
<br> | ||
<textarea v-model="message" placeholder="add multiple lines"></textarea> | ||
<textarea v-model="message" placeholder="ajoutez plusieurs lignes"></textarea> | ||
``` | ||
|
||
{% raw %} | ||
<div id="example-textarea" class="demo"> | ||
<span>Multiline message is:</span> | ||
<span>Le message multiligne est :</span> | ||
<p style="white-space: pre">{{ message }}</p> | ||
<br> | ||
<textarea v-model="message" placeholder="add multiple lines"></textarea> | ||
<textarea v-model="message" placeholder="ajoutez plusieurs lignes"></textarea> | ||
</div> | ||
<script> | ||
new Vue({ | ||
|
@@ -62,12 +62,12 @@ new Vue({ | |
|
||
|
||
{% raw %} | ||
<p class="tip">Interpolation on textareas (<code><textarea>{{text}}</textarea></code>) won't work. Use <code>v-model</code> instead.</p> | ||
<p class="tip">L'interpolation sur les zones de texte (<code><textarea>{{text}}</textarea></code>) ne fonctionnera pas. Utilisez <code>v-model</code> à la place.</p> | ||
{% endraw %} | ||
|
||
### Checkbox | ||
|
||
Single checkbox, boolean value: | ||
Checkbox seule, valeur booléenne : | ||
|
||
``` html | ||
<input type="checkbox" id="checkbox" v-model="checked"> | ||
|
@@ -88,7 +88,7 @@ new Vue({ | |
</script> | ||
{% endraw %} | ||
|
||
Multiple checkboxes, bound to the same Array: | ||
Checkboxes multiples, liées au même tableau (Array) : | ||
|
||
``` html | ||
<input type="checkbox" id="jack" value="Jack" v-model="checkedNames"> | ||
|
@@ -98,7 +98,7 @@ Multiple checkboxes, bound to the same Array: | |
<input type="checkbox" id="mike" value="Mike" v-model="checkedNames"> | ||
<label for="mike">Mike</label> | ||
<br> | ||
<span>Checked names: {{ checkedNames }}</span> | ||
<span>Noms cochés : {{ checkedNames }}</span> | ||
``` | ||
|
||
``` js | ||
|
@@ -119,7 +119,7 @@ new Vue({ | |
<input type="checkbox" id="mike" value="Mike" v-model="checkedNames"> | ||
<label for="mike">Mike</label> | ||
<br> | ||
<span>Checked names: {{ checkedNames }}</span> | ||
<span>Noms cochés : {{ checkedNames }}</span> | ||
</div> | ||
<script> | ||
new Vue({ | ||
|
@@ -135,23 +135,23 @@ new Vue({ | |
|
||
|
||
``` html | ||
<input type="radio" id="one" value="One" v-model="picked"> | ||
<label for="one">One</label> | ||
<input type="radio" id="one" value="Un" v-model="picked"> | ||
<label for="one">Un</label> | ||
<br> | ||
<input type="radio" id="two" value="Two" v-model="picked"> | ||
<label for="two">Two</label> | ||
<input type="radio" id="two" value="Deux" v-model="picked"> | ||
<label for="two">Deux</label> | ||
<br> | ||
<span>Picked: {{ picked }}</span> | ||
<span>Choisi : {{ picked }}</span> | ||
``` | ||
{% raw %} | ||
<div id="example-4" class="demo"> | ||
<input type="radio" id="one" value="One" v-model="picked"> | ||
<label for="one">One</label> | ||
<input type="radio" id="one" value="Un" v-model="picked"> | ||
<label for="one">Un</label> | ||
<br> | ||
<input type="radio" id="two" value="Two" v-model="picked"> | ||
<label for="two">Two</label> | ||
<input type="radio" id="two" value="Deux" v-model="picked"> | ||
<label for="two">Deux</label> | ||
<br> | ||
<span>Picked: {{ picked }}</span> | ||
<span>Choisi : {{ picked }}</span> | ||
</div> | ||
<script> | ||
new Vue({ | ||
|
@@ -165,15 +165,15 @@ new Vue({ | |
|
||
### Select | ||
|
||
Single select: | ||
Select à choix unique : | ||
|
||
``` html | ||
<select v-model="selected"> | ||
<option>A</option> | ||
<option>B</option> | ||
<option>C</option> | ||
</select> | ||
<span>Selected: {{ selected }}</span> | ||
<span>Sélectionné : {{ selected }}</span> | ||
``` | ||
{% raw %} | ||
<div id="example-5" class="demo"> | ||
|
@@ -182,7 +182,7 @@ Single select: | |
<option>B</option> | ||
<option>C</option> | ||
</select> | ||
<span>Selected: {{ selected }}</span> | ||
<span>Sélectionné : {{ selected }}</span> | ||
</div> | ||
<script> | ||
new Vue({ | ||
|
@@ -194,7 +194,7 @@ new Vue({ | |
</script> | ||
{% endraw %} | ||
|
||
Multiple select (bound to Array): | ||
Select à choix multiples (lié à un tableau) : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Puisque nous avions
Je propose de faire de même, ce qui nous permet de conserver Array entre parenthèse
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @haeresis je suis d'accord, j'ai juste suivi l'original au plus près plutôt que de l'améliorer. C'est une règle que je m'impose à tort ou à raison. Elaborer une charte de traduction avec 4 ou 5 règles qu'on suit ne nous ferait pas de mal... |
||
|
||
``` html | ||
<select v-model="selected" multiple> | ||
|
@@ -203,7 +203,7 @@ Multiple select (bound to Array): | |
<option>C</option> | ||
</select> | ||
<br> | ||
<span>Selected: {{ selected }}</span> | ||
<span>Sélectionné(s) : {{ selected }}</span> | ||
``` | ||
{% raw %} | ||
<div id="example-6" class="demo"> | ||
|
@@ -213,7 +213,7 @@ Multiple select (bound to Array): | |
<option>C</option> | ||
</select> | ||
<br> | ||
<span>Selected: {{ selected }}</span> | ||
<span>Sélectionné(s) : {{ selected }}</span> | ||
</div> | ||
<script> | ||
new Vue({ | ||
|
@@ -225,25 +225,25 @@ new Vue({ | |
</script> | ||
{% endraw %} | ||
|
||
Dynamic options rendered with `v-for`: | ||
Options dynamiques générées avec `v-for` : | ||
|
||
``` html | ||
<select v-model="selected"> | ||
<option v-for="option in options" v-bind:value="option.value"> | ||
{{ option.text }} | ||
</option> | ||
</select> | ||
<span>Selected: {{ selected }}</span> | ||
<span>Sélectionné : {{ selected }}</span> | ||
``` | ||
``` js | ||
new Vue({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Il faudrait traduire "One", "Two" et "Three" dans le tableau There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pushé |
||
el: '...', | ||
data: { | ||
selected: 'A', | ||
options: [ | ||
{ text: 'One', value: 'A' }, | ||
{ text: 'Two', value: 'B' }, | ||
{ text: 'Three', value: 'C' } | ||
{ text: 'Un', value: 'A' }, | ||
{ text: 'Deux', value: 'B' }, | ||
{ text: 'Trois', value: 'C' } | ||
] | ||
} | ||
}) | ||
|
@@ -255,41 +255,41 @@ new Vue({ | |
{{ option.text }} | ||
</option> | ||
</select> | ||
<span>Selected: {{ selected }}</span> | ||
<span>Sélectionné : {{ selected }}</span> | ||
</div> | ||
<script> | ||
new Vue({ | ||
el: '#example-7', | ||
data: { | ||
selected: 'A', | ||
options: [ | ||
{ text: 'One', value: 'A' }, | ||
{ text: 'Two', value: 'B' }, | ||
{ text: 'Three', value: 'C' } | ||
{ text: 'Un', value: 'A' }, | ||
{ text: 'Deux', value: 'B' }, | ||
{ text: 'Trois', value: 'C' } | ||
] | ||
} | ||
}) | ||
</script> | ||
{% endraw %} | ||
|
||
## Value Bindings | ||
## Liaisons des attributs value | ||
|
||
For radio, checkbox and select options, the `v-model` binding values are usually static strings (or booleans for checkbox): | ||
Pour les boutons radio, les cases à cocher et les listes d'options, les valeurs de liaison de `v-model` sont habituellement des chaînes de caractères statiques (ou des booléens pour une case à cocher) : | ||
|
||
``` html | ||
<!-- `picked` is a string "a" when checked --> | ||
<!-- `picked` sera une chaîne de caractères "a" quand le bouton radio sera sélectionné --> | ||
<input type="radio" v-model="picked" value="a"> | ||
|
||
<!-- `toggle` is either true or false --> | ||
<!-- `toggle` est soit true soit false --> | ||
<input type="checkbox" v-model="toggle"> | ||
|
||
<!-- `selected` is a string "abc" when selected --> | ||
<!-- `selected` sera une chaîne de caractères "abc" quand l'option sera sélectionnée --> | ||
<select v-model="selected"> | ||
<option value="abc">ABC</option> | ||
</select> | ||
``` | ||
|
||
But sometimes we may want to bind the value to a dynamic property on the Vue instance. We can use `v-bind` to achieve that. In addition, using `v-bind` allows us to bind the input value to non-string values. | ||
Mais parfois nous pouvons souhaiter lier la valeur à une propriété dynamique de l'instance de Vue. Nous pouvons réaliser cela en utilisant `v-bind`. De plus, utiliser `v-bind` nous permet de lier la valeur de l'input à des valeurs qui ne sont pas des chaînes de caractères. | ||
|
||
### Checkbox | ||
|
||
|
@@ -303,9 +303,9 @@ But sometimes we may want to bind the value to a dynamic property on the Vue ins | |
``` | ||
|
||
``` js | ||
// when checked: | ||
// lorsque c'est coché : | ||
vm.toggle === vm.a | ||
// when unchecked: | ||
// lorsque que c'est décoché : | ||
vm.toggle === vm.b | ||
``` | ||
|
||
|
@@ -316,59 +316,59 @@ vm.toggle === vm.b | |
``` | ||
|
||
``` js | ||
// when checked: | ||
// lorsque c'est choisi : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lorsque c'est coché There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sylvainpolletvillard c'est un bouton radio ici; "cocher" pour moi ça veut plutôt dire ça : https://www.google.fr/search?q=une+coche&safe=active&source=lnms&tbm=isch&sa=X&ved=0ahUKEwi-jq3rk7bSAhWEORQKHff1DGwQ_AUICCgB&biw=1279&bih=687#safe=active&tbm=isch&q=coch%C3%A9&* There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. La forme du tick n'a pas vraiment d'importance, elle est différente selon les OS même pour les checkbox. Pas besoin de changer de terme selon moi There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Je préfère également choisir qui porte le sens de faire un choix ce qui n'est le cas qu'avec des checkbox. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. on peut toujours choisir de cocher ou pas 😄 comme vous voulez |
||
vm.pick === vm.a | ||
``` | ||
|
||
### Select Options | ||
### Options de select | ||
|
||
``` html | ||
<select v-model="selected"> | ||
<!-- inline object literal --> | ||
<!-- objet littéral en ligne --> | ||
<option v-bind:value="{ number: 123 }">123</option> | ||
</select> | ||
``` | ||
|
||
``` js | ||
// when selected: | ||
// lorsque c'est sélectionné : | ||
typeof vm.selected // -> 'object' | ||
vm.selected.number // -> 123 | ||
``` | ||
|
||
## Modifiers | ||
## Modificateurs | ||
|
||
### `.lazy` | ||
|
||
By default, `v-model` syncs the input with the data after each `input` event (with the exception of IME composition as [stated above](#vmodel-ime-tip)). You can add the `lazy` modifier to instead sync after `change` events: | ||
Par défaut, `v-model` synchronise le champ avec les données après chaque évènement `input` (à l'exception de l'exécution d'une méthode de saisie comme [mentionné plus haut](#vmodel-ime-tip)). Vous pouvez ajouter le modificateur `lazy` pour synchroniser après les évènements `change` à la place : | ||
|
||
``` html | ||
<!-- synced after "change" instead of "input" --> | ||
<!-- synchronisé après le "change" au lieu du "input" --> | ||
<input v-model.lazy="msg" > | ||
``` | ||
|
||
### `.number` | ||
|
||
If you want user input to be automatically typecast as a number, you can add the `number` modifier to your `v-model` managed inputs: | ||
Si vous voulez que la saisie utilisateur soit automatiquement convertie en nombre, vous pouvez ajouter le modificateur `number` à vos champs gérés par `v-model` : | ||
|
||
``` html | ||
<input v-model.number="age" type="number"> | ||
``` | ||
|
||
This is often useful, because even with `type="number"`, the value of HTML input elements always returns a string. | ||
C'est souvent utile, parce que même avec `type="number"`, la valeur des éléments input HTML retourne toujours une chaîne de caractères. | ||
|
||
### `.trim` | ||
|
||
If you want user input to be trimmed automatically, you can add the `trim` modifier to your `v-model` managed inputs: | ||
Si vous voulez que les espaces superflus des saisies utilisateur soient automatiquement retirés, vous pouvez ajouter le modificateur `trim` à vos champs gérés par `v-model` : | ||
|
||
```html | ||
<input v-model.trim="msg"> | ||
``` | ||
|
||
## `v-model` with Components | ||
## `v-model` avec les composants | ||
|
||
> If you're not yet familiar with Vue's components, just skip this for now. | ||
> Si vous n'êtes pas encore familier avec les composants de Vue, passez cette section pour le moment. | ||
|
||
HTML's built-in input types won't always meet your needs. Fortunately, Vue components allow you to build reusable inputs with completely customized behavior. These inputs even work with `v-model`! To learn more, read about [custom inputs](components.html#Form-Input-Components-using-Custom-Events) in the Components guide. | ||
Les types de champ standards HTML ne couvriront pas toujours vos besoins. Heureusement, les composants de Vue vous permettent de construire des champs avec un comportement complètement personnalisé. Ces champs fonctionnent même avec `v-model` ! Pour en apprendre plus, lisez la section ["champs personnalisés"](components.html#Form-Input-Components-using-Custom-Events) dans le guide des composants. | ||
|
||
|
||
|
||
|
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.
Car puisque nous utilisons le terme comme s'il était français (au lieu de boîte de sélection qui parlerait à personne), je pense qu'il faut suivre les règles « française ».
Ex : Nous forkons beaucoup de projet (et pas nous fork beaucoup de projet)
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.
@haeresis Je vois la logique mais "Checkboxs" me semble ultra-bizarre à l'oeil, jamais lu ou vu. Si tu me trouves un article officiel, une doc sérieuse qui l'utilise je vois ce que je fais
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.
https://forum.alsacreations.com/topic-5-34965-1-Cacul-dun-montant-a-partir-des-checkboxs.html
Je t'invites à taper « des checkboxs » dans Google.
Soit on prend le parti de les mettre invariables ces termes anglais francisé. Soit on prends le parti de les accorder en genre et en nombre selon les règles du français. Mais comme tu as mis « textareas » je pense bien que tu accordes :)
Là on se dit : tiens, il y a un « e » car on dit une checkboxe ? Bizarre plus haut li a mit « checkbox » sans « e ».
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.
@haeresis je ne prends pas en compte les forums pour ma part, je ne les considère pas comme une source fiable pour décider de l'orthographe d'un mot (mais il y a peut être des documentation ou sources sérieuses qui utilisent cette orthographe)
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.
J'ai l'explication que a voit haute on dit checkbox et pas checkoxize au pluriel.
Et ensuite, il ne me reste plus que les exemples similaire, je te cherche ça.
Ça fait le Buzz. Il y a des Buzzs sur Twitter. On écrit pas buzzes.
Je vais écrire mon speech. Tiens, écris moi des speechs. On écrit pas speeches.
Ma voiture a eu un crash. Il y a de nombreux crashs d'avion. On écrit pas crashes.
J'aime mon boss ! J'aime mes boss. On écrit pas bosses.
C'est du business ! Ces affaires ce sont mes petits business. On écrit pas businesses. (bon remarque p-e pas en anglais non plus haha).
Là comme ça j'en ai pas d'autres.
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.
De toute façon j'ai tout usé pour sauver ce pauvre « checkboxs », j'ai plus de cartouche . Pour ma part je mets jamais de pluriels à checkbox, radio, input, textarea, button puisque ce sont des noms de balises.
Moi ça me conviendrait « Cases à cocher » ! Il faudrait juste, si on traduit « checkboxes » par « Cases à cocher » que l'on traduise « Interpolation on textareas » par « Interpolation des textes multilignes ».
Par exemple « form inputs and textarea » parle selon moi des champs de formulaire de manière large et spécifiquement des champs textarea (pas de pluriel). Donc si textareas est écrit au pluriel c'est qu'on parle des champs/textes multilignes et pas de la balise textarea.
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.
+1 pour cases à cocher et zones de texte. Ou si on veut mentionner la balise HTML, écrire
<textarea>
Et comme @nyl-auster je pense que "checkboxs" c'est la pire évolution possible du franglais dans cette histoire :) C'est moche en anglais comme en français (on ne met jamais de x et de s l'un à côté de l'autre)
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.
Mais oui ! Tu as raison @sylvainpolletvillard, de la meme manière qu'on écrit des boss (et pas des bosss), je pense finalement que des checkbox fait déjà le job. Tu m'apportes là lumière !
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.
@haeresis tu as dû mal me comprendre ^^ Je suis partisan de "checkboxes" ou "cases à cocher". Les anglicismes ne me dérangent pas à condition qu'on respecte la grammaire anglaise 😄
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.
J'ai bien compris, tu t'expliques très bien ! C'est moi qui m'explique mal.
Je voulais juste dire que je me prends là tête à expliquer « ouais, en français, on ajoute pas de "e magique" pour passer un mot au pluriel, c'est que un "s" » genre affaire d'état ; et toi tu débarques comme une fleur genre : « euh mec, quand un mot il finit par un "x", bah au pluriel c'est pareil... ».
Powned 😋
PS : j'ai très bien compris que tu préfères checkboxes à « l'horrible » checkboxs.