From: Tammo v. L. <tva...@ta...> - 2006-07-23 17:03:21
|
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. 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 :) Best, Tammo -- Tammo van Lessen - tva...@ta... - http://www.taval.de |