Calender / datetime picker - localization

269 views
Skip to first unread message

Martin Weissenboeck

unread,
Aug 17, 2011, 5:53:07 AM8/17/11
to web...@googlegroups.com
Who knows where to find details about the localization (and other customization) of the built-in calender?
In calendar.js I have found the link http://www.dynarch.com/projects/calendar, but I could only find there something about a (new) version JSCal2

Regards, Martin

Anthony

unread,
Aug 17, 2011, 9:39:07 AM8/17/11
to web...@googlegroups.com, mar...@weissenboeck.at
If you want to localize the date format in particular, in /views/web2py_ajax.html, you'll notice variables w2p_ajax_date_format and w2p_ajax_datetime_format. Both of those are translated via the web2py translation system, so you can simply add translations for those two formats to your language files.
 
Anthony

Martin Weissenboeck

unread,
Aug 17, 2011, 10:24:08 AM8/17/11
to web...@googlegroups.com
Thx. But how can I translate the names of the months and the days and how can I make the calendar start at Monday (and not at Sunday)?

By the way: I wanted to get a timepicker and I have tried to use "... _class='time'...". The datepicker works (_class='date') and also _class='datetime', but not 'time'.

Regards, Martin

2011/8/17 Anthony <abas...@gmail.com>

Anthony

unread,
Aug 17, 2011, 11:08:38 AM8/17/11
to web...@googlegroups.com, mar...@weissenboeck.at
 
Note, attaching the Calendar widget to date and datetime fields is handled in the web2py_ajax_init function of /static/js/web2py_ajax.js (http://code.google.com/p/web2py/source/browse/applications/welcome/static/js/web2py_ajax.js#25), so you could edit that (or change the class of date and datetime fields) in order to further customize the behavior.
 
Anthony

Iceberg

unread,
Aug 21, 2011, 10:07:58 PM8/21/11
to web2py-users
Hi Martin,

About the translation, have you checked out its official package?
http://www.dynarch.com/projects/calendar/old/

It contains lots of different language files. Just include one of
them, and you are good to go. It works for me, for years!

Regards,
Ray (a.k.a. Iceberg)


On Aug 17, 10:24 pm, Martin Weissenboeck <mweis...@gmail.com> wrote:
> Thx. But how can I translate the names of the months and the days and how
> can I make the calendar start at Monday (and not at Sunday)?
>
> By the way: I wanted to get a timepicker and I have tried to use "...
> _class='time'...". The datepicker works (_class='date') and also
> _class='datetime', but not 'time'.
>
> Regards, Martin
>
> 2011/8/17 Anthony <abasta...@gmail.com>

Martin Weissenboeck

unread,
Aug 23, 2011, 4:54:49 PM8/23/11
to web...@googlegroups.com
Hi Ray,
yes, I have read it.
My problem is to change the language "on the fly", depending on the language the visitor excepts.

Regards, Martin

2011/8/22 Iceberg <ice...@21cn.com>

Martin Weissenboeck

unread,
Aug 23, 2011, 4:59:49 PM8/23/11
to web...@googlegroups.com
Ok, this is the documentation I have been looking for. Now I have found the direct link on the website. Thanks again.
The timepicker seems not be very useful for me because I could not find a way to change it from AM/PM to 24 hours

2011/8/17 Anthony <abas...@gmail.com>

Ray (a.k.a. Iceberg)

unread,
Aug 23, 2011, 10:47:39 PM8/23/11
to web2py-users
Then I think you need a dynamic include in your controller. Something
like this:

def index():
return {'foo': DIV(
SCRIPT(_src=URL(..., 'calendar-%s-utf8.js'%language)),
DIV(...all_cool_stuff...),
)}

Regards,
Ray

On Aug 24, 4:54 am, Martin Weissenboeck <mweis...@gmail.com> wrote:
> Hi Ray,
> yes, I have read it.
> My problem is to change the language "on the fly", depending on the language
> the visitor excepts.
>
> Regards, Martin
>
> 2011/8/22 Iceberg <iceb...@21cn.com>
Reply all
Reply to author
Forward
0 new messages