Django

Code

Ticket #1241 (reopened)

Opened 2 years ago

Last modified 5 months ago

Internationalisation of date fields in free admin section.

Reported by: david@reynoldsfamily.org.uk Assigned to: nobody
Component: Admin interface Version: SVN
Keywords: Cc: dreynolds@paston.co.uk
Triage Stage: Design decision needed Has patch: 0
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

Description

Inkeeping with the good internationalisation work that is going on, it would be very useful, if the representation of DateField? or DateTimeField? were to show correctly formatted dates based on the locale or language settings from the settings file. For example UK dates would be good to display as DD/MM/YYYY rather YYYY-MM-DD.

Attachments

Change History

01/18/06 10:03:40 changed by adrian

  • priority changed from high to normal.
  • severity changed from major to normal.

01/18/06 10:20:07 changed by hugo

This could be done by using translated date and time formats like we already do in the global_settings.py - just one format for parsing and one for formatting in the admin (message IDs like ADMIN_DATE_FORMAT and ADMIN_TIME_FORMAT could be used).

On the other hand, I have to admit that I quite like the "neutral" format YYYY-MM-DD. But then, I am a coder, and coders often prefer sortable formats over weird "natural" formats ;-)

01/20/06 07:24:38 changed by GomoX <gomo@datafull.com>

Hugo, I don't know what you mean by "like we already do in global_settings.py", because the current DATE_FORMAT strings in the settings files are ignored (this in django from-svn-pre-0.91-but-post-0.90). In order to change the date format in all the pages I had to modify the current datefield implementation and its validator (which, btw, uses a regexp which sucks, since it might be fast, but it can't correctly validate "weird" dates such as 2003-02-29, but that goes for another ticket, i'll post it). And anyway, the trunk implementations of these did not take into account the DATE_FORMAT setting at all (in particular the hardcoded validator regex :P). So yes, i think this should be added since i18n is not complete without it.

01/20/06 08:14:54 changed by hugo

The settings are used in multiple places in the code for _output_ of dates - like the overview pages in the admin, when there are dates listed. I don't say that we already use those for parsing dates - that's what actually is my suggestion, just use translated technical message IDs for the parse specifications as for print specifications. That way translators can just provide language-specific date and time formats. Of course this would require patching validators and admin code - that's why this ticket is still open and not closed ;-)

06/06/06 04:27:55 changed by david@reynoldsfamily.org.uk

  • status changed from new to closed.
  • resolution set to fixed.

Looks like this was fixed in 3055.

Thanks to those who fixed it!

06/06/06 04:45:45 changed by ramiro

david,

[3055] is just related to the i18n of the visualization of two specific date (no date time) formats so I' m not sure if that is exactly what you were asking for with this ticket.

Regards,

06/06/06 04:49:21 changed by david@reynoldsfamily.org.uk

  • status changed from closed to reopened.
  • resolution deleted.

Ramiro,

I think you might be correct, I just got over excited that someone had fixed it ;)

01/21/07 21:42:20 changed by SmileyChris

  • stage changed from Unreviewed to Design decision needed.

This comes up in IRC every now and then and is met with a bit of contention. Let's hear an official word on whether this is a valid enhancement request.

03/10/07 04:30:34 changed by mtredinnick

This is a valid concern from a localisation perspective. However, it's also very hard to do in a smooth fashion that won't make things very painful when the i18n framework isn't enabled. So design work is needed here before we can go about making a fix. Anybody with concrete suggestions that work both with an without i18n enabled should bring them up on django-developers.

11/30/07 15:21:04 changed by jacob

It seems the only issue left here is correctly parsing dates based on locale, correct?

If so, I think we need a bit of inspiration here; I'm having trouble seeing a way of doing this that isn't crufty and prone to breakage. Ideas are welcome!

12/03/07 10:06:16 changed by DavidReynolds

Are we against the idea of just using settings to set the date/time formats? That seems like the simplest way to do it and also gets around the fact that people might not actually like the 'standard' way dates are formatted in their country.


Add/Change #1241 (Internationalisation of date fields in free admin section.)




Change Properties
Action