[jboss-user] [JBoss Seam] - Re: Step-by-step localization guide

2006-09-15 Thread nhpvti
nhpvti wrote : 
  | I've tried custom navigation handler for adding language suffix at the end 
of an action,  for example: register_en, register_de
  | 

My custom view handler works seamless with JSF navigation and Seam pageflow and 
forces templates names in the form of name_loc.xhtml, for example 
register_en.xhtml, register_de.xhtml Etc.

Hope that this won't cause any complications in future versions of Faces or 
Seam.

Here the details:

1) In faces-config.xml (for example):

application
  |   view-handlercom.sun.facelets.FaceletViewHandler/view-handler
  |   view-handlercom.mycompany.util.LocaleViewHandler/view-handler
  |   message-bundlemessages/message-bundle
  | locale-config
  | default-localeen/default-locale
  | supported-localeen/supported-locale
  | supported-localede/supported-locale 
  | supported-localeru/supported-locale 
  | /locale-config
  | /application

2) Implement LocaleViewHandler class (some additional methods have to be 
implemented, but they should simply wrap the base class functionality)


import javax.faces.application.ViewHandler;
  | ...
  | public class LocaleViewHandler extends ViewHandler
  | {
  | private ViewHandler base;
  | private static final String separator = _;
  | private static final String actionExtension   = .seam;
  | 
  | public LocaleViewHandler(ViewHandler base)
  | {
  | super();
  | this.base = base;
  | }
  | 
  | public String getActionURL(FacesContext context, String viewId)
  | {
  | StringBuilder newActionURL = null;
  | String actionURL = this.base.getActionURL(context, viewId);
  | StringBuilder localeSuffix = new StringBuilder(separator);
  | localeSuffix.append(LocaleSelector.instance().getLocaleString());
  | StringBuilder localizedEnd = new StringBuilder(localeSuffix);
  | localizedEnd.append(actionExtension);
  | int pointPosition = actionURL.indexOf(actionExtension);
  | if (pointPosition != -1  
actionURL.indexOf(localizedEnd.toString()) == -1)
  | {
  | newActionURL = new StringBuilder(actionURL.substring(0, 
pointPosition));
  | newActionURL.append(localizedEnd);
  | return newActionURL.toString();
  | } else
  | {
  | return actionURL;
  | }
  | }
  | ...
  | }

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3971869#3971869

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3971869
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Step-by-step localization guide

2006-09-07 Thread lcoetzee
For those guys out there using postgresql this is how to create a UTF-8 db:


#On linux su to  postgres user
su -c su -s /bin/sh postgres

#Create the db user
createuser -d -P -E dbUser



#create the instance
createdb -E UNICODE instance -O dbUser

#To see if it worked:
psql -l

#Results in
 instance | dbUser | UTF8

Regards

Louis





View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3970010#3970010

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3970010
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Step-by-step localization guide

2006-09-06 Thread nhpvti
perwik wrote : 
  | but why do this at all when you can have register.xhtml include the locale 
specific parts instead?

In order to reduce number of templates to be generated and supported. Besides 
CMS contributors should get a big picture in preview mode, ideally the whole 
content part in order to get approximate idea how it could look at runtime.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3969793#3969793

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3969793
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Step-by-step localization guide

2006-09-05 Thread nhpvti
perwik wrote : Oh, whith object and connections etc. I was thinking of a 
database.
  | 

I have concerns about retrieving static information at runtime from a database, 
even using some kind of caching. 

Why not to use some standard CMS to produce templates and this way avoid 
overhead at runtime? 

A standard CMS product can afford  fine-grained access management via user 
roles, mature GUI, some kind of preview mode, version control Etc. 

I've tried custom navigation handler for adding language suffix at the end of 
an action,  for example: register_en, register_de

It works, but in this case I have to duplicate navigation rules :-(

navigation-rule
  | navigation-case
  | from-outcomeregister_en/from-outcome
  | to-view-id/register_en.xhtml/to-view-id
  | redirect /
  | /navigation-case
  | navigation-case
  | from-outcomeregister_de/from-outcome
  | to-view-id/register_de.xhtml/to-view-id
  | redirect /
  | /navigation-case
  | /navigation-rule

I still have to check whether Seam page flow can be used easier for supporting 
my approach.


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3969446#3969446

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3969446
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Step-by-step localization guide

2006-09-05 Thread perwik
It doesn't work, but something like this would be nicer:

  | navigation-rule
  | navigation-case
  | from-outcomeregister/from-outcome
  | to-view-id/register_#{locale}.xhtml/to-view-id
  | redirect /
  | /navigation-case
  | /navigation-rule
  | 

but why do this at all when you can have register.xhtml include the locale 
specific parts instead?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3969538#3969538

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3969538
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Step-by-step localization guide

2006-09-04 Thread mrohad
that's a great - thanks , I wonder what design pattern do you use with 
seam/ejb3.0 in order to retrieve text in different languges  from the db to the 
JSF pages

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3969196#3969196

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3969196
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Step-by-step localization guide

2006-09-04 Thread msteiner
In CVS version of Seam is SeamCharacterEncodingFilter class. This should make 
UTF8PhaseListener obsolete (can someone confirm that?). You must put this in 
web.xml:

filter
  | filter-nameCharacter Encoding/filter-name
  | filter-class
  | org.jboss.seam.servlet.SeamCharacterEncodingFilter
  | /filter-class
  | init-param
  | param-nameencoding/param-name
  | param-valueUTF-8/param-value
  | /init-param
  | init-param
  | param-nameoverrideClient/param-name
  | param-valuetrue/param-value
  | /init-param
  | /filter

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3969203#3969203

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3969203
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Step-by-step localization guide

2006-09-04 Thread nhpvti
perwik wrote : One option would be to see each static content item as one 
object and then connect a number of translations to it. Then you show the 
translation corresponding to the current locale using the same rules as the 
properties files (i.e showing the default locale when the selected locale is 
not in the list of supported locales).

Thank you for the idea, but maintenance question is still open in this case. Or 
how are you going to populate this object with content: from a data base? Then 
a custom-made CMS would be necessary to maintain texts in the database...
By the way content can require for example html to be included. Properties 
files don't allow entering html according to my quick test.

So I would prefer simple ui:include tag:
div class=headerui:include 
src=/WEB-INF/layout/header#{messages['application.fileSuffix']}.xhtml //div

Any concerns?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3969271#3969271

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3969271
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Step-by-step localization guide

2006-09-04 Thread perwik
Oh, whith object and connections etc. I was thinking of a database.

Your solution works well with content that is really static. But I'd prefer 
some sort of wiki/CMS functionality so that users can edit the content without 
access to the .xhtml files (which they shouldn't even have to know or care 
about).
There is no cookbook for this but I thought we were talking design patterns 
here and not ready made solutions.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3969288#3969288

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3969288
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user