Last modified: 2013-11-12 09:03:20 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T58053, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 56053 - JS messages API should (probably) be able to discern the gender of any username, like the PHP one
JS messages API should (probably) be able to discern the gender of any userna...
Status: NEW
Product: MediaWiki
Classification: Unclassified
Internationalization (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: i18n, javascript
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-23 17:35 UTC by Mark Holmquist
Modified: 2013-11-12 09:03 UTC (History)
8 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Mark Holmquist 2013-10-23 17:35:46 UTC
https://gerrit.wikimedia.org/r/86172

This dirty, dirty hack brought to you by the fact that the JS messages API only accepts a user object (which means, it only accepts the current user) or "male" or "female" as its arguments to GENDER. I should really be able to pass in the username of _any_ user on the site, like I can on the PHP side.

Fun fact: This will introduce an asynchronous leg to the message parser on the client side.

Potential solution: Have an *optional* argument to the message parser that will be an update callback. Once the API returns the data we need to parse the message, we cache it and callback with the final message contents. Before then we pass back "unspecified" messages. They'll be updated within seconds. The problem with this is that it becomes the responsibility of the user to run the update - they're no longer just dealing with strings.
Comment 1 Siebrand Mazeland 2013-10-23 18:09:51 UTC
Santhosh, as you initially implemented GENDER support in JavaScript, any thoughts?
Comment 2 Santhosh Thottingal 2013-10-24 04:51:30 UTC
Mark already explained it very well. The message parser(basically jqueryMsg) did not want to have responsibility of a server call and return asynchronously or do a callback execution once the server is responded. The easiest solution at that time was giving the responsibility of figuring out the gender to the user of message parser. For eg, An extension can do the async call to get user object based on user id and in the success callback, render the message using mw.msg. Just like https://gerrit.wikimedia.org/r/86172

Ideally mw.msg should not be bothered about collecting the data using apis, but only about parsing.

Better ideas are welcome.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links