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

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

Always redirect when local content available #11

Closed apancutt closed 8 years ago

apancutt commented 8 years ago

Currently, the user is only redirected once per cookie lifetime.

A typical user journey:

  1. User from Spain visits www.mysite.com
  2. IP detected as Spain, redirected to www.mysite.com/es/
  3. User returns to www.mysite.com later in the day
  4. User is not redirected to Spanish content

This is a different experience to previous visit, which is confusing our users.

This patch will continue using cookies to cache the browser language but will always redirect when local content is available.

khromov commented 8 years ago

Hey @apancutt

I see the problem you are having. For some background, forced redirects weren't implemented because a lot of people don't want to view the page in a forced language.

Consider for example an Englishman living in Spain being forced to read the site in spanish, or a Canadian being forced to read in French even though Canada is bilingual.

Nevertheless, a happy middle ground would be to allow for both non-forced and forced redirect. If you adjust your pull request so that a constant var forceRedirect can be toggled true / and false accordingly, I'd be happy to merge it.

apancutt commented 8 years ago

Sorry, I meant to cancel this PR when I deleted my fork.

I realise that your implementation is intended to mirror the behaviour of the WPML plugin, only using GeoIP instead of the browser settings. Further changes to the behaviour of your plugin would likely cause more implementation/maintenance issues than it's worth.

Instead, as our requirements substantially differ, we've gone for a custom plugin using GeoIP Precision Services and HTTP redirect headers instead of a JS implementation.

Thanks for responding, though.

khromov commented 8 years ago

Thanks, closing this.