Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for JSF #59

Open
GoogleCodeExporter opened this issue Oct 8, 2015 · 3 comments
Open

Support for JSF #59

GoogleCodeExporter opened this issue Oct 8, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

ghost commented Oct 8, 2015

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

Original issue reported on code.google.com by [email protected] on 11 Jun 2014 at 5:22

@GoogleCodeExporter
Copy link
Author

ghost commented Oct 8, 2015

[deleted comment]

@GoogleCodeExporter
Copy link
Author

ghost commented Oct 8, 2015

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 [email protected] on 5 Feb 2015 at 9:41

@GoogleCodeExporter
Copy link
Author

ghost commented Oct 8, 2015

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 [email protected] on 10 Feb 2015 at 4:32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant
and others