Translatable text in tag attributes
| Newsgroups | gmane.comp.cms.xaraya.devel |
|---|---|
| Organization | Xaraya |
| Message-ID | <[email protected]> |
The BL2 compiler in Jamaica treats all template text nodes as
translatable. This means that there is no need to signal translateble
text through <xar:mlstring> tags. Well and good.
The other place we often encounter translatable text is in certain tag
attributes. Consider the following example:
A. <input type="submit" value="#xarML('Log In')#" />
What can we do to simplify this construct, similar to what has been done
in text nodes?
Here are 2 other ways of expressing the same example:
B. <input type="submit" value="Log In" />
C. <xar:var name="label">Log In</xar:var>
<input type="submit" value="#$label#" />
Ideally I would like to replace A with B or C. In fact, I would pretty
much like to remove all xarML constructs from templates and have the
translation issue be handled in the background without any signaling.
Variant C is a cheap (implementation-wise) solution: it reduces our
issue to an application of the text node translation already
implemented, without any further fuss. Its drawback is that it is a bit
less readable and a slightly more complicated construct.
Variant B looks great, until you realize that setting up a simple rule
like "all text in attributes is translatable" would mean the name of the
button in that example would also be translated. Probably not what we want.
Opinions?