[projectaon] Re: Taste of things to come

  • From: Javier Fernández-Sanguino Peña <jfs@xxxxxxxxxxxx>
  • To: projectaon@xxxxxxxxxxxxx
  • Date: Sat, 18 Mar 2006 10:47:19 +0100

On Fri, Mar 17, 2006 at 09:01:11AM -0800, Jonathan Blake wrote:
> On 3/17/06, Javier Fernández-Sanguino Peña <jfs@xxxxxxxxxxxx> wrote:
> > On Thu, Mar 16, 2006 at 04:16:37PM -0800, Jonathan Blake wrote:
> > > http://www.projectaon.org/index-new.htm
> > >
> > Why not use Content-Negotiation [1] to direct users that have their browser
> > properly configured to the most suitable language (but have a generic entry
> > point for those that don't have it)?
> 
> Excellent suggestion. I'm not familiar with content negotiation, so
> after skimming the link provided, this is what I came up with.
(...)

That might work. However, just enabling content-negotiation in the server and
have an index.html.en and an index.html.es that redirect to the directories
themselves might be sufficient. The index.html could be the one that you
presented (references both).

The Apache configuration should include this:

<IfModule mod_mime.c>
(...)
            AddLanguage en .en
            AddLanguage es .es
            AddLanguage none .def
            (...)
            <IfModule mod_negotiation.c>
                   LanguagePriority none en es
            </IfModule>
</IfModule>
# End of document types.

And modules conf has these lines:
LoadModule mime_module /usr/lib/apache/1.3/mod_mime.so
LoadModule negotiation_module /usr/lib/apache/1.3/mod_negotiation.so

That should be suficient to make it work:

- if the user has a Content-Negotiation: es header: show index.html.es
- if the user has a Content-Negotiation: en header: show index.html.en
- if the user has no Content-Negotiation: header: show index.html.def

('none' is not a language, but Apache should not care about that :-)

Give it a try and let me know if that works for you.

Regards

Javier

Other related posts: