I will fix this "T.accepted_language is not always defined" and make
sure tis defaults to None if no language has been accepted.


Massimo

On May 11, 12:07 pm, Yarko Tymciurak <yark...@gmail.com> wrote:
> It seems you are correct from a few perspectives:
>
>    - T.accepted_language is not always defined (it's only reference is in
>    T.force - where it is set);  for this to be useful it would have to be
>    always set, be something consistent;
>    - T.http_accept_language is set per request;  accepted_language is NOT
>    always set (if there is no language file, and you go to default, for
>    example).   This is "ok", perhaps, but not documented anywhere.
>     (accepted_language was added this Feb. in revision 453; we're now at 774)
>
> accepted_language may be useful as is, or may need some tweaking (how can
> you tell if it's default, or has not been set yet... is this important now
> that we have T() calls in gluon?).
>
> So I think it needs review, and documentation (a good thing to add to
> docstring).
>
> As I write this, I am aware of one other thing:   our docstring project will
> (perhaps) have lots of additions by many people, and we will have
> documentation (that will look good) which has not been reviewed (that is,
> might not be fully correct) - so the early docstrings will get "review by
> use and complaint" --- which might not be so bad, but I think it would be
> better to have docstring submissions reviewed.
>
> Regards,
> Yarko
>
> On Mon, May 11, 2009 at 5:45 AM, guruyaya <guruy...@gmail.com> wrote:
>
> > Well, I had it in mind, but it won't work very well. First of all, I
> > can't consider this a part of the API, and it can change over time.
> > One of the reason I like web2py is the API stability. The other
> > problem I have, is in the case the language does not exist. Say I
> > created a site with Italian as default language (defined on
> > current_languages), and translated to French, will give an error if
> > I'm using a normal browser, set to work with English only. I can
> > bypass this problem with try and except. But it will make an ugly
> > code.
>
> > On May 10, 7:00 pm, Álvaro Justen [Turicas] <alvarojus...@gmail.com>
> > wrote:
> > > On Sun, May 10, 2009 at 6:08 AM, guruyaya <guruy...@gmail.com> wrote:
> > > > I'd like to know if there's a function that returns the current
> > > > language in use. I cannot read this from the headers, as it could be
> > > > that the user language is being forced. The process of analyzing the
> > > > language from the accepted language is problematic, as it can change
> > > > in the course of time.
> > > > Well, is there a way?
>
> > > Try T.accepted_language
>
> > > --
> > >  Á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