I am working on a Django application for handling events with schedules. Basically an event has a starting and ending date and contains sessions, each with a date and starting and ending time (current code is at https://gitorious.org/django-seminar/). The application is internationalized.
I want to present the date range of an event in a humanized form, using formulations that depend on the particular range at hand, like
- May 4th, 2012
- from May 3rd to 5th, 2012 (not sure this is the proper phrasing in English, btw)
- from April 23rd to May 2nd, 2012
- from December 27th, 2012 to January 4th, 2013
I came up with two ideas for solving the question, but neither one is fully satisfactory:
- use a combination of translatable format strings, like "from %(begin)s to %(end)s" (one for each case) plus one or two translatable strftime format for each case, but that makes for a dozen techincal messages to translate;
- use a Python function for formatting, one for each language, stored in a module like locale.en.formats, and use the proper function depending on the context, but that requires some complicated machinery, unless some infrastructure already exists for that.
I am probably not the first one to face this situation. How do people usually cope with this?
--
Emmanuel
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/wO7QKgUZn1cJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment