Skip to content

Use :lang() and a Sass map to deal with translations of custom file input text? #18922

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

Closed
cvrebert opened this issue Jan 18, 2016 · 3 comments
Closed

Comments

@cvrebert
Copy link
Collaborator

See https://developer.mozilla.org/en-US/docs/Web/CSS/:lang

Something along the lines of:

$custom-file-text: (
  button-label: (
    en: "Browse"
  ),
  placeholder: (
    en: "Choose file..."
  )
) !default;

@each $lang, $text in map-get($custom-file-text, button-label) {
  ...:lang($lang) {
    content: $text;
  }
}

Folks using other languages can then set new entries in the map via their custom variables file to add their translations.

CC: @mdo for feedback

@mdo
Copy link
Member

mdo commented Jan 18, 2016

Oh, neat. That'd be cool to implement I think. Would we do it anywhere else?

@cvrebert
Copy link
Collaborator Author

We don't have language-specific content anywhere else in the CSS besides the custom file inputs, so no.

@cvrebert
Copy link
Collaborator Author

cvrebert commented Feb 9, 2016

Implemented in #18925.

@cvrebert cvrebert closed this as completed Feb 9, 2016
@cvrebert cvrebert removed their assignment Feb 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants