Language pop up and cookie

Hello dear WPMUDEV support,

I am going to run multicountry multisite with 3 countries and each will have 2 languages.

I need it to separate the content and products.

I already got WPML plugin, but it allows to change the language with out saving it in cookies...
I want that when a customer enters my site, he will choose the country and the language, and it will be saved in his cookies...

Like if i choose usa and mexican language so i always will redirect to us.site.com/mexican

Does its can be done? Or maybe theres already plugins like that or something similar ?

Thank you!

  • Adam Czajczyk

    Hello Alexander,

    I hope you're well today and thank you for your question!

    I did some research on it and it seems that it would require some custom coding to implement such a solution. WPML does save "language cookie" and it also keeps currently selected language in a ICL_LANGUAGE_CODE variable.

    You'd need to create an additional code (e.g. simple plugin) that would read the ICL_LANGUAGE_CODE variable value and save it to your own cookie and then on site load read this cookie and set site language using WPML API.

    This however would be a bit beyond the scope of this forum and you may want to post a question about it on our "Jobs & Pros" job board (please note: no WPMU DEV staff involved!) here:

    https://premium.wpmudev.org/wordpress-development/

    Alternatively, you may also want to take this plugin for a test drive:
    https://wordpress.org/plugins/multisite-language-switcher/faq/

    It's quite a different approach but may be of help and easier to customize if necessary. I must say though that I haven't had a chance to test it yet.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.