Skip to content

Commit fa3de5c

Browse files
mdoXhmikosR
authored andcommitted
Add example of a Spanish translation for custom file input (#25302)
1 parent 14bd7d7 commit fa3de5c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

assets/scss/_component-examples.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@
147147
}
148148
}
149149

150+
.custom-file-input:lang(es) ~ .custom-file-label::after {
151+
content: "Elegir";
152+
}
153+
150154
> .form-control {
151155
+ .form-control {
152156
margin-top: .5rem;

docs/4.0/components/forms.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,8 +1162,17 @@ The [`:lang()` pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:l
11621162
{% highlight scss %}
11631163
$custom-file-text: (
11641164
en: "Browse",
1165-
es: "Navegar"
1165+
es: "Elegir"
11661166
);
11671167
{% endhighlight %}
11681168

1169+
Here's `lang(es)` in action on the custom file input for a Spanish translation:
1170+
1171+
{% example html %}
1172+
<div class="custom-file">
1173+
<input type="file" class="custom-file-input" id="customFileLang" lang="es">
1174+
<label class="custom-file-label" for="customFileLang">Seleccionar Archivo</label>
1175+
</div>
1176+
{% endexample %}
1177+
11691178
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) on the `<html>` element or the [`Content-Language` HTTP header](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.12), among other methods.

0 commit comments

Comments
 (0)