diff --git a/UniversalLanguageSelector.php b/UniversalLanguageSelector.php index b9f9c060..a3bc1873 100644 --- a/UniversalLanguageSelector.php +++ b/UniversalLanguageSelector.php @@ -49,8 +49,8 @@ $wgExtensionCredits['other'][] = array( * ULS can use geolocation services to suggest languages based on the * country the user is vising from. Setting this to false will prevent * builtin geolocation from being used. You can provide your own geolocation - * by setting window.GEO to object which has key country_code. This is what - * Wikipedia does. + * by setting window.GEO to object which has key 'country_code' or 'country'. + * This is what Wikipedia does. * * The service should return jsonp that uses the supplied callback parameter. */ diff --git a/resources/js/ext.uls.geoclient.js b/resources/js/ext.uls.geoclient.js index 65a06cfe..7d66530e 100644 --- a/resources/js/ext.uls.geoclient.js +++ b/resources/js/ext.uls.geoclient.js @@ -25,6 +25,10 @@ window.GEO = data; }; + mw.uls.getCountryCode = function () { + return window.GEO.country || window.GEO.country_code; + }; + var settings = { cache: true, dataType: "jsonp", diff --git a/resources/js/ext.uls.init.js b/resources/js/ext.uls.init.js index e1ff9247..fa2b0ae6 100644 --- a/resources/js/ext.uls.init.js +++ b/resources/js/ext.uls.init.js @@ -73,7 +73,7 @@ .concat( mw.uls.getAcceptLanguageList() ); if ( window.GEO ) { - list = list.concat( $.uls.data.getLanguagesInTerritory( window.GEO.country_code ) ); + list = list.concat( $.uls.data.getLanguagesInTerritory( mw.uls.getCountryCode() ) ); } $.each( list, function ( i, v ) {