Last modified: 2014-09-27 01:59:43 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 .
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?
Related: Bug 52661.
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.