Once again thanks for the help.

I have used setlocale before. But the thing is where would be the
right place to call the setlocale function? For the moment I just want
the whole application to be in Spanish, so setting the locale on a per
user basis seems overkill to me. Calling the setlocale function on my
view will result in the function being called every time the page is
rendered, and to me that seems wrong. What is your opinion.

For the moment I added the code to the controller and it works. But it
introduces a new problem. When I set the locale it set the preferred
encoding to cp.1252 and that displays wrong!

I'll keep on looking for a solution to make this work.

Thanks.

On 14 ago, 13:51, Yarko Tymciurak <[email protected]> wrote:
> http://www.w3.org/International/questions/qa-accept-lang-locales
>
> Discusses a starting point, while (application responsibility) warning to be
> sure to let the user set their locale.
>
> I think, Francisco, this is your answer.  You can find what you need to get
> started in:
>
> request.env.http_accept_language
>
> and, as per article above, you should provide the session a way to modify
> this if used as a default starting setting.
>
> Hope that is helpful.
>
> Regards,
> - Yarko
>
> On Fri, Aug 14, 2009 at 1:42 PM, mdipierro <[email protected]> wrote:
>
> > If you find a way let me know.
>
> > On Aug 14, 1:37 pm, Yarko Tymciurak <[email protected]> wrote:
> > > it would seem there should be some way to set it based on client, per
> > > session...
>
> > > On Fri, Aug 14, 2009 at 1:32 PM, mdipierro <[email protected]>
> > wrote:
>
> > > > This is a problem.
>
> > > > You must set the locale:
> > > >http://docs.python.org/library/locale.html
>
> > > > the problem is that you cannot setting the locale is not thread safe.
> > > > It does not break your app but once you set it it affects all the
> > > > apps.
>
> > > > Massimo
>
> > > > On Aug 14, 1:06 pm, Francisco <[email protected]> wrote:
> > > > > Hello.
>
> > > > > Thanks for the advise. I have tried what you said and now my
> > > > > application is in Spanish, but weekdays and month names are still
> > > > > displayed in English. When I  use the following code from within my
> > > > > view:
>
> > > > > {{=consulta.fecha_consulta.strftime("%A %d %B %Y")}}
>
> > > > > the date is displayed as "Wednesday 12 de August 2009"
>
> > > > > Any other suggestions?
>
> > > > > Thanks a lot.
>
> > > > > On 13 ago, 02:12, mdipierro <[email protected]> wrote:
>
> > > > > > You do not need to do that.
>
> > > > > > Just use the EDIT page, create a language file for mexican and
> > > > > > translate the format strings. This will be taken care of
> > automatically
> > > > > > everywhere.
>
> > > > > > On Aug 12, 3:06 pm, Francisco <[email protected]>
> > wrote:
>
> > > > > > > Hello everyone.
>
> > > > > > > I have just started learning web2py. It's really great!
> > > > > > > Now the question I have is about the locale.
> > > > > > > I'm from Mexico so my applications must be in Spanish. In some
> > part
> > > > of
> > > > > > > the application I want to get a date doing something like this
> > from
> > > > > > > within a view:
>
> > > > > > > {{=consulta.fecha_consulta.strftime("%A %d %B %Y")}}
>
> > > > > > > and it works, but the date is displayed in English. In what way
> > can I
> > > > > > > set the locale for the date to be displayed in Spanish?
>
> > > > > > > Thanks for the help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to