mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
Add docs for custom file input's text and $custom-file-text
[skip sauce]
This commit is contained in:
parent
8b67d4c762
commit
aa62428cdf
1 changed files with 19 additions and 0 deletions
|
@ -812,3 +812,22 @@ Here's how it works:
|
||||||
- We declare a `height` on the `<input>` for proper spacing for surrounding content.
|
- 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.
|
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.
|
||||||
|
|
Loading…
Add table
Reference in a new issue