11 Aug 2010 04:01
Altering message string output for Javascript
Neil Kandalgaonkar <neilk <at> wikimedia.org>
2010-08-11 02:01:32 GMT
2010-08-11 02:01:32 GMT
I've been trying to figure out if it's possible to slightly change how
message strings are processed, for the particular case of sending them
to a Javascript-heavy application.
The WMF has been working on a lot of interface improvements, and these
things necessarily lean heavily on Javascript.
There are many cases where we want to do some late message parsing on
the client, like
'[$1 Click here to advance to the next item]'
'You have uploaded $1 {{PLURAL:$1|file|files}}'
However there is a lot of other kinds of parsing that could and should
be done on the server, like
'From {{SITENAME}}'
'[[Special:SpecialPages|{{int:specialpages}}]]'
So we have two options, as far as I can tell:
OPTION 1:
Include a wikitext parser in Javascript, that also knows how to fetch
int:strings and other such values when it needs them. This is
undesirable for obvious reasons.
Michael Dale actually did a lot of this already for his JS2 project, and
his solution works. But I'm taking another look at the problem.
(Continue reading)
RSS Feed