Page MenuHomePhabricator

NaN display after uploading 2nd image (de)
Closed, ResolvedPublic

Description

Uploading an image in mobile view gives a NaN on the Special:Uploads page at the top of the page.
Requirements:

  • Language is set to de
  • only one image is uploaded yet

Solution:
There are two possible ways to fix this. First one is to remove the "Eine" from the i18n file (de.json ln 258), this text is processed in JavaScript by the parseInt method, giving a NaN as a result (resources/mobile.notifications/init.js ln 65). Second way is to leave the translation this way and check for the result of the parseInt method, returning a "1" if the result is NaN.
I prefer the second way, as I don't know the other languages here. The english one for example has a "1" instead of the word "One", so it's ok here.
I've created the patch according to my prefered way here: https://gerrit.wikimedia.org/r/#/c/216916/

Event Timeline

Tweichart raised the priority of this task from to Needs Triage.
Tweichart updated the task description. (Show Details)
Tweichart added a project: MobileFrontend.
Tweichart subscribed.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 216916 had a related patch set uploaded (by Florianschmidtwelzow):
fix for NaN display

https://gerrit.wikimedia.org/r/216916

Hi,

thanks for reporting this! However, i can't reproduce this locally :/ If i upload one image (and never uploaded an image before) I get this output:
"Eine hochgeladene Datei"

and a list of images, which seems correct to me. Can you upload a screenshot with the problem? Is it a wikimedia wiki?

Hey Florian,

this is the right way. If now you upload the second file you'll get the error, as the counter after the first upload doesn't show an integer but the string "Eine". Uploading the second image, the text in the span here is "Eine ", not a valid integer as it is e.g. in the english translation ;-)

Greetings,
Tobias Weichart

Sorry, i think i misunderstand you :D I uploaded a second file and get:
"2 uploads", which is correct, too :) Maybe you can provide a step-by-step guide to reproduce the problem with pre-conditions? :)

Can you answer my other question, too? Is it a wikimedia wiki or a private one?

This is because mobile-frontend-photo-upload-user-count is incorrectly translated. We should update the qqq code to explicitly say that the contents of the span should be a number

Currently it is:
"mobile-frontend-photo-upload-user-count": "{{PLURAL:$1|<span>Eine</span> hochgeladene Datei|<span>$1</span> hochgeladene Dateien}}",

When it should be:
"mobile-frontend-photo-upload-user-count": "{{PLURAL:$1|<span>1</span> hochgeladene Datei|<span>$1</span> hochgeladene Dateien}}",

Change 216916 abandoned by Tweichart:
fix for NaN display

Reason:
was fixed in translation

https://gerrit.wikimedia.org/r/216916