Category Archives: WPML

GeoIP Browser Language Redirect for WPML

logo

I needed to send users reliably to the correct WPML translation depending on the country they came from. The “Browser language redirect” option that WPML provides is a very simple method using the HTTP_ACCEPT_LANGUAGE header. It doesn’t work reliably, and assumes you have named your languages after proper locale names.

GeoIP Redirector for WPML to the rescue!

It uses a GeoIP database (MaxMind) to pinpoint user location more exactly. It also lets you specify your own mappings (user country to language) easily.

Feel free to fork the plugin on GitHub, or download it directly. (Please read README.md for instructions on setting the plugin up.)

Searching for a WPML translation in your database

WPML String Translation only seems to search in the original language (English) and not in existing translations.

So to find which english string corresponds to an already translated text, you can do this:

SELECT * FROM wp_icl_string_translations, wp_icl_strings WHERE wp_icl_string_translations.value="Translated text in any language!" AND wp_icl_strings.id = wp_icl_string_translations.string_id;