Skip to content

Class and Style section translated #10

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 3 commits into from
Aug 25, 2017

Conversation

panietoar
Copy link

No description provided.

@panietoar panietoar mentioned this pull request Aug 24, 2017
type: guide
order: 6
---

A common need for data binding is manipulating an element's class list and its inline styles. Since they are both attributes, we can use `v-bind` to handle them: we just need to calculate a final string with our expressions. However, meddling with string concatenation is annoying and error-prone. For this reason, Vue provides special enhancements when `v-bind` is used with `class` and `style`. In addition to strings, the expressions can also evaluate to objects or arrays.
Una necesidad común para unir datos es manipular la lista de clases de un elemento, así como sus estilos en línea. Como ambos son atributos, podemos usar `v-bind` para controlarlos: sólo debemos calcular un string final con nuestras expresiones. Sin embargo, trabajar con concatenaciones de strings es molesto y propenso a errores. Por esta razón, Vue ofrece mejoras especiales cuando `v-bind` es usado junto con `class` and `style`. En adición a strings, las expresiones pueden también ser evaluadas a objetos o arreglos.

Choose a reason for hiding this comment

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

De nuevo aparece arreglos. Deberíamos establecer en pautas si este termino es valido o no y ejemplos de uso.

Copy link
Author

@panietoar panietoar Aug 25, 2017

Choose a reason for hiding this comment

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

Siempre he conocido los arrays como arreglos. No uso el término colección ya que en el lenguaje java se refieren a una jerarquía de objetos diferentes.

La documentación de MSDN en javascript los llama matrices
https://msdn.microsoft.com/es-es/library/89t1khd2(v=vs.94).aspx

La documentación de Mozilla los llama array (La hicieron fácil jaja).
https://developer.mozilla.org/es/docs/Learn/Getting_started_with_the_web/JavaScript_basics

Yo me inclino por el lado de mozilla. Un desarrollador con conocimientos básicos ya reconoce el término array. Podemos incluirlo en la lista de no traducibles.

Choose a reason for hiding this comment

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

Me parece bien usar array, lo añado a las pautas.

Copy link
Author

Choose a reason for hiding this comment

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

Hecho


``` html
<div v-bind:class="{ active: isActive }"></div>
```

The above syntax means the presence of the `active` class will be determined by the [truthiness](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) of the data property `isActive`.
La anterior sintaxis ilustra que la presencia de la clase `active` será determinada por el [valor de verdad](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) de la propiedad `isActive`.

Choose a reason for hiding this comment

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

valor de verdad es confuso. Mejor dejarlo sin traducir, ej: por el valor [truthiness](htt...).

Copy link
Author

Choose a reason for hiding this comment

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

Ok

@@ -57,7 +57,7 @@ data: {
}
```

This will render the same result. We can also bind to a [computed property](computed.html) that returns an object. This is a common and powerful pattern:
Esto mostrará el mismo resultado. También podemos Unir a una [propiedad calculada](computed.html) que retorne un objeto. Esto es un patrón muy común y poderoso:

Choose a reason for hiding this comment

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

Sugerencia: También podemos usar una [propiedad...] en vez de Unir.


``` html
<p class="foo bar baz boo">Hi</p>
```

The same is true for class bindings:
Lo mismo aplica para Union en clases:

Choose a reason for hiding this comment

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

No me convence la expressión Union para traducir binding. Alternativas?

Copy link
Author

Choose a reason for hiding this comment

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

Estuve buscando varias (Atar, Enlazar...) pero cuando se usa conjugado sonaban peor. Quedo atento a mejores alternativas.

Choose a reason for hiding this comment

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

En este contexto podríamos usar un lenguaje mas natura? Ejemplo, Lo mismo ocurre para la unión de clases.

@@ -165,7 +165,7 @@ data: {
}
```

It is often a good idea to bind to a style object directly so that the template is cleaner:
Es a menudo una buena idea Unir un objeto de estilos directamente para que la plantilla sea más limpia:

Choose a reason for hiding this comment

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

usar en vez de Unir

Copy link
Author

Choose a reason for hiding this comment

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

No creo que usar sea la palabra que trasmita la accion de usar v-bind. Al igual que el comentario anterior. Quedo a la espera de una mejor alternativa

Choose a reason for hiding this comment

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

Quizás Asignar?

Copy link
Author

Choose a reason for hiding this comment

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

Me gusta Asignar. Aplicaría para todos los demás comentarios donde se usa v-bind.
Podríamos agregar una nota pequeña definiendo el término en algún lado.

Choose a reason for hiding this comment

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

No estoy seguro si fui muy rapido haciendo el merge?

Mejor evitemos notas y añadir nuevo contenido al texto.

@panietoar
Copy link
Author

He reemplazado completamente la palabra Unión, por un manejo correcto de la directiva v-bind.
Creo que es mejor que intentar traducir directamente v-bind.

Espero comentarios.

@miljan-aleksic miljan-aleksic merged commit 44fc945 into vuejs-es:master Aug 25, 2017
@panietoar panietoar deleted the Class-and-Style-Bindings branch August 25, 2017 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants