Skip to content

Language Switcher — wd-language-switcher

Category: Navigation · Tag: wd-language-switcherBack to: Components overview


What it does

Lets visitors switch the site language. It reads the page's per-language URLs and the current language, and renders either a dropdown (<select>) or a list of language links. Selecting a language navigates to that language's version of the page. Language names are shown in their own script (English, العربية, Français, Español, Deutsch).


Adding it & its settings

Add Component → Navigation → Language Switcher.

Basic Settings (all components): #id, Classes, Inline Style.

Component Settings:

SettingValuesEffect
Choose Appearance (template)Dropdown / ListDropdown renders a <select>; List renders a horizontal list of links.

The available languages and their URLs come from the page automatically — nothing to configure here beyond the appearance.


Content & slots

  • No slot — the languages are generated from page data (hrefLang), not from child content.

Styling

The variable set is grouped by the wrapper, the List appearance (ul + links), and the Dropdown appearance (select).

Container

VariableDefault
--language-switcher-displayflex
--language-switcher-width / -min-width / -max-widthauto
--language-switcher-heightauto
--language-switcher-backgroundtransparent
--language-switcher-font-familysans-serif
--language-switcher-border-top / -right / -bottom / -leftnone
--language-switcher-border-top-left-radius / -top-right-radius / -bottom-left-radius / -bottom-right-radius0
--language-switcher-margin-top / -bottom / -inline-start / -inline-end0
--language-switcher-padding-top / -bottom / -inline-start / -inline-end0

List appearance — the ul

VariableDefault
--language-switcher-ul-displayflex
--language-switcher-ul-gap0.5rem
--language-switcher-ul-stylenone
--language-switcher-ul-margin-top / -bottom / -inline-start / -inline-end0
--language-switcher-ul-padding-top / -bottom / -inline-start / -inline-end0
VariableDefault
--language-switcher-link-color#333
--language-switcher-link-backgroundtransparent
--language-switcher-link-hover-background#f0f0f0
--language-switcher-link-hover-color#000
--language-switcher-link-displayflex
--language-switcher-link-align-itemscenter
--language-switcher-link-justify-contentcenter
--language-switcher-link-text-aligncenter
--language-switcher-link-text-decorationnone
--language-switcher-link-transitionall ease 0.3s
--language-switcher-link-width / -heightauto
--language-switcher-link-min-height2rem
--language-switcher-link-font-size0.875rem
--language-switcher-link-border-top / -right / -bottom / -leftnone
--language-switcher-link-border-top-left-radius / -top-right-radius / -bottom-left-radius / -bottom-right-radius4px
--language-switcher-link-margin-top / -bottom / -inline-start / -inline-end0
--language-switcher-link-padding-top / -bottom0.5em
--language-switcher-link-padding-inline-start / -inline-end1em
VariableDefault
--language-switcher-link-active-color#000
--language-switcher-link-active-backgroundtransparent
--language-switcher-link-active-border-top / -right / -bottom / -leftnone
VariableDefault
--language-switcher-select-background#fff
--language-switcher-select-color#333
--language-switcher-select-font-size0.875rem
--language-switcher-select-border-top / -right / -bottom / -left1px solid #ccc
--language-switcher-select-border-radius4px
--language-switcher-select-width / -heightauto
--language-switcher-select-min-height2rem
--language-switcher-select-padding-top / -bottom / -inline-start / -inline-end0.5em

::part()

PartElement
language-switcher-<id>The switcher wrapper.
css
wd-language-switcher::part(language-switcher-main) { --language-switcher-link-color: #0ea5b7; }

Notes

  • Appearance drives which variables apply: the ul/link groups take effect in List mode; the select group in Dropdown mode.
  • The current language is highlighted (its link gets the link-active-* styles in list mode / is preselected in the dropdown).