[Zope3-dev] Re: What if HTTP_ACCEPT_LANGUAGE is not set?

Guido van Rossum guido@python.org
Tue, 18 Jun 2002 11:21:04 -0400


>     GvR> When I use urllib.urlopen(), the Accept-Language header is
>     GvR> not set.  This means I get a KeyError when requesting a page
>     GvR> that involves i18n (apparently including the z3 default home
>     GvR> page).  Please fix this!
> 
> Fixed.  You won't get a KeyError, but you also won't get any of the
> explicit msgids translated.
> 
> I think it's up for debate whether we should attempt to fallback to
> some other language if there's no browser preference.  This might
> align with the ability to explicitly select a language (i.e. a select
> menu with a default of English).

It's evil to raise an exception.  I propose the following set of
fallbacks:

1) A product or package can specify a default language (e.g. if the
   package currently only provides translations into that language in
   its configure.zcml file.

2) A site can specify a default language in its configure.zcml file.

3) If (1) and (2) don't yield a translation, see if there's an English
   translation, and if so, use that.

4) If all else fails, use the explicit message id as the "translation".

--Guido van Rossum (home page: http://www.python.org/~guido/)