• Resolved prophocie

    (@prophocie)


    Support,

    I have looked everywhere online for months and can’t seem to figure it out.
    I’m using qTranslate X 3.4.2 and WordPress 4.2.2.

    *For privacy reasons, I’m unable to provide you with a link to the current development site.

    THE PROBLEM
    Switching to the default language (en) using the language switcher causes the current page (second language, ja) to be refreshed – It doesn’t go to the default language page.

    Switching to the second language from the default language works fine (www.mysite.com, select Japanese from the language switcher, and https://www.mysite.com/ja/ is loaded).

    Now on the second language (www.mysite.com/ja/), selecting English from the drop down does not go back to the English version (www.mysite.com); the current page just refreshes. I also noticed that the url for the English link in the language switcher has the ‘en’ prefix – this shouldn’t be there if ‘pre-path’ and ‘hide default url’ are selected, right?

    If I uncheck ‘hide default url’, everything works fine – switching back and forth using the language switcher works as it should. However, the default language shows the prefix, which I don’t want.

    WHAT I WANT
    I want to hide the language prefix of the default language (en) and be able to switch to the default non-prefixed language version from the second language.

    Like this:
    // Select Japanese from default en homepage
    https://www.mysite.com -> https://www.mysite.com/ja/

    then, from:

    // Select English to return to the default homepage (no en prefix)
    https://www.mysite.com/ja/ -> https://www.mysite.com

    Current Settings

    • Fresh WordPress install
    • Fresh qTranslate X install
    • English default language
    • Only Japanese enabled
    • SELECTED – “Use Pre-Path Mode (Default, puts /en/ in front of URL). SEO friendly.”
    • CHECKED – “Hide URL language information for default language.”
    • CHECKED – “Show displayed language prefix when content is not available for the selected language. “
    • CHECKED – “Detect the language of the browser and redirect accordingly.”
    • UNCHECKED – “Disable language client cookie “qtrans_front_language” (not recommended).”
    • All other options are DEFAULT

    Recreating the Problem
    Use any fresh install of qTranslate X and one other language, such as Japanese. Apply the settings above.

    1. Go to the default non-prefixed homepage: ex, https://www.mysite.com
    2. Select the second language from the language switcher
    3. User is taken to the second language version of the page: ex, https://www.mysite.com/ja/
    4. From the second language version of the page, select the default language
    5. User is NOT taken to the default language of the page (www.mysite.com). The current second language page (ex, https://www.mysite.com/ja/) is refreshed. The destination url on the language switcher for the default language is also prefixed ‘www.mysite.com/en/’.

    Any help in this matter would be GREATLY appreciated – this has been driving me insane for months.

    Thank you,
    Jacob

    https://www.ads-software.com/plugins/qtranslate-x/

Viewing 15 replies - 1 through 15 (of 39 total)
  • Plugin Author Gunu

    (@grafcom)

    @prophocie

    have you tried it with a default WP theme?

    Thread Starter prophocie

    (@prophocie)

    @gunu

    I tried the default twenty-fifteen and had the same results. Still redirected/refreshed.

    How can I solve this?

    Thread Starter prophocie

    (@prophocie)

    @gunu

    I got it working on the twenty-fifteen theme.
    I don’t know why it didnt’ work before.

    I just used the function:
    <?php echo qtranxf_generateLanguageSelectCode('both'); ?>

    BUT. The problem still remains for my theme.
    If I add:
    <?php echo qtranxf_generateLanguageSelectCode('both'); ?>

    I still get the redirect/refresh. It doesn’t switch. Grr.

    Thread Starter prophocie

    (@prophocie)

    Any update on this?

    Thread Starter prophocie

    (@prophocie)

    @gunu

    Any ideas or steps would be greatly appreciated.

    Thanks.

    Thread Starter prophocie

    (@prophocie)

    @john Clause

    Any idea why it would work on a default WordPress theme and not mine?
    What does this signal? Where should I look next?

    Thanks,
    Jacob

    Plugin Author Gunu

    (@grafcom)

    @prophocie

    does it work with the widget and/or menu language switcher?

    Thread Starter prophocie

    (@prophocie)

    Nothing works for my current theme.
    However, the widget and menu language switcher work just find on the default twenty-fifteen theme.

    Plugin Author Gunu

    (@grafcom)

    @prophocie

    If everything is fine with the standard theme then please talk to the author of your theme. If they turn to us, we’ll be more than happy to co-operate.

    I encountered the same issue with Firefox while Google Chrome worked well. The site in question has english and german content. German is the main language. Switching from DE to EN worked well. But i could not switch back and even calling the URL with trailing /de/ forwarded to /en/. I have cleared the browser cache and cookies about 20 times to no avail. Then I realized my Firefox had only the English language installed. I added German, cleared the cache and cookies again and the issue is gone. Now i can switch languages in Firefox as well. Maybe this helps you too.

    Thread Starter prophocie

    (@prophocie)

    @gunu
    I’ll talk to them and investigate further. Thanks for the help.

    @mensmaximus
    It works on the default WordPress themes so I don’t think it’s a language issue.
    Thanks for the tip though.

    Thread Starter prophocie

    (@prophocie)

    @gunu
    Wait! It’s not working now on the default theme – it won’t switch back to the default language!

    I don’t think I changed any settings to cause it to stop working. I cleared cookies and cache but it didn’t help. Any ideas?

    Thread Starter prophocie

    (@prophocie)

    @gunu @mensmaximus
    Strange! It works on Firefox but not Chrome! Any reason why? I readded Japanese to Chrome but it didn’t fix it.

    Thread Starter prophocie

    (@prophocie)

    If I uncheck “detect browser and redirect” and check “disable language cookie” switching works in FF (not chrome). Chrome doesn’t work no-matter the setting.

    Thread Starter prophocie

    (@prophocie)

    @gunu
    I cleared cache and cookies again for Chrome and restarted the browser.

    If I uncheck “detect browser and redirect” and check “disable language cookie” switching works in Chrome as well now.

    Why do I need these settings like that to work? Shouldn’t I be able to switch through the language switcher with detect browser checked and disable language cookie unchecked (cookies on)?

Viewing 15 replies - 1 through 15 (of 39 total)
  • The topic ‘Can't switch to default language using language switcher – causes redirect’ is closed to new replies.