Skip Navigation

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 topic contains 4 replies, has 2 voices.

Last updated by alexandreP-37 1 year, 11 months ago.

Assisted by: Andreas.

Author Posts
February 22, 2023 at 2:20 pm #13089875

alexandreP-37

I want to set up the language switcher to handle languages without translation in a way that is not currently offered: show the language as a disabled link.

Current options are:
- Skip language
- Link to home of language for missing translations

Is there a similar example that we can see?

Yes, our current website is like that. You can see it here: hidden link
We have 5 languages, and on this pages, only 3 are available. We prefer it this way so that our users don't get surprised when thinking they will switch the page language, to be redirected to the homepage.

I joined a printscreen just in case.

language-switcher.png
February 22, 2023 at 3:08 pm #13090209

alexandreP-37

Apologies, I forgot to add my question :-). Here it is:

Are there filters / hooks I can use to tweak the language switcher to behave as described above?

February 22, 2023 at 3:48 pm #13090639

Andreas

Hello there

Thank you for contacting us. I am happy to help you.

First of all, I visited the url you shared hidden link and the languages are disabled.

Do you need something else? Sorry for my question, but I was confused a little bit, apologies.

In general we are having this feature if you wish to test it :

https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/#using-the-default-language-as-a-fallback-for-untranslated-content

Otherwise, you can create a custom language swither for your own needs :
I am sharing some examples that might help you. Just to clarify it is not similar to your issue but you can understand how to manipulate the language switcher.

https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/

https://wpml.org/forums/topic/i-want-to-add-custom-link-to-the-language-switcher/

hidden link

I hope this helps. Please let us know how it goes or if you need any further assistance. I'll gladly help you. 🙂

Regards,
Andreas

February 22, 2023 at 4:47 pm #13091223

alexandreP-37

Ah sorry if i wasn't clear.

For a bit of context: our current website is not based on wordpress. It is all static html coded by hand. We are moving it to a WordPress-based cms and thus I'm converting our current website as a theme for the new one, for which we use WPML.
I'm trying to reproduce the same language switcher, this time using WPML.

I think this link you shared shows a direction:
https://wpml.org/forums/topic/i-want-to-add-custom-link-to-the-language-switcher/

I'm going to try that. Will re-open the ticket if it doesn't work.
Thank you!