Last modified: 2008-01-20 14:21:58 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.
I'm on it
meta=allmessages already returns whatever wfMsg() returns. I've added the amlang parameter through which the language can be changed in r29984.