Skip to content

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

Closed
@cvrebert

Description

@cvrebert

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions