Skip to content
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

Custom File translated Label #27496

Closed
GeoSot opened this issue Oct 21, 2018 · 9 comments
Closed

Custom File translated Label #27496

GeoSot opened this issue Oct 21, 2018 · 9 comments

Comments

@GeoSot
Copy link
Member

GeoSot commented Oct 21, 2018

I 've done some quick search, without results, so I opened this issue as suggestion

In order to use scss variables we can use the following css with the help of a data-attribute so every developer can use any string he wants

.custom-file-input~.custom-file-label::after {
    content: attr(data-label);
}

<div class="custom-file">
  <input type="file" class="custom-file-input" id="customFileLang" >
  <label class="custom-file-label" for="customFileLang" data-label="Can't see me?">Seleccionar Archivo</label>
</div>

The result as I tested, below
https://jsfiddle.net/hc0v648r/1/

@Johann-S
Copy link
Member

@GeoSot
Copy link
Member Author

GeoSot commented Oct 22, 2018

Yes I have read the above link @Johann-S .... thank you for pointing it to me.

As i wrote on my first message , i suggested the above implementation as a future concern in order to be easy to change the string, on the fly

@Johann-S
Copy link
Member

Oh ok sorry for the misunderstanding

@alecpl
Copy link
Contributor

alecpl commented Oct 23, 2018

Oh, it would be nice to support this. All we need is to add:

& ~ .custom-file-label[data-label]::after {
    content: attr(data-label);
}

after the :lang() rules in .custom-file-input block.

@alecpl
Copy link
Contributor

alecpl commented Oct 23, 2018

Or maybe before? @mdo need a hint, and I'll provide a PR.

@XhmikosR
Copy link
Member

/CC @MartijnCuppens

@alecpl
Copy link
Contributor

alecpl commented Nov 21, 2018

This is already implemented with #27651. Though, maybe data-label is better than data-browse. Please, consider the change.

@MartijnCuppens
Copy link
Member

Indeed, this is already implemented. Not sure if data-label is better than data-browse, @mdo, what do you think?

@MartijnCuppens
Copy link
Member

I'm going to close this. Changing this to data-label would be a breaking change at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants