khromov / wp-wpml-geoip-browser-language-redirect

GeoIP Redirector for WPML (WordPress)
GNU General Public License v2.0
46 stars 17 forks source link

Cookie _icl_current_language always changing to en #16

Closed nikolasuperscript closed 8 years ago

nikolasuperscript commented 8 years ago

Hello, As I noticed, redirection works only on first load, after refreshing initial url, it doesnt redirect anymore.

I saw that in cookie section of chrome, it first puts the correct language code, but after refresh, it changes the value to the default...

Any idea ? I am new, I dont know if I asked the question the right way...

khromov commented 8 years ago

@nikolasuperscript Only redirecting on the first page load is the intended behaviour, we don't want to force users into a potential redirect loop or force them to use the site in a specific language based on their location.

If you have any other issues, feel free to post them here or in a new issue.

nikolasuperscript commented 8 years ago

But if they come again on our website, they will have content in default langauge, it wont redirect them again ?

khromov commented 8 years ago

@nikolasuperscript If they return back the next day and again go to the "wrong" language, they will not be redirected again, this is correct.

The cookie lifetime is set by WPML (not sure if it's configurable though). It seems to be 24 hours. But you can change it manually here: https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/blob/master/js/browser-redirect-geoip.js#L59

khromov commented 8 years ago

If you want to debug it, check the presence of the _icl_visitor_lang_js cookie and its lifetime.