forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sjur Nørstebø Moshagen <sjur.mosha...@kolumbus.fi>
Subject Re: [I18n] Alternatives locales for a given page.
Date Wed, 28 Apr 2004 08:34:31 GMT
Nice work!

På 27. apr. 2004 kl. 22.03 skrev Upayavira:

> Well, the nested input module support isn't that spectacular, it just 
> means you can do {request-param:{1}}, for example, which you couldn't 
> do before.
>
> Here's some further thoughts, had during a nice warm bath:
>
> The below assumes that the content is stored in the following 
> structure:
>
> /xml/en/*.xml
> /xml/de/*.xml
> /xml/pl/*.xml
>
> Syntax isn't quite right yet, but the idea is there:

<snip/>

> <!-- This one handles urls like www.host.com/foo.html, using the 
> locale to
>        identify which language, with appropriate fallback -->
> <map:match pattern="**.html">
>  <map:generate src="{i18n:xml/LOCALE/{1}.xml"/>
>   ...
> </map:match>

This is the one that I'm after, in terms of url type and content 
negotiation.

> This _should_ be compatible with the CLI and Apache, I think.

I know nothing about the CLI, so no comment here.

Apache:
Your proposed directory structure might work ok with apache, but I 
don't see how you could get content negotiation in Apache 1.x - the 
standad approach is to have all files in one common directory, with 
locale suffixes on each file, like:

/xml/*.xml.en
/xml/*.xml.de
/xml/*.xml.pl

In Apache 2.x your suggested directory structure can more easily be 
handled, I believe (haven't tried it), since the preferred setup for 
content negotiation is done through a var file (var = variants). It has 
the same name as the name of the files to do content negotiation for, 
with the suffix .var, and with content like:

# This file is used by Apache 2 to support content negotiation
URI: index.html.en
Content-language: en
Content-type: text/html;charset=UTF-8

URI: index.html.de
Content-language: de
Content-type: text/html;charset=UTF-8

If you want to support a directory structure as yours, the generated 
static site would be something like:

/xml/index.var
/xml/en/index.html
/xml/de/index.html
...

and the corresponding var file should be something like:

# This file is used by Apache 2 to support content negotiation
URI: en/index.html
Content-language: en
Content-type: text/html;charset=UTF-8

URI: de/index.html
Content-language: de
Content-type: text/html;charset=UTF-8

(NOTE: I have NOT tested this).

I would recommend going for the standard Apache approach when 
generating static sites, and generate the .var file as well (the 
default configuration of Apache 2 won't do content negotiation without 
the .var file), that is:

/xml/*.xml.en
/xml/*.xml.de
/xml/*.xml.pl
/xml/*.var

This way, the generated static site will work with both Apache 1.x and 
Apache 2.x utilizing content negotiation without further ado.

Sjur


Mime
View raw message