Non-US developers: How do you handle localization of user numeric, currency, date, etc input/display with your wxPython apps

Wondering how non-US developers handle localization of user numeric, currency, date, time, datetime values with wxPython.

Are you using Python’s locale module from the standard library, using the 3rd party Babel package, or doing your own parsing and formatting of content.

Do you allow your users to input date/time values in textboxes or do you use dropdowns and calendar controls for this type of data?

Thanks,

Malcolm

El 15/12/2010 1:58, python@bdurham.com escribi�:

Wondering how non-US developers handle localization of user numeric,
currency, date, time, datetime values with wxPython.
Are you using Python's locale module from the standard library, using
the 3rd party Babel package, or doing your own parsing and formatting of
content.

I'm a spanish developer and i don't know how do it other non-us developers. These is my basic recipe:

* Edit numbers
I use a simple textctrl whith aling right style and filtering inputs to only numbers and the symbols '-' '.'
On Lost Focus i check the value and invalidate it if is not a valid number.
Note: Althougt in spain the decimal symbol is comma (,) i use the point symbol in edit mode because my customers are accustomed to use it.

* Show/Print numbers
Here i use the locale facilities:
>>> locale.getlocale()
('es_ES', 'cp1252')
>>> d = decimal.Decimal("123456789012345.12")
>>> locale.format("%f", d, 1)
'123.456.789.012.345,120000'

* Edit Date/DateTime values
I use a simple textctrl filtering numbers and the symbols '/', ':'.
On lost focus i check if the entered value is valid using the locale rules.

*Show/Print Dates:
Use locale facilities:
>>> locale.getlocale()
('es_ES', 'cp1252')
>>> t = datetime.datetime.now()
>>> t
datetime.datetime(2010, 12, 21, 16, 31, 38, 78000)
>>> t.strftime("%x %X")
'21/12/2010 16:31:38'

Regards,

···

--
Oswaldo Hern�ndez

Oswaldo,

I'm a spanish developer and i don't know how do it other non-us developers. These is my basic recipe:

Muchisimas gracias! If that translates poorly, then in English: Thank
you!

Malcolm