Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML language switcher accessibility

Tags:

html

wai-aria

Is there any aria-something or a role to add in a language switch link ? For exemple, I put two links in the footer to change the current language.

<a href="/language/switch/fr">Fr</a>
<a href="/language/switch/uk">Uk</a>

I there any semantic tag to add to this links ?


1 Answers

Example:

<a href="/language/switch/fr" lang="fr" hreflang="fr">Fr</a>

See https://www.nomensa.com/blog/2010/7-tips-for-multi-lingual-website-accessibility for more info.

lang attribute doc:

The lang global attribute helps define the language of an element: the language that non-editable elements are written in, or the language that the editable elements should be written in by the user.

hreflang attribute doc:

Hints at the human language of the linked URL. No built-in functionality. Allowed values are the same as the global lang attribute.

like image 52
jasie Avatar answered Aug 12 '26 12:08

jasie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!