-
-
Notifications
You must be signed in to change notification settings - Fork 38
How to migrate from v1 to v2
In order to preserve backwards compatibility, the new API got new functions:
function geoip_detect2_get_info_from_ip($ip, $locales = array('en')) { ... }
function geoip_detect2_get_info_from_current_ip($locales = array('en')) { ... }
As you can see, you can now indicate a language that you want your labels in. Not all names are translated in all languages, so you can give an fallback order (array('de', 'en')
means "German if possible, English otherwise"). List of supported locales
The old function names return the same data structure as before, only filled with the v2-data.
-
region
andregion_name
: As the data-basis changed, there seem to be less regional coding. Also, the region-ids have changed: now they are two-letter-ISO-Codes. -
timezone
: Similarly, there is less data available. If it is not available, the plugin tries to fill it in - but without a region to rely on this only works in so many countries (ie countries with only 1 timezone).
Content of this documentation is available under Creative Commons Attribution-Share Alike 3.0 Unported License. Feel free to improve it by logging in with a Github user and editing it.