mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
#3780 Create media using a combination of Entities & MwQueryResult - update wikicode to align with expected behaviour
This commit is contained in:
parent
6bbf392e32
commit
eb9e94c603
1 changed files with 13 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
|
@ -290,7 +291,18 @@ public class Media implements Parcelable {
|
|||
* @return
|
||||
*/
|
||||
public String getWikiCode() {
|
||||
return String.format("[[%s|thumb|%s]]", filename, getDisplayTitle());
|
||||
return String.format("[[%s|thumb|%s]]", filename, getMostRelevantCaption());
|
||||
}
|
||||
|
||||
private String getMostRelevantCaption() {
|
||||
final String languageAppropriateCaption = captions.get(Locale.getDefault().getLanguage());
|
||||
if(languageAppropriateCaption!=null){
|
||||
return languageAppropriateCaption;
|
||||
}
|
||||
for (String firstCaption : captions.values()) {
|
||||
return firstCaption;
|
||||
}
|
||||
return getDisplayTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue