• utkusarioglu

    (@utkusarioglu)


    Hello,

    First of all, I’d like to thank you for the beautiful plugin you have written. After trying a few other options, I decided to use your plugin a website I’m building.

    However, I have one issue that I haven’t been able to figure out with my limited coding knowledge. I need the website to display in Turkish for browsers set to Turkish and for the all other languages, I need the website to switch to English.

    The default language on the site is Turkish and it unfortunately has to stay that way.
    I have tried a plugin named Plugin Redirect but I couldn’t make it work, the site gave “too many redirects” error.

    Permalink structure is / for Turkish and /en/ for English.

    I’d be glad if you could help me with this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • maxime

    (@max345)

    Hello,

    First you need to go to sublanguage > languages, select “english” and verify the “locale” box has “en_US” (or add it).

    Now Sublanguage is only considering url to determine the language of a page (it doesn’t use cookies or something). If you enable “autodetect language”, it will check every / url and redirect to /en/ in case it detects the browser language to be english. So if you try somehow to redirect back to /, it may cause a redirect loop.

    The problem is when a user has the browser set to english (or more precisely “en_US”), he won’t be able to read the site in turkish anymore. He will be redirected to english every times.

    The alternative is either to have both english and turkish slug in urls (/en/ and /tr/) or disable the “autodetect language”.

    Does it help you?

    • This reply was modified 8 years ago by maxime. Reason: improve formating
    Thread Starter utkusarioglu

    (@utkusarioglu)

    with the en_US addition, the site does redirect the English browsers to English, thank you.

    I can’t make my default language slug shown because I already have “.tr” at the end of my url and “.tr/tr/” would be too much. So I have to use Turkish as my default language. And this raises two issues:

    1- Languages other than Turkish and English are redirected to Turkish instead of English. (because it’s the default language, I know)
    2- like you said, the site keeps redirecting me to English when I want to view it from an English set browser.

    Is there any way to fix these?
    thank you for your fast reply by the way, I really appreciate it.

    maxime

    (@max345)

    Sorry but there is no way to fix it right now: it is not really a bug, it is actually supposed to work like this.

    But I will try to find a solution for this problem in a future version of this plugin. Thank you for reporting this issue!

    Thread Starter utkusarioglu

    (@utkusarioglu)

    Thank you very much for your help. I will have to use some other plugin for my current project then. But I will certainly use your plugin for sites that have cleaner domain names.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Auto Switch based on browser language’ is closed to new replies.