In trunk we now have:

T.requested_languages (a parsed list of languaged accepted by the
client)
T.current_languages (a list of languages that should not be
translated, set by the developer)
T.accepted_language (the language chosen by web2py based on
availability)
T.language_file (the file associated to the chosen language)

So you can do:

T.current_languages = ['en', 'en-en']
if T.accepted_language in T.requested_language:
    pass #or do something
elif T.accepted_language in T.current_languages
    pass #or do something
else:
    T.force('fr')

Always use lowercase for language files and names.

On May 12, 7:52 am, guruyaya <guruy...@gmail.com> wrote:
> OK, that should solve it. Think I'd rather having the first language
> on the current_languages list be returned, but hay - you cannot get
> everything.
>
> On May 12, 11:12 am, Álvaro Justen [Turicas] <alvarojus...@gmail.com>
> wrote:
>
> > On Tue, May 12, 2009 at 5:07 AM, guruyaya <guruy...@gmail.com> wrote:
>
> > > I think there will be a problem, in case I have a none standart
> > > setting in my browser. If I don't have English defined in my browser,
> > > only Italian, for example, it will throw an error, even if I wrote
> > > T.current_languages=['en','en-en'], trying to read the accepted
> > > language.
>
> > I think we could add to languages.translator.__init__:
> >     self.accepted_language = None
>
> > --
> >  Álvaro Justen
> >  Peta5 - Telecomunicações e Software Livre
> >  21 3021-6001 / 9898-0141
> >  http://www.peta5.com.br/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to