[opencms-dev] Determine Siblings - Multilingual Site

Carl Alex Friis Nielsen cfn at kb.dk
Thu Sep 21 13:55:52 CEST 2006


-----Original Message-----
From: opencms-dev-bounces at opencms.org@KB On Behalf Of "Radu Sora" <sisturix at gmail.com>

> What i need is a method to programmatically determine the list of sibling for a specified > resource, so i can put the language switch on all pages. 

This will only work properly if you use siblings exclusively for having the same
content in different locales (how would you then handle it if you have two siblings
of the same content in the same locale ?).

We handle it by having parallel folder structures and using the same
resource names in the two locales (holes are allowed), so when we
have a resource /en-stuff/x/y/z/foobar.html the corresponding
Danish version is named /da-stuff/x/y/z/foobar.html and the links
between them can easily be generated by substituting the variant part
of one siblings path to the value corresponding to the other siblings
locale. Whether a version in the other locale exists is noted in 
the "locales available" property which is set to be shared.
This solution will also scale if multiple locales are used.

Note that although names have to be the same titles don't so being forced
to use the same name isn't neccesarily so bad as it may sound.

Otherwise org.opencms.file.Object.ReadSiblings() will give you the
siblings of a resource.

Cheers,

Carl



More information about the opencms-dev mailing list