Last modified: 2014-09-27 01:59:43 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 T73366, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 71366 - There is no way to obtain the language variant in Scribunto module code
There is no way to obtain the language variant in Scribunto module code
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Scribunto (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: i18n
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-26 18:44 UTC by Amir E. Aharoni
Modified: 2014-09-27 01:59 UTC (History)
5 users (show)

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


Attachments

Description Amir E. Aharoni 2014-09-26 18:44:14 UTC
I tried to write a module that returns different values depending on the language variant of the page in the context of which that module runs.

I couldn't find any function that does it, so I tried to do:
frame:preprocess('-{zh-hans:zh-hans;zh-hant:zh-hant;}-')

This didn't actually do the right thing, because it just returned '-{zh-hans:zh-hans;zh-hant:zh-hant;}-'.

So either it's not really possible now, or I couldn't find a way to do in the docs.

For an example see https://zh.wikipedia.org/wiki/User:Amire80/Lua .
Comment 1 Brad Jorsch 2014-09-26 19:08:29 UTC
I note that the handling of "-{...}-" constructs is done after Scribunto does its thing, so if Scribunto returns "-{zh-hans:zh-hans;zh-hant:zh-hant;}-" it will come out in the HTML as you'd expect.

I'm not really familiar with how the variant stuff works. Does a variant already exist at the point where Scribunto is running, or is the variant not actually "chosen" until later?
Comment 2 Amir E. Aharoni 2014-09-26 19:46:34 UTC
Related: Bug 52661.
Comment 3 Jackmcbarn 2014-09-27 01:59:43 UTC
I don't really think this bug is related to that bug.

Also, I think that adding this functionality would be a bad idea, since it could break the links tables. I'm of the opinion that all per-user elements of the parse should happen after the preprocess is done.

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


Navigation
Links