Page MenuHomePhabricator

Update format of German XTool articleinfo output
Closed, ResolvedPublic

Description

At dewiki we use XTools “articleinfo” via https://www.mediawiki.org/wiki/XTools/ArticleInfo.js. Requests such as https://xtools.wmflabs.org/api/articleinfo/de.wikipedia.org/Wikipedia:Fragen_zur_Wikipedia?format=html&uselang=de result in the output:

(image) 97,990 Versionen seit 2012-06-03 (+20 Minuten), 7,279 Autoren, 3,064 Beobachter, 17,024 Seitenaufrufe (30 Tage), erstellt von: Inkowik (143,893) · Alle Seitenstatistiken

Please reformat the output as follows:

  • dates from YYYY-MM-DD to German j. F Y (as in PHP's date function: http://php.net/manual/de/function.date.php; example: "3. September 2017")
  • numbers should have "." (point) as thousands separators (only if number is larger than 9999), and "," (comma) as decimal separators
  • the trailing link "Alle Seitenstatistiken" should use https instead of http

XTools version: 3.1.1-14e0ce3

Event Timeline

MusikAnimal subscribed.

I think we'll need to use [[ http://php.net/manual/en/function.setlocale.php | setlocale ]] in conjunction with [[ http://php.net/manual/en/function.strftime.php | strftime ]] and [[ http://php.net/manual/en/class.numberformatter.php | NumberFormatter ]]. Either way I'm pretty sure we're not handling number/date formatting very well across the entire application, which we definitely need to fix. The dates are all in ISO 8601, so hopefully everyone is able to make sense of them, albeit not in the localized format.

PR: https://github.com/x-tools/xtools/pull/101

@MisterSynergy I was able to get all the numbers formatted according to the current language (not yet deployed), but I wanted to let you know I will have to decline the request to format the dates -- for now. You can't really assume people want a particular date format. For instance for English we have American, British, and Australian, which prefer different date formats. We are able to look at the request headers and get the particular variation (en-US vs en-GB, etc.), but sometimes the suffix isn't there, and we may end up with a format the user does not desire. To keep it neutral, I think we should stick with the ISO 8601 standard. Hope this is OK!

Okay thanks for the numbers! I understand the issue with date formattings, so let’s indeed not do it right now.

Okay thanks for the numbers! I understand the issue with date formattings, so let’s indeed not do it right now.

No problem. The number formatting has been deployed. The last link still goes to HTTP and not HTTPS, which I can fix, but it at least redirects to HTTPS now :)

@MusikAnimal the last link seems broken now, but I am not sure whether that is related to this update. It redirects to HTTPS, but does not find the target page.

Example: de:Wikipedia:Fragen zur Wikipedia points to http://xtools.wmflabs.org/app.php/articleinfo?project=de.wikipedia.org&article=Wikipedia%3AFragen%20zur%20Wikipedia, which in turn redirects to https://xtools.wmflabs.org/articleinfo with the error message Wikipedia%253AFragen%2520zur%2520Wikipedia does not exist.

@MusikAnimal the last link seems broken now, but I am not sure whether that is related to this update. It redirects to HTTPS, but does not find the target page.

Example: de:Wikipedia:Fragen zur Wikipedia points to http://xtools.wmflabs.org/app.php/articleinfo?project=de.wikipedia.org&article=Wikipedia%3AFragen%20zur%20Wikipedia, which in turn redirects to https://xtools.wmflabs.org/articleinfo with the error message Wikipedia%253AFragen%2520zur%2520Wikipedia does not exist.

Yeah I noticed that too... looks like it's only for pages with a space in it. Working on a fix as we speak!

the last link seems broken now, but I am not sure whether that is related to this update. It redirects to HTTPS, but does not find the target page.

This should be fixed now. Sorry it took so long!