aboutsummaryrefslogtreecommitdiff
path: root/docs/components/forms.md
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2016-02-13 17:55:23 -0800
committerMark Otto <[email protected]>2016-02-13 17:55:23 -0800
commit0c46412a4ce69f1fa8051b5dd73b6cc8401daf87 (patch)
tree9de22eefff352a51d0ef180373c3d28037b70b97 /docs/components/forms.md
parent09aefaa2afe05f438b99caa63bb888c62c40bf73 (diff)
parentceb0e9b69f0d0b1b606073f826b8a9083e8ff347 (diff)
downloadbootstrap-0c46412a4ce69f1fa8051b5dd73b6cc8401daf87.tar.xz
bootstrap-0c46412a4ce69f1fa8051b5dd73b6cc8401daf87.zip
Merge branch 'v4-dev' into v4-custom-forms-validation
Diffstat (limited to 'docs/components/forms.md')
-rw-r--r--docs/components/forms.md23
1 files changed, 22 insertions, 1 deletions
diff --git a/docs/components/forms.md b/docs/components/forms.md
index 6f95ecb3d..ef56a9e89 100644
--- a/docs/components/forms.md
+++ b/docs/components/forms.md
@@ -332,7 +332,9 @@ Because of this, you may need to manually address the width and alignment of ind
### Using the Grid
-For more structured form layouts, you can utilize Bootstrap's predefined grid classes (or mixins). Add the `.row` class to form groups and use the `.col-*` classes to specify the width of your labels and controls. To vertically center the labels with the textual inputs—nearly anything with `.form-control`—use the `.form-control-label` class.
+For more structured form layouts, you can utilize Bootstrap's predefined grid classes (or mixins) to create horizontal forms. Add the `.row` class to form groups and use the `.col-*-*` classes to specify the width of your labels and controls.
+
+Be sure to add `.form-control-label` to your `<label>`s as well so they're vertically centered with their associated labels.
{% example html %}
<form>
@@ -844,3 +846,22 @@ Here's how it works:
- We declare a `height` on the `<input>` for proper spacing for surrounding content.
In other words, it's an entirely custom element, all generated via CSS.
+
+#### Translating or customizing the strings
+
+The [`:lang()` pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:lang) is used to allow for easy translation of the "Browse" and "Choose file..." text into other languages. Simply override or add entries to the `$custom-file-text` SCSS variable with the relevant [language tag](https://en.wikipedia.org/wiki/IETF_language_tag) and localized strings. The English strings can be customized the same way. For example, here's how one might add a Spanish translation (Spanish's language code is `es`):
+
+{% highlight scss %}
+$custom-file-text: (
+ placeholder: (
+ en: "Choose file...",
+ es: "Seleccionar archivo..."
+ ),
+ button-label: (
+ en: "Browse",
+ es: "Navegar"
+ )
+);
+{% endhighlight %}
+
+You'll need to set the language of your document (or subtree thereof) correctly in order for the correct text to be shown. This can be done using [the `lang` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang) or the [`Content-Language` HTTP header](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.12), among other methods.