Skip to content

Commit a4238c0

Browse files
denigermaskaravivek
authored andcommitted
commons-app#2332 add param "uselang" in notifications API calls. (commons-app#2555)
The value is the user language. If null or empty the value "user" is used
1 parent b673527 commit a4238c0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java

+6
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,19 @@ public List<Notification> getNotifications(boolean archived) {
566566
}else {
567567
notfilter = "!read";
568568
}
569+
String language=Locale.getDefault().getLanguage();
570+
if(StringUtils.isNullOrWhiteSpace(language)){
571+
//if no language is set we use the default user language defined on wikipedia
572+
language="user";
573+
}
569574
notificationNode = api.action("query")
570575
.param("notprop", "list")
571576
.param("format", "xml")
572577
.param("meta", "notifications")
573578
.param("notformat", "model")
574579
.param("notwikis", "wikidatawiki|commonswiki|enwiki")
575580
.param("notfilter", notfilter)
581+
.param("uselang", language)
576582
.get()
577583
.getNode("/api/query/notifications/list");
578584
} catch (IOException e) {

0 commit comments

Comments
 (0)