[wxPython-users] Localizing the DatePickerCtrl

Robin Dunn robin at alldunn.com
Thu Aug 2 13:01:18 PDT 2007


Ed Leafe wrote:
>     I'm using a wx.DatePickerCtrl in an app that requires localization, 
> but I'm not able to figure out how to a) get the date to appear in the 
> local format and b) when showing the calendar, have the month names 
> localized. I've googled just about every combination I can think of 
> without success.
> 
>     Does anyone have any experience with this, or can point me to a link 
> that shows how to do this?

There are two things that need to happen for this to work automatically.

First wx needs to be able to find its message catalog files.  On all 
platforms this should be automatic, but note that they are in an 
optional package in the Debian/Ubuntu builds that will need to be 
installed.  Also, on Windows since there isn't a standard location for 
these files they are installed in the locale subdir of the wx package 
dir, and there is an explicit call to 
wx.Locale.AddCatalogLookupPathPrefix to add this dir to those searched 
by wx.

Second, the locale needs to be set to one for which there is a wx 
message catalog file.  Again this will be automatic if the system is 
configured correctly.  Or you can programatically create (and hold a 
reference to) a wx.Locale object if you want to use a locale different 
than the system's default.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list