Page MenuHomePhabricator

Parser functions do not format dates in Sorani Kurdish correctly
Open, Needs TriagePublicBUG REPORT

Description

Hi, I am using the Scributno Lua extension for writing modules on ckb.wikipedia.org. What formatting does mw.wikibase.entity:formatStatements use for dates? Currently the formatting is incorrect. Where can I fix it?

Example: 1925-06-30
Formatted as: 30 Huzayrani 1925
Should be formatted as: 30y Huzayrani 1925

Notice the 'y' after '30'
Note: ckb uses arabic alphabet, I translated it into latin alphabet for clarity

Event Timeline

Aklapper changed the task status from Open to Stalled.Aug 18 2020, 6:58 PM

Hi @mhmd_azeez, thanks for taking the time to report this and welcome to Wikimedia Phabricator! Please always follow https://www.mediawiki.org/wiki/How_to_report_a_bug and provide steps to reproduce which allow someone else to see the problem, in this case a full link to see the problem. Thanks again!

@Aklapper

Unfortunately the module I am working on has become a little too long for a repro. But here is an isolated repro:

In ckb.wikipedia.org create a module like so:

local entity = mw.wikibase.getEntity('Q42')
local date_of_birth = entity:formatStatements('P569').value
mw.log(date_of_birth)

Expected log:

<span><span>١١ی ئازاری 1952</span></span>

Actual log:

<span><span>١١ ئازاری 1952</span></span>

Notice the ی that's missing after ١١ in the actual log.

Is this (https://github.com/wikimedia/mediawiki/blob/8e7843197e305020f35ba883fcef39a83ad1ebce/languages/messages/MessagesCkb.php#L157) the place where the formats are defined? How can I send a PR to fix it?

If you need it, I can create a test module for you. I just didn't want to litter the public wikipedia with test modules.

$defaultDateFormat = 'dmy' and 'dmy date' => '‏jی xg Y' (<- with ی) in that file look like what you want the modules to output. So it seems Wikibase does not understand them (or use them). Having T258886 resolved might help fix this.

@matej_suchanek Thank you for your reply. Do you think that other task would be resolved anytime soon? Otherwise we might have to deal with it in Lua.

Is there any way currently in MediaWiki Lua to parse string dates? I could use it to reformat the date to be the way that I expect it. I have already tested it and it works fine. Although I prefer it if it's fixed in MediaWiki itself.

Aklapper changed the task status from Stalled to Open.Aug 18 2020, 10:47 PM

Do you think that other task would be resolved anytime soon?

Sorry but I don't know. It could be tomorrow but also the next year.

Is there any way currently in MediaWiki Lua to parse string dates?

{{#time: }} can parse ISO dates and is implemented as https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#mw.language:formatDate in Lua. You can use https://cs.wikipedia.org/wiki/Modul:Wikidata/Formatters/time for inspiration.

matej_suchanek renamed this task from Where I can change date formatting? to Parser functions do not format dates in Sorani Kurdish correctly.Aug 19 2020, 7:47 AM
matej_suchanek updated the task description. (Show Details)
Michael added a project: I18n.
Michael changed the subtype of this task from "Task" to "Bug Report".

Moving this to our Radar; we hope that the Wikidata Integrations Team can pick this up (maybe in collaboration with the Wikidata.org team).