[opencms-dev] Locale problem

Nagy Attila lists.opencms.org at tylla.hu
Fri May 28 13:52:10 CEST 2010


Dear list!

I have a problem with displaying a content in a given locale other than 
the default one.
What I want to do is to modify my default template so, that it will show 
my content with a given locale, and not the default one. Can this be 
accomplished with jsp tags? As I've seen the cms:include always includes 
the default one (or if there is a locale property set, than that one), 
but I wasn't able to change that behavior programatically.
Here is what I've tried so far, but to no avail:

     Locale loc = new Locale("hu_HU");

     cms.getRequest().setAttribute("locale",loc);
     cms.getRequestContext().setLocale(loc);
     cms.getResponse().setLocale(loc);

As I debugged it, only the second gives some sort of effect (I mean the 
method call at least changes its value, the other ones are totally 
effect less) but neither of these affect the returned content's locale.

I know - as I have read in many places - that the proposed solution 
would be to create as many subfolders as the needed locales are, and put 
siblings in these folder trees with the locale property set 
correspondingly, but this puts a lot of effort to the user as it has to 
take care of the siblings, not to mention that the site structure will 
be similar for all languages.
Otherways I can't believe that this can't be done. So the conclusion is 
that I am the dumb, and I need some help. :D

Thanks in advance,
Tylla.




More information about the opencms-dev mailing list