[Bug]: Deletion requests are added to the log with the date written with user's native number system instead of with Arabic numbers
Summary
When the user's native number system is another than Arabic (0-9), any user nominating a file or any other page for deletion add these to the logs with the date written in their number system, for example for example Commons:Deletion_requests/২০২৩/০৭/০৬. And here are the rest I've found. In these pages the pattern is the same but instead of Arabic numbers, there are two with Bengali numbers and the rest with Persian Arabic numbers. The creation of these pages all have the //android app edit// tag and the users probably have another number system than the Arabic one 1-9 resulting in non-Arabic numbers incorrectly being used. So instead of these users adding the deletion request to the normal logs, they add it to the log based on their number system.
Steps to reproduce
Not having the app or an Android myself I would suspect the way to reproduce would be:
- Have a native number system other than Arabic (i.e. Bengali och Persian Arabic)
- Open the app
- Nominate a page for deletion
Expected behaviour
The deletion request is transcluded to the log based on Arabic numbers no matter what native number system the user has, so for today it's Commons:Deletion_requests/2023/08/07
Actual behaviour
The deletion request is transcluded to the log based on the user's native number system, so Commons:Deletion_requests/2023/08/07 if it's Arabic, Commons:Deletion_requests/۲۰۲۳/۰۸/۰۷ if it's Persian Arabic and Commons:Deletion_requests/২০২৩/০৮/০৭ if it's Bengali.
Device name
Android version
Commons app version
Device logs
Screen-shots
Would you like to work on the issue?
Prefer not
Thanks for spotting and reporting this!
The date seems to be in the default locale indeed. So the fix should be using English or something similar instead. https://github.com/commons-app/apps-android-commons/blob/a620cc9de686687e160ce51c373b10a0886c7421/app/src/main/java/fr/free/nrw/commons/delete/DeleteHelper.java#L95-L96
- What might be more complicated is finding a way to properly unit-test it. Do we need to use ArgumentCaptor perhaps?
- Do we want to use
Locale.ENGLISHorLocale.ROOT? (I see both in other date-related things in the code.)
I can see what works best to allow Bengali numbers to work better.
Am finding it quite hard to understand this issue @nicolas-raoul @Jonteemil. Someone please help me understand it
Steps to reproduce (not tried):
- Switch to a locale that write dates and numbers in a very different way from English, for instance Bengali seems to express dates this way: ২০২৩/০৮/০৭
- In the Commons app, go to Explore > Uploaded via mobile
- Find an image that has no place on Commons, for instance something obviously copyrighted (that can take several minutes of scrolling)
- Tap the image, scroll down, tap the red button (in English it is
Nominate for deletion). - Enter a reason and send
- On the Commons website, check your contributions, you will see that the app created (via your identity) a paragraph to a deletion page.
- Check whether the date in the deletion page title is like https://commons.wikimedia.org/wiki/Commons:Deletion_requests/2026/11/09 (correct) or not (incorrect).
Hi @nicolas-raoul, I'd like to work on this one.
The log page date comes from this line in DeleteHelper.kt:
val sdf = SimpleDateFormat("yyyy/MM/dd", Locale.getDefault())
With a Bengali default locale this gives ২০২৩/১১/০৭ (Persian and Egyptian Arabic also get their own digits), which is how pages like Commons:Deletion_requests/২০২৩/০৭/০৬ were created. The day, month and year passed to {{delete}} are already locale-independent, so only this date needs a fixed locale.
The same pattern is in PageContentsCreator.kt: when an upload's date doesn't come from EXIF, it is written into {{Information}} with SimpleDateFormat("yyyy-MM-dd") and the default locale. I'd fix it in the same PR unless you'd rather have a separate issue for it.
I'll add unit tests that run with a Bengali default locale, since the JVM reproduces the native digits too.
@Lemeri123 if you were planning to pick this up after Nicolas's steps, just say so and I'll leave it to you.
The fix is in #7284. It covers both the deletion log page date and the upload date written into {{Information}}, with unit tests that run in a Bengali locale.