Last modified: 2008-01-20 14:21:58 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
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