Last modified: 2010-03-08 22:33:09 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 T24764, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22764 - uselang parameter for action=parse?
uselang parameter for action=parse?
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.16.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-08 09:33 UTC by Lupo
Modified: 2010-03-08 22:33 UTC (History)
6 users (show)

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


Attachments

Description Lupo 2010-03-08 09:33:27 UTC
Could we have a uselang parameter for action=parse, please?

Background: the Commons uses a {{LangSwitch}} template to provide content in the user's interface language (license templates, the {{information}} template, and others). This works pretty well (from a user perspective; I don't know if it's actually 100% sound what they do, see bug 14404... but I guess if it really weren't OK, it would've been shut down long ago.) It even works when a file description page is viewed at another wiki (non-local file).

However, if we want to get information through JavaScript from some other wiki about a file on the Commons (such as the file description), we cannot use a direct API call at the commons due to cross-domain restrictions. Using an importScript with a callback works, but treats the user as a non-logged-in anon. So you can't present, through JavaScript, information from the Commons respecting the user language setting. (A local API call would just return information about the non-existing local file or file page, so that's no good either.)

With a uselang parameter for action=parse, that'd be possible. (If that uselang parameter was honored even if the user is treated as an anon, that is.)
Comment 2 Roan Kattouw 2010-03-08 20:16:03 UTC
(In reply to comment #1)
> (given that its not documented to work as such, i have no idea if that is a
> "feature" or a "bug").

You're right, this works by accident. It should be documented and given a different name for stability (who knows if this'll break when someone moves the uselang processing code to some other place).
Comment 3 Lupo 2010-03-08 21:08:05 UTC
Hm. That's what I get for just looking at the documentation (and I even did look at ApiParse.php, but didn't and don't see it there either). Next time I'll just experiment the hell out of it. :-)

Anyway, where's that uselang handling?

Could we keep it without renaming the parameter?
Comment 4 Sam Reed (reedy) 2010-03-08 21:26:42 UTC
Presumably one of the parameters is passed into the parser or something...

Roan, if you decide how you want to do it, i'll take care of it
Comment 5 Roan Kattouw 2010-03-08 21:38:19 UTC
I'm fine with keeping the param name on principle. I think uselang is handled by the code that initializes $wgLang (Setup.php or something). The best way to go about this IMO would be to call the parameter uselang and check that $wgLang doesn't just happen to already be in the right language (as long as uselang works the way it currently does. this will always be the case) so we can do $lang = $wgLang; instead of creating our own Language object.
Comment 6 Sam Reed (reedy) 2010-03-08 22:33:00 UTC
r63428

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


Navigation
Links