Open GoogleCodeExporter opened 9 years ago
[deleted comment]
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
Original comment by nico.de...@gmail.com
on 5 Feb 2015 at 9:41
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.
Original comment by agervais...@gmail.com
on 10 Feb 2015 at 4:32
Original issue reported on code.google.com by
agervais...@gmail.com
on 11 Jun 2014 at 5:22