forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <>
Subject Re: Multilanguage sites
Date Sat, 23 Aug 2003 14:23:05 GMT
On Wed, Aug 20, 2003 at 03:33:46PM +0300, Corneanu Dan wrote:
> Hi there!
> I want to build a multi language site using forrest. Here is what I am 
> thinking of:
> - all the content is in XML (doc-v12) format, with every file being 
> translated to all the languages used.
> The association between language and the content xml file is made based 
> on the rule that for every
> content there is a file 'foo.xml' for the default language (say EN) and 
> for every other language there is a
> translation 'foo(DE).xml', 'foo(FR).xml' etc.
> - the 'site.xml' file will have links only to files in the default language.
> - if a link like '<link site:bar>Link to bar</link>' appears in the 
> 'foo(DE).xml'
> it must be translated to a link to the 'html' generated from file 
> 'bar(DE).xml'
> - every page will have three links for changing the language and 
> reaching the translated pages.

How about having separate directories for each language?


I assume you'd want a separate menu for each language, so you'd need a
site.xml in each language directory.

This requires overriding and modifying menu.xmap and linkmap.xmap.

If you look in menu.xmap, you'll see site.xml is used in this snippet:

  <map:match pattern="**menulinks-*">
    <map:generate src="content/xdocs/site.xml" />

To read instead from {en,de,fr,..}/site.xml, you can change that to:

  <map:match pattern="*/**site">
    <map:generate src="content/xdocs/{1}/site.xml" />
    <map:serialize type="xml"/>
  <map:match pattern="**menulinks-*">
    <map:generate src="cocoon:/{1}site" />

So the matcher 'call stack' for de/foo/index.html would be:

de/foo/index.html           (sitemap.xmap)
de/foo/menu-index.html      (sitemap.xmap)
de/foo/book-index.html      (menu.xmap)
de/foo/menulinks-index.html (menu.xmap)
de/foo/site                 (menu.xmap)
content/xdocs/de/site.xml   (filesystem)

So the menu for de/foo/index.html would be generated from

Link rewriting is similar.  If you look in sitemap.xmap's
**body-*.html pipeline, you'll see the link rewriting done with:

  <map:transform type="linkrewriter" src="cocoon:/{1}linkmap-{2}.html"/>

You'll find the definition of **linkmap-*.html in linkmap.xmap.  I
think that changing its matchers to the following will do the trick:

  <map:match pattern="en/**abs-linkmap">
    <map:generate src="content/xdocs/en/site.xml" />
    <map:transform src="resources/stylesheets/absolutize-linkmap.xsl" />
    <map:serialize type="xml" />
  <map:match pattern="de/**abs-linkmap">
    <map:generate src="content/xdocs/de/site.xml" />
    <map:transform src="resources/stylesheets/absolutize-linkmap.xsl" />
    <map:serialize type="xml" />
  <!-- other languages here -->
  <map:match pattern="**linkmap-*">
    <map:generate src="cocoon://{1}abs-linkmap" />
    <map:transform src="resources/stylesheets/relativize-linkmap.xsl">
      <map:parameter name="path" value="{1}{2}" />
      <map:parameter name="site-root" value="{conf:project-url}" />
    <map:serialize type="xml" />

Experiments with sitemaps are best done interactively ('forrest run').
Any pipeline can be requested from the browser, so I'd start by trying
to get http://localhost:8888/de/menulinks-index.html working.

More info on menus & linking, and the sitemap at:


> I have already started to play with site.xmap and document2html.xsl but 
> I would really appreciate some ideas of
> how can this problem be approached best. Maybe there is already some 
> effort in this direction, if so please let me know.
> Best regards,
> Dan.

View raw message