Issue 59 in gettext-commons: Support for JSF

12 views
Skip to first unread message

codesite...@google.com

unread,
Jun 11, 2014, 1:22:42 PM6/11/14
to gettext-co...@googlegroups.com
Status: New
Owner: ----

New issue 59 by agervais...@gmail.com: Support for JSF
http://code.google.com/p/gettext-commons/issues/detail?id=59

Gettext-commons doesn't seem to support JSF.

How hard it would be to add special taglib for those?

The project jhorstmann does something about this, but it doesn/t seem to be
updated anymore:
https://github.com/jhorstmann/i18n

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

codesite...@google.com

unread,
Aug 17, 2014, 1:41:54 PM8/17/14
to gettext-co...@googlegroups.com

Comment #1 on issue 59 by fnicola...@gmail.com: Support for JSF
http://code.google.com/p/gettext-commons/issues/detail?id=59

You can handle multiple instances of I18n objects usings different locale
without any problems.

codesite...@google.com

unread,
Feb 5, 2015, 4:41:20 AM2/5/15
to gettext-co...@googlegroups.com

Comment #2 on issue 59 by nico.de...@gmail.com: Support for JSF
https://code.google.com/p/gettext-commons/issues/detail?id=59

Hi,

It seems that JFS read .properties files, and gettext-commons can generate
properties from PO using the maven instruction
<outputFormat>properties</outputFormat>

-Nicolas Fortin
IRSTV FR CNRS 2488

codesite...@google.com

unread,
Feb 10, 2015, 11:32:59 AM2/10/15
to gettext-co...@googlegroups.com

Comment #3 on issue 59 by agervais...@gmail.com: Support for JSF
https://code.google.com/p/gettext-commons/issues/detail?id=59

Yeah, JSF can even read .class as well as outputFormat but the point of
using .po file is the ability to parse all the "key" required from a
source(say a .java or a .xhtml for this particuliar case) and to store them
into a ".pot". A tool similar to GNU-Gettext, or the software of
jhorstmann(which use a maven plugin to parse the file) is rather handy.

Currently there's seem to be a work-around but, it's still incredibly messy:
1- Let's say we use:
xgettext.exe -k_ --files-from=sourceList.txt -o outCatalog.pot
Usually that command lookout for the file specified in "sourceList.txt" and
search for of occurence of '_(myTranslationKey)', then grab the key
of "myTranslationKey" and store it into a .pot file.

2- Then in JSF it is easy to create your own xhtml tag with a Composite
Components(simple tutorial here:
http://www.abnsoft.info/2012/01/24/jsf-composite-components-example/) with
a custom taglib(http://stackoverflow.com/a/7080174/2141964) to bind function

Sadly, xgettext isn't designed to parse .xhtml or .jsf efficiently since it
is uncommon syntax different than "<%_('myTranslationKey')%>" (similar to
jsp and few other) and there's might be a bunch of header where xgettext
may attempt to parse and fail.

So at this point, my workaround to solve this problem(instead of hacking
xgettext to add a custom way to fetch a value for a key) would be:
3- Create a preparser before running xgettext, so it can efficiently fetch
all the key to store from .xhtml into a comprenhensive format for xgettext.

Of course, I'm sure there is a way to use exclusively .properties files and
add a new key manually every time it is required to so, but that's not we
want to do. But that's completely break the devlopper workflow.
Reply all
Reply to author
Forward
0 new messages