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.