Odoo GeoIP Website Language Select Automatically

Odoo GeoIP

Probuse Admin

In server environment, I have below line in odoo.conf file:

geoip_database = /usr/share/GeoIP/GeoLiteCity.dat


And I have done this to have the file in the designated directory:

wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz && gunzip GeoLiteCity.dat.gz && mkdir /usr/share/GeoIP/ && mv GeoLiteCity.dat /usr/share/GeoIP/

Once you install geoIP then you do not need to do anything special or configuration, Odoo will take care of remaining parts..

You can see how Odoo fetach geoIP details with this method: https://github.com/odoo/odoo/blob/10.0/addons/website/models/ir_http.py#L108

So if it found then it will convert website lang into User/customer country code.

Below is print of open method:
GeoIP.open(geofile, GeoIP.GEOIP_STANDARD):::

<GeoIP object at 0x7fb7e8dd98d0> ['charset', 'country_code_by_addr', 'country_code_by_name', 'country_name_by_addr', 'country_name_by_name', 'last_netmask', 'org_by_addr', 'org_by_name', 'range_by_ip', 'record_by_addr', 'record_by_name', 'region_by_addr', 'region_by_name', 'set_charset'] 

Thank you,

Mustufa Rangwala

Skype: mustufa_probuse