This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem: The HTML of the language switcher is the following:

en

This is not a valid HTML, consequently the screen readers read nothing. ?How can I set up a valid HTML for the language switcher.

Solution: If you desire to add the names of the languages to the language switcher, you can do so in WPML -> Languages -> Edit the language switcher (it could be in a menu, in the footer or a custom language switcher) -> Select the option to show the name of the languages and Save the changes.

This will add content to the HTML.

Relevant Documentation:

This topic contains 5 replies, has 2 voices.

Last updated by Carlos Rojas 2 months ago.

Assigned support staff: Carlos Rojas.

Author Posts
August 13, 2019 at 5:04 am #4385071

zsoltE-2

Hi,
The HTML of the language switcher is the following:

<a href="...."><img class="wpml-ls-flag" src="..." alt="en" title="English"></a>

This is not a valid HTML, consequently the screen readers read nothing.
?How can I set up a valid HTML for the language switcher. If it is not possible, can I change the HTML using a WPML filter?

Regards, Zsolt

August 13, 2019 at 10:08 am #4386893

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hello Zsolt,
Thank you for contacting WPML support.

I'm sorry but I don't understand what do you mean by this HTML is not valid? Could you elaborate a little more so I can have a better understanding?

If you need to create a custom language switcher please visit this link where you will find our official documentation on how to accomplish this: https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/

Kind regards,
Carlos

August 13, 2019 at 10:36 am #4387085

zsoltE-2

Hi Carlos,
Thanks for your answer.

Not valid means that HTML <a></a> tag has to include content, cannot be empty.

I would not accomplish a brand new link. I only want to filter and add content to the <a> </a>element.

Is it possible?
Regards, Zsolt

August 13, 2019 at 10:51 am #4387179

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi Zsolt,

If you desire to add the names of the languages to the language switcher, you can do so in WPML -> Languages -> Edit the language switcher (it could be in a menu, in the footer or a custom language switcher) -> Select the option to show the name of the languages and Save the changes.

This will add content to the HTML.

Could you tell me if this is solves your issue or do you need to set some specific content within the links?

Regards,
Carlos

August 13, 2019 at 10:55 am #4387183

zsoltE-2

This was what I need! Thank you.

August 13, 2019 at 10:57 am #4387235

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi Zsolt,

I'm glad to hear that the issue is solved 🙂

Please don't hesitate to contact us if you need our help in the future with WPML. We will be more than happy to help.
Best regards,
Carlos