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

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

WPML_GeoIP_IPResolver.class.php #14

Closed dripppple closed 6 years ago

dripppple commented 8 years ago

Hey, I followed your readme but I cant understand what I should do in the WPML_GeoIP_IPResolver.class.php

My site is in english

homepage.com

But when someone from Sweden enter I want it to redirect to

homepage.com/sv

You say I should modify the language_mappings and default_language but to what?

   //Array with structure MaxMind Code => WPML Code 
   $this->language_mappings = array(
   'US' => 'en', //USA
   'SE' => 'sv', //Sweden
        );**
    //Set the default WPML language which is used if no matching language is found
    $this->default_language = 'en';

Whats wrong here?

andrekutianski commented 8 years ago

In default WPML language you set the default language if the language referenced in array is not found, ex, my country is Brazil (BR) and you dont mapped a language for this country, the default is $this->default_language = 'en';