On 2/4/07, Ben Bangert <[EMAIL PROTECTED]> wrote:
>
> On Feb 4, 2007, at 8:09 PM, Uwe Feldtmann wrote:
>
> > print request.environ['HTTP_ACCEPT_LANGUAGE'] returns
> > en-GB,en;q=0.9,en-US;q=0.8,en-us;q=0.6,ar-AE;q=0.5,ar;q=0.4,en-
> > gb;q=0.3,en;q=0.1
> >
> > print request.languages returns
> > ['en-gb', 'en', 'en-us']
> >
> > It appears to be dropping the ar-AE and ar but only until I switch
> > to Arabic in the browser.
> >
> > This is what I get when switched to Arabic
> >
> > print request.environ['HTTP_ACCEPT_LANGUAGE'] returns
> > ar-AE,ar;q=0.9,en-GB;q=0.8,en;q=0.6,en-US;q=0.5,en-us;q=0.4,en-
> > gb;q=0.3,en;q=0.1
> >
> > print request.languages returns
> > ['ar-ae', 'ar', 'en-gb', 'en', 'en-us']
> >
> > Is this to be expected or is it filtering the languages somehow?
>
> It is, for a good reason that is in the doc string but will need to
> be mentioned elsewhere. It's assumed that you write your original
> source code in the main 'fallback' language. From the docstring:
>      The ``language`` default value is considered the fallback during
> i18n
>      translations to ensure in odd cases that mixed languages don't
> occur should
>      the ``language`` file contain the string but not another
> language in the
>      accepted languages list. The ``language`` value only applies
> when getting
>      a list of accepted languages from the HTTP Accept header.
>
>      This behavior is duplicated from Aquarium, and may seem strange
> but is
>      very useful. Normally, everything in the code is in "en-us".
> However,
>      the "en-us" translation catalog is usually empty.  If the user
> requests
>      ``["en-us", "zh-cn"]`` and a translation isn't found for a
> string in
>      "en-us", you don't want gettext to fallback to "zh-cn".  You
> want it to
>      just use the string itself.  Hence, if a string isn't found in the
>      ``language`` catalog, the string in the source code will be used.
>
> If you would like to change the fallback language that's used, you
> can change it in your environment.py like so:
> return pylons.config.Config(myghty, map, paths, request_settings=dict
> (charset='UTF-8', errors='replace', language='ar-AE'))
>
> Hopefully that makes sense? If not, I'm sure JJ will help shed some
> light on it as well.

Your explanation seems just fine.  I'm here to answer any additional questions.

Best Regards,
-jj

-- 
http://jjinux.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to