From: steven987 <ste...@co...> - 2006-07-26 15:38:46
|
Thank you for your reply. See my comments below... Tammo van Lessen wrote: > Hi Steven, > > sorry for the belated reply. > > > Is there a tag library for Gettext Commons > > <http://xnap-commons.sourceforge.net/gettext-commons/index.html>? Are > > there examples of Java/JSP web applications that use Gettext Commons? > > Gettext Commons seems much better than what's available in JSTL > > <http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html> and > > Jakarta's I18N tag library > > <http://jakarta.apache.org/taglibs/doc/i18n-doc/intro.html>. > > No, not yet. I guess, it can be easily done - but the problem that I > see is to extract the translation keys out of the JSP using xgettext. > > Maybe it is possible to extract something like that: > <% > I18n i18n = I18nFactory.getI18n(getClass()); > %> > <%=i18n.tr("This text will be translated");%> > > But I haven't tried that yet. > I wanted to avoid Java code in my JSP pages, hence the request for a tag library. I think if a tag library exist, many more people will use Gettext Commons. Both JSTL and Jakarta's I18N tag library make your code unreadable. Maybe if I find time, I will write one... > Another possibility is to extract all those strings using a grep/sed > script into a separate file which gettext can parse: > > grep -r "fmt:message" *.jspx *.kupu | sed > s/.*key="\(.*\)".*/_("\1");/g' | uniq > phony.js > > mkdir -p i18n > xgettext --from-code=UTF-8 -L java -k_ -p i18n *.js > > This should work for the JSTL fmt taglib. > > Better ideas are highly welcome :) > I'm not that concerned about extracting the tag element. I figure I could write a Perl script if xgettext or the code above does not work. Thanks, -Steven > Best, > Tammo > |