[opencms-dev] Locale problem

Claus Priisholm cpr at codedroids.com
Mon May 31 09:48:50 CEST 2010


I think you can find examples of handling locales without the need for a 
top-level-folder per locale in the mailing list archive. This approach 
is a bit more complicated (typically at least, your requirements may be 
different) as your file properties are not available in multiple locales 
(as opposed to the content of the file).

The "recommended" way of doing multiple languages solves that by having 
multiple files, each with its own set of properties which then are 
translated into the appropriate language.

But you are right, the handling of siblings is a burden on the content 
producers - at least to begin with they tend to get confused, but 
eventually they pick up on the concept.

On the other hand the use of top-level language folder gives you more 
flexibility in my mind (not less as you state) - you do not need to have 
all the pages in all languages, some of the pages can be made as 
siblings, others as copies. Folder and filenames may be different from 
one language to another - this would not be possible if you do not have 
a separate directory for each language.

Brs
Claus

Nagy Attila wrote:
> 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.
> 
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 

-- 
Claus Priisholm, CodeDroids ApS
Phone: +45 48 22 46 46
cpr (you know what) codedroids.com - http://www.codedroids.com
cpr (you know what) interlet.dk - http://www.interlet.dk
-- 
Javadocs and other OpenCms stuff: 
http://www.codedroids.com/community/opencms



More information about the opencms-dev mailing list