Make translation of custom file input text easier; fixes #18922

[skip sauce]
This commit is contained in:
Chris Rebert 2016-01-17 20:50:55 -08:00
parent 27596f48f4
commit 8b67d4c762
2 changed files with 18 additions and 5 deletions

View File

@ -217,8 +217,10 @@
@include border-radius($custom-file-border-radius); @include border-radius($custom-file-border-radius);
@include box-shadow($custom-file-box-shadow); @include box-shadow($custom-file-box-shadow);
&::after { @each $lang, $text in map-get($custom-file-text, placeholder) {
content: $custom-file-placeholder; &:lang(#{$lang})::after {
content: $text;
}
} }
&::before { &::before {
@ -232,9 +234,14 @@
padding: $custom-file-padding-x $custom-file-padding-y; padding: $custom-file-padding-x $custom-file-padding-y;
line-height: $custom-file-line-height; line-height: $custom-file-line-height;
color: $custom-file-button-color; color: $custom-file-button-color;
content: $custom-file-button-label;
background-color: $custom-file-button-bg; background-color: $custom-file-button-bg;
border: $custom-file-border-width solid $custom-file-border-color; border: $custom-file-border-width solid $custom-file-border-color;
@include border-radius(0 $custom-file-border-radius $custom-file-border-radius 0); @include border-radius(0 $custom-file-border-radius $custom-file-border-radius 0);
} }
@each $lang, $text in map-get($custom-file-text, button-label) {
&:lang(#{$lang})::before {
content: $text;
}
}
} }

View File

@ -386,10 +386,16 @@ $custom-file-border-width: $border-width !default;
$custom-file-border-color: #ddd !default; $custom-file-border-color: #ddd !default;
$custom-file-border-radius: $border-radius !default; $custom-file-border-radius: $border-radius !default;
$custom-file-box-shadow: inset 0 .2rem .4rem rgba(0,0,0,.05) !default; $custom-file-box-shadow: inset 0 .2rem .4rem rgba(0,0,0,.05) !default;
$custom-file-placeholder: "Choose file..." !default;
$custom-file-button-label: "Browse" !default;
$custom-file-button-color: $custom-file-color !default; $custom-file-button-color: $custom-file-color !default;
$custom-file-button-bg: #eee !default; $custom-file-button-bg: #eee !default;
$custom-file-text: (
placeholder: (
en: "Choose file..."
),
button-label: (
en: "Browse"
)
) !default;
// Form validation icons // Form validation icons