Add some i18n hooks to DateFormat
|Reported by:||orestis||Owned by:||garcia_marc|
|Cc:||orestis@…, ctrochalakis, alexkon@…, marcoberi@…, s.kuzmenko@…||Triage Stage:||Accepted|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Django's handling of i18n is fairly good, but one major point that it doesn't handle well (together with almost everything else out there) is the formatting of dates.
The most obvious example is the display of the month names. While in English there is only one case of nouns, in many other european languages there are more, which have different spellings.
For example, in Greek, in order to be able to diplay full-word months and capture all possible sentence formats, one needs three cases:
- The subjective case (eg. en: January, 2007 - el: Ιανουάριος, 2007)
- The posessive case (eg. en: 23th of January - el: 23η Ιανουαρίου)
- The objective case (eg. en: Entries posted on January - el: Δημοσιεύσεις που έγιναν τον Ιανουάριο)
I'm sure this is common in most european languages, but I'm not an expert; Please everybody comment on this.
To implement this in django, I suggest the following:
- Add MONTHS_POS, MONTHS_OBJ to django.utils.dates. This should read "of January" and "on January" in english .
- Add a custom extension in django.utils.dateformat: Q for MONTHS_POS, V for MONTHS_OBJ. Any available letter should do.
That's all. There is a=still an issue about the format 'S' that adds the ordinals (1st, 2nd etc) but I don't know how other languages deal with this.
I can submit a patch for this...
Change History (31)
comment:1 Changed 9 years ago by Simon G. <dev@…>
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Design decision needed
comment:25 Changed 5 years ago by mtredinnick
- Triage Stage changed from Design decision needed to Accepted