4 Dec 17:39
UI API changes
Andrew Plotkin <erkyrath <at> eblong.com>
2005-12-04 16:39:32 GMT
2005-12-04 16:39:32 GMT
Been slow on the devel list recently. This is not because we've slowed down; it's because Andy Turner and I have been working on Volity code in Jmac's dining room. Here are the things I am wanting to throw in: 1: A new "ui" namespace for translation tokens. We currently have "volity.*" tokens, which are sent by generic referee code, and are built into the client -- see wiki [[RPC_Replies]]. And we have "game.* tokens, which are sent by game-specific ref code and are built into the UI package. While working on a UI, I realized that I also wanted some tokens that were defined in the UI package and only used *by* the UI code. (UI code can translate a token to a string with the localize() API, and then stick the string into a <text> element or whatever.) My current implementation uses "game.*" tokens for this purpose, but I have to be careful to avoid colliding with the tokens defined in the ruleset. And hey -- that is exactly what namespaces are for, right? I could use the XML entity localization system for this, but that turns out to be a bit of a nuisance to use inside ECMAScript code. Because you generally want to wrap your script code in a CDATA[[]], so that you can use literal < and > signs. But then XML entities aren't translated. It's possible to work around this, but it's more lines of code. Also, the XML entities don't do interpolation, which is handy for what I want. (I'm generating strings like "What do you want your \1 to attack?" Where the \1 is filled in with another token that translates to a card(Continue reading)

RSS Feed