GeoIP Language Redirect

Component ID

2023185

Component name

GeoIP Language Redirect

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

3420

Component created

Component changed

Component body

This module redirects users entering the site to a translation based on their GeoIP.

Features

  • Redirect users based on an arbitrary mapping between countries (as detected by GeoIP) and languages.
  • Works well with caches.
  • Avoid circurlar redirects.
  • Only redirect browsers (User-Agent string whitelisting).

Usage

  1. Install.
  2. Set up a variable geoip_mapping with an array with ISO country codes mapped to language codes. Example
    variable_set('geoip_redirect_mapping', array(
      'GB' => 'en',
      'FR' => 'fr',
      …
    ));
    

Dependencies

  • The geoip PECL module.
  • psr0 for Drupal 8 / PSR-4 compatible class autoloading.

Todo

  • Provide a user-interface for setting up the country-language mapping.
  • Provide reasonable default mapping.