You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by Børre Gaup <bo...@skolelinux.no> on 2006/07/19 12:36:00 UTC

Making languages available in the menu

I have successfully managed to i18n'ize our forrest documentation, where  
menus, tabs and content have the same language.

I generate the different language specific sites into site/build/$langname.

Some of our pages are available in up to five languages, but most are just 
available in one language.

If I display a multilingual document, I would like to have a link to the 
parallel documents in the other languages. That means, if I am looking at a 
page displayed in norwegian, and I have that document also in english and 
finnish, I would like to have a link to those pages also (preferrably in the 
menu).

As I am far from being a xml/xsl guru, a "gruesome hack" I have pondered is to 
use a shellscript that finds those documents that have parellel language 
versions, and insert some html into to these documents, with pointers to the 
other language versions.

But there surely is a possibility to do this a lot more elegantly within 
forrest itself. :D

Where in my documentation tree is it possible to add this functionality? I 
have tried to have a look at 
src/documentation/skins/pelt/xslt/html/site-to-xhtml.xsl, but don't know if 
this is the best place to put this functionality.

regards,
-- 
Børre Gaup

Re: Making languages available in the menu

Posted by Børre Gaup <bo...@skolelinux.no>.
Gask, suoidnemánu 19. b. 2006 13.23, Ross Gardler čálii:
> Børre Gaup wrote:
> > I have successfully managed to i18n'ize our forrest documentation, where
> > menus, tabs and content have the same language.
> >
> > I generate the different language specific sites into
> > site/build/$langname.
> >
> > Some of our pages are available in up to five languages, but most are
> > just available in one language.
> >
> > If I display a multilingual document, I would like to have a link to the
> > parallel documents in the other languages. That means, if I am looking at
> > a page displayed in norwegian, and I have that document also in english
> > and finnish, I would like to have a link to those pages also (preferrably
> > in the menu).
>
> There are a number of things you need to do here:
>
> 1) decide what language variants are available
> 2) insert a link to the available pages in the body of the document
> (like the PDF link)
> 3) insert a link into the menu
>
> For 1)
>
> You need to use the directory generator. This will give you an XML file
> continaing details of all the files in a given directory and
> sub-directories.
>
> You can find examples of its use in the resume and projectInfo plugins
> (note that you will need the latest sources for these plugins the
> samples have been added after the 0.7 release was packaged).
>
> You can find docs for the directory generator in Cocoon docs.
>
> For 2)
>
> Using the output of 1) you will need to enhance the skin (as you
> suspected) to insert the relevant link into the skinned pages content.
> Take a look at how the PDF link is inserted at the skinning stage. This
> will show you how to add other links to your language files when they
> are available.
>
> For 3)
>
> You will need to intercept the request for site.xml and dynamically
> insert the relevant nodes for the available languages. Again, you will
> need to use the output of 1). There are some examples of how to do this
> in both the resume and projectInfo plugins (look for "site-snippet" in
> the xmap files).
>
> Ross

Ok, thank  you for the pointers. I will take a look, and report on how it 
goes.

-- 
Børre Gaup

Re: Making languages available in the menu

Posted by Ross Gardler <rg...@apache.org>.
Børre Gaup wrote:
> I have successfully managed to i18n'ize our forrest documentation, where  
> menus, tabs and content have the same language.
> 
> I generate the different language specific sites into site/build/$langname.
> 
> Some of our pages are available in up to five languages, but most are just 
> available in one language.
> 
> If I display a multilingual document, I would like to have a link to the 
> parallel documents in the other languages. That means, if I am looking at a 
> page displayed in norwegian, and I have that document also in english and 
> finnish, I would like to have a link to those pages also (preferrably in the 
> menu).

There are a number of things you need to do here:

1) decide what language variants are available
2) insert a link to the available pages in the body of the document 
(like the PDF link)
3) insert a link into the menu

For 1)

You need to use the directory generator. This will give you an XML file 
continaing details of all the files in a given directory and 
sub-directories.

You can find examples of its use in the resume and projectInfo plugins 
(note that you will need the latest sources for these plugins the 
samples have been added after the 0.7 release was packaged).

You can find docs for the directory generator in Cocoon docs.

For 2)

Using the output of 1) you will need to enhance the skin (as you 
suspected) to insert the relevant link into the skinned pages content. 
Take a look at how the PDF link is inserted at the skinning stage. This 
will show you how to add other links to your language files when they 
are available.

For 3)

You will need to intercept the request for site.xml and dynamically 
insert the relevant nodes for the available languages. Again, you will 
need to use the output of 1). There are some examples of how to do this 
in both the resume and projectInfo plugins (look for "site-snippet" in 
the xmap files).

Ross