Fix Bug 40714 - ULS geoclient needs proper interface

Change-Id: Id8d7356ec75e8652c75927736a60b916dd069c28
This commit is contained in:
Santhosh Thottingal
2012-10-13 10:50:03 +05:30
parent 702d45286e
commit c19c0b4db7
3 changed files with 7 additions and 3 deletions

View File

@@ -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.
*/

View File

@@ -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",

View File

@@ -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 ) {