Support » Plugin: Polylang » Problem with home page

  • Resolved mavenickster


    For the home page I have created one translation for each language I need. In the settings of the plugin, I checked to set the language according to the browser preferences, but when I open the website I always see the home page in the default language (Italian), even if I set the browser (Firefox) to choose another language (English, Spanish or whatever). What can I do?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Chouby


    The browser preferred language is used only the first time. Once you have visited the website one time, Polylang keeps track of your “preferred language” in a cookie.

    How strange. Here is what I’ve just done, using Firefox:
    1. Deleted all the cookies
    2. Set English as “preferred” language of the browser
    3. Closed the browser
    4. Reopened the browser and typed the address of my home page
    5. The English version appeared
    6. Checked the cookies: there is one named “wordpress_polylang” with value “en”
    7. Closed the browser
    8. Reopened the browser
    9. Checked the cookies: the cookie named “wordpress_polylang” is still there with value “en”
    10. Typed the address of my home page
    11. The ITALIAN (default) version appeared!!
    12. Checked the cookies: now the one named “wordpress_polylang” has value “it”!!

    I don’t know where the problem is: faulty browser or what?

    Plugin Author Chouby


    Not a faulty browser but a choice that I made in Polylang.

    Most probably you checked the option: “Hide URL language information for default language”. So your home page in the default language has no language code.

    At first visit, you requested that the visitor is redirected to its “browser preferred” language. So it’s done. But imagine that after that, your visitor want to visit your homepage in the default language. It is not possible if the redirection is still there.

    So there is no redirection after the first visit (Polylang checks the presence of the cookie whatever its value to decide).

    Yes, I had checked the option: “Hide URL language information for default language”. I unchecked it just to see if there was any difference in the behaviour, but nothing.
    It’s a pity that the user is not redirected every time they visit the home page…

    Plugin Author Chouby


    But I don’t see another way to do. Otherwise the homepage in the default language would never be accessible to people who browsed your site in the non default language before.

    Just imagine. You are an Italian visitor. But for some reason (you are in a company, abroad…) your browser’s preferred language is English. You are first redirected to the English page and then you want to access the Italian homepage, but if the redirection is still there, you are systematically redirected to the English homepage… And your visitor leaves your site unhappy…

    If you don’t hide the language code for default language, then you should automatically be redirected to the home page in the last browsed language.

    Yes I see, yet not satisfied. Consider instead you are an English visitor and want to see the website not in the Italian default language but in English: you visit it now for the first time and get the English version, and you are happy. Then you visit the webite again another day (same bowser, same computer) and you get the Italian version: you leave the website unhappy because you think the English version is not available anymore.

    One note: on my website I’m not going to provide links to the translated version (although I’m using them fior test purposes) but would rather let the browser decide which version to pick.

    Plugin Author Chouby


    I understand your point. You should keep the option “Hide URL language information for default language” unchecked. In that case your visitor will always be redirected to the homepage in his preferred (or last browsed) language.

    I understand what I was doing wrong: actually I had already unchecked “Hide URL language information for the default language”, but after the first time, the visitor always got the Italian version of the website. I realized that I also had to check “The language code, for example /en/, is added to all urls when using pretty permalinks” so they always get their language version (if available).
    OK, now it works, yet there’s still something that makes me unhappy: this way, when you enter the main url of the website, suppose, in my case you are redirected to if you preferred language is Italian, or if you preferred language is English and so on, where “home-page” is the slug of the Italian home page, “home-page-2” is the slug of the English home page and so on…
    I hoped this could be avoided, so that the visitor just sees or (although my aim was to let them not see the “/it” or “/en” part of the url, but now I think it can’t.

    Plugin Author Chouby


    You should check: When using static front page, redirect the language page (example: to the front page in the right language

    Great! It worked! Thank you very much. I think I have solved all my problems now!!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Problem with home page’ is closed to new replies.