Last modified: 2008-01-20 14:21:58 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 T14704, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 12704 - api.php interface to wfMsg and wfMsgForContent functions
api.php interface to wfMsg and wfMsgForContent functions
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-20 13:59 UTC by Andrew Dunbar
Modified: 2008-01-20 14:21 UTC (History)
1 user (show)

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


Attachments

Description Andrew Dunbar 2008-01-20 13:59:49 UTC
For a JavaScript extension to use standard MediaWiki interface strings and localization it needs to be able to access the standard MediaWiki message cache in the same way a PHP extension can.

wfMsg() finds a non-localizable message in the message cache, which can be overridden by creating a page in the wiki's MediaWiki: namespace with the same message key.

wfMsgForContent() does the same as wfMsg() but for localized strings. It first looks for the string in the user language then falls back (to the interface language or English or both?)

I have made JavaScript code to reproduce this functionality but it can take several hits to get the right string with action=raw and api.php lets you look up the MediaWiki: pages but not the message cache. So you either waste bandwidth and time or you don't get exactly the same results.

api.php also has meta=allmessages but there is no language option so you can only access the "default" language.

See also Bug 7267.
Comment 1 Roan Kattouw 2008-01-20 14:00:18 UTC
I'm on it
Comment 2 Roan Kattouw 2008-01-20 14:21:58 UTC
meta=allmessages already returns whatever wfMsg() returns. I've added the amlang parameter through which the language can be changed in r29984.

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


Navigation
Links