Opened 14 years ago

Closed 13 years ago

#12309 closed (duplicate)

New format character to represent alternative locale-specifc month names

Reported by: shell_dweller Owned by: shell_dweller
Component: Internationalization Version:
Severity: Keywords: date, template, i18n
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I would like to suggest (and claim responsibility for) an extension for date format to handle alternative (locale specific) months names.

Why is this needed?

Alternative months names would have no universal meaning but would allow an additional flexibility with date display in certain languages.

For example, in some Slavic languages (Polish, Ukrainian, Russian and likely few others) phrases “January 2010” and “January 1 2010” would require two distinct grammatical forms: nominative in the first case and genitive in the second. To represent phrases with month names in the genitive case one would use the alternative month names.

How to represent it

I have no particular preference. “E” seems to be a reasonable choice because it stands next to “F” in the alphabet and “F” in used in Django to represent long month names.

Implementation

Coding for this feature is trivial. But I will need to cooperate with language translators to add translations to certain locales.

Attachments (1)

django-12309.diff (1.8 KB ) - added by shell_dweller 14 years ago.
Just the code patch, without .po files

Download all attachments as: .zip

Change History (11)

comment:1 by shell_dweller, 14 years ago

Owner: changed from nobody to shell_dweller
Status: newassigned

comment:2 by shell_dweller, 14 years ago

Has patch: set
Resolution: fixed
Status: assignedclosed

Change summary (patch explanation)

Added new date format character "E" to cater to specific locales where "F" is not enough. Updated Russian and Ukrainian translation files to be able to use the new format.

Sample usage

Format "j E Y" will produce outputs similar to the following:

  • in Russian: "5 декабря 2009"
  • in Ukrainian: "5 грудня 2009"

Here month names are grammatically correct in genitive instead of nominative as generated by "F".

Further actions

If the patch is committed I will go ahead and will update documentation. I will also notify i18n list. Other locales may benefit from this as well (I know that Polish uses the same grammatical construction for full dates).

comment:3 by shell_dweller, 14 years ago

Resolution: fixed
Status: closedreopened

comment:4 by orestis, 14 years ago

You may be interested in the approach defined in http://code.google.com/p/django-localdates/

When I opened a similar bug 2 years ago, it was rejected on the grounds of not adding new formats willy nilly. It makes some sense. A more extensible mechanism could be more useful down the road.

comment:5 by orestis, 14 years ago

For reference, the old ticket is #4147

comment:6 by shell_dweller, 14 years ago

Looking at Orestis' implementation it seems to me that it is modelled on a 3 case system of the Greek language. But in Russian there are 6 cases! With this implementation it is impossible to generate correct Russian phrases such as "by December 2009" or "from March to April". I doubt it is even possible to create a generic framework for outputting month names in any given language.

by shell_dweller, 14 years ago

Attachment: django-12309.diff added

Just the code patch, without .po files

comment:7 by shell_dweller, 14 years ago

milestone: 1.2
Resolution: wontfix
Status: reopenedclosed

After having done some research I found out that the best way to achieve this would be to use Babel which also provides a handful of Django template tags (http://babel.edgewall.org/wiki/BabelDjango).

comment:8 by anonymous, 13 years ago

Resolution: wontfix
Status: closedreopened

In django-1.2 we have new l10n and i18n system, so there is no need of Babel. So, maybe you can give another chance to this feature?

comment:9 by Jannis Leidel, 13 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

With the recent addition of context aware translation we can solve this easier.

comment:10 by anonymous, 13 years ago

Resolution: duplicate
Status: reopenedclosed

This was fixed in #14570. Closing as duplicate.

Note: See TracTickets for help on using tickets.
Back to Top