[stringtemplate-interest] Comments and questions from i18n document
John Snyders
jjsnyders at rcn.com
Fri Sep 22 08:37:48 PDT 2006
I have some comments and questions on the Web Application
Internationalization and Localization in Action document.
First let me say Im a big fan of StringTemplate. My first experience with
it was to generate configuration files for VoIP devices (someone else did
the implementation I was not hands on). One thing that needs to be
configured for VoIP devices is the MAC address but different devices require
different formats for it. We used the technique described in this i18n
document of using a wrapper class with pseudo properties for formatting. For
example $MAC.dashes$ would display 00-04-5a-0a-17-59 and $MAC$ would
display 00045a0a1759. At the time we had not seen this document so were
unsure if this was the right thing to do. I like this solution for when the
designer needs control over how the value must be formatted and the
developer has the freedom to create his or her own type or wrapper type. In
the case where it is difficult for a developer to add a wrapper class to all
the value objects it would be nice to use $MAC:dashes()$ as described in
http://www.antlr.org:8080/pipermail/stringtemplate-interest/2006-September/0
00661.html.
Now I am trying to use StringTemplate for web applications.
I have a question on the following example from Section 3.
Locale locale = Locale.getDefault();
String language = locale.getLanguage();
String root = "/var/data/templates/";
StringTemplateGroup templates =
new StringTemplateGroup(language, root+language);
Can this be done when the templates come from the class path? If so how?
A comment:
Section 3 (Site design per locale) does not seem well motivated to me. The
example given is text direction left-to-right vs. right-to-left. I have done
i18n desktop and web apps before but I have not yet had to deal with text
direction yet. Perhaps there are some issues with text direction that I am
not aware of. I wish this section were expanded to give a more concrete
example including text direction. What issues are there that group
inheritance solves that cant be solved with parameterized setting of the
HTML dir attribute or css direction property.
It seems to me that group inheritance is more about skinning and less
important for localization. Even for skinning I think that methods involving
only css should be used first because (I think) designers will have an
easier time working with css.
Still, I like the group inheritance language feature.
A minor comment on section 2. From the document: The page name can be
encoded in the property name or a new property file can be used for each
page in order to handle strings for multiple pages.
I generally would have one property file (perhaps a few but not one per
page). The reason is that often the same text is used on multiple pages for
consistency. For example, on the add and edit pages you will likely want to
refer to a field with the same label. No need to translate it twice or worse
have it translated different ways.
Thanks,
-John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20060922/5e4794e9/attachment.html
More information about the stringtemplate-interest
mailing list