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 3 replies, has 2 voices.

Last updated by Bruno Kos 1 year, 11 months ago.

Assisted by: Bruno Kos.

Author Posts
May 23, 2023 at 12:10 pm #13698697

anssiL-3

Hi!

We have logged that many of our users will end up to our default language (FI) instead of Swedish sv-SE even though that the translation exists. This however happens quite often with Apple or Android Webview and not with Chrome or Safari. Other question is that how can we redirect those visitors who's browser language is not in our language list to other language than our default language? We would like to redirect visitors to EN if browser language is not recognized

May 23, 2023 at 1:35 pm #13699973

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

I can see that you have this active: https://wpml.org/documentation/getting-started-guide/language-setup/automatic-redirect-based-on-browser-language/

You can also check which options it offers - perhaps you have the second one chosen.

In any case browser redirection relies on the browser language of your site visitors and proper language codes so that the browser can recognize the language code and therefore redirect, but this is as far as it goes with WPML.

Regards,
Bruno Kos

May 23, 2023 at 2:20 pm #13700419

anssiL-3

Hi Bruno and thank you for your reply. Any idea how I should add those language codes in wpml so that customers will end up in the right translation? I see that for example au-en and uk-en will take the visitor to English site, but from where I could add for example nb, no, nb-no to point all to our Norwegian site?

Also is there a possibility to redirect visitors with unknown browser language to some other translation than default translation?

May 24, 2023 at 9:28 am #13705331

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Can you check this?
https://wpml.org/forums/topic/redirection-to-language-based-on-browser-language-doesnt-work/#post-12761031

I believe it is the same question, so this will be about choosing the proper language codes, however you can check the browser settings to see which language code it accepts.

Have a look at this screenshot, it is coming from Firefox and these are the language codes browser would expect before changing the language automatically according to browser language.

"Also is there a possibility to redirect visitors with unknown browser language to some other translation than default translation?"

There is no native option for this but you can check our hooks, perhaps you can code something custom based on it.

https://wpml.org/wpml-hook/wpml_browser_redirect_language_params/
https://wpml.org/wpml-hook/wpml_enqueue_browser_redirect_language/
https://wpml.org/wpml-hook/wpml_browser_redirect_language_params/
https://wpml.org/wpml-hook/wpml_enqueued_browser_redirect_language/

Or check with our https://wpml.org/contractors/ to assist on this.

Regards,
Bruno Kos

firefox.jpg