Wrong description language for Nearby upload
Steps to reproduce:
- Change the sandbox item's geolocation to somewhere near you (or use FakeGPS or scroll to its current location and press "Search in this area") and change its "instance of" to "embassy", remove its "image" if it has one.
- Change your Android language to Hebrew (might work with other non-English languages)
- Open the app, tap "Nearby"
- Find the sandbox item
- Tap the + and upload a picture for it.
- The proposed description is in Upper Sorbian instead of Hebrew.
There are two problems with this:
- If "embassy" had no label for Hebrew and the app had to fallback to Upper Sorbian, then the description's language selection dropdown UI should have "hsb" selected instead of "iw"
- Actually "embassy" (https://www.wikidata.org/wiki/Q3917681) HAS a label for Hebrew. Not sure why it was not used. Upper Sorbian is the latest language a label has been added for, that might be why (https://www.wikidata.org/w/index.php?title=Q3917681&action=history). In any case it is a bug.

Another example:
description should not be set to en, it should be set to ja because the description is in Japanese.

I think the cause of the problem is that the SPARQL request coalesces languages, and we have no way to know what language was used:
SAMPLE(COALESCE(?itemLabelPreferredLanguage, ?itemLabelAnyLanguage)) as ?label
As you can see, the label in language itemLabelPreferredLanguage is used if it exists, but if it does not exist, a label in any other language is used (randomly and we don't know which one).
Solution
When the user proceed with uploading a picture for that nearby item, we should run another request on that particular item only, that gets us all language-label pairs, and either take only the one we had displayed to the user, or even add all of them.
hello @nicolas-raoul and @Kota-Jagadeesh , if there's still room for this, I can take it up
@joeMba You already have two assigned issues with no pull request. Better do one by one. Thanks :-)
8. @joeMba You already have two assigned issues with no pull request. Better do one by one. Thanks :-)
Noted with thanks @nicolas-raoul . I left a comment on this issue though that was requesting for guidance on.
Hi @nicolas-raoul, I looked into this and I'd like to work on it.
The COALESCE query from 2019 isn't used anymore. Wikidata now tells the app which language the label came from, so the original case should be gone. But two cases are still wrong:
- On the "Is this a picture of X?" prompt, the description is filled as "label (description)" but tagged with the label's language only. So if the label is in Hebrew and the description only exists in English, you get
שדה פרפרים (sculpture by Dudu Gerstein)tagged ashe(Q56696204, in Tel Aviv). - If an item has no label in any of our fallback languages, the app pre-selects
bug(Buginese) and puts the Q-id as the caption. This even overrides the default language set in settings.
Both come from Place.from in Place.java, so I'd fix it there:
- if the label and description are in different languages, use only the label (like you suggested above, and the Nearby tab already shows only the label)
- if the label has no language, fall back to the user's default language
- add unit tests for both
Could you assign it to me?
Assigned to you, @Medhansh-741! Thanks!