Hi i18n folks,
I'm working on a wiki at the moment that has two different
languages, which need different fonts (English and Ancient Greek).
I'm setting the font with CSS using font-family (the same way it's
done in the WebFonts extension, but I'm just using my own little
extension for now), matching <span lang="mylang"> tags as appropriate.
However it's annoying to have to manually specify which language is
being used, when the range of characters contains this information.
So I wrote a little extension which automatically adds the needed
span tags before outputting the HTML. This means the correct font
will be chosen automatically.
I'm posting it here for a few reasons:
1) In the hopes that it may be useful to others (if it is seen as
generally useful I'll add it to the wiki).
2) In case there's a better way to do this that I haven't thought
3) So somebody can pick holes in the code, if there are any.
The major flaw in it at the moment is that you can only specify one
set of characters and language attribute, so it won't work well for
wikis with multiple different scripts. This could probably be fixed
by using global variables to set things up more smartly.
The attached .php file is the whole extension. Any feedback would be
very warmly accepted.