Opened 15 years ago
Closed 14 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)
Change History (11)
comment:1 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 15 years ago
Has patch: | set |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
comment:3 by , 15 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:4 by , 15 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:6 by , 15 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.
comment:7 by , 15 years ago
milestone: | 1.2 |
---|---|
Resolution: | → wontfix |
Status: | reopened → closed |
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 , 14 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
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 , 14 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
With the recent addition of context aware translation we can solve this easier.
comment:10 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
This was fixed in #14570. Closing as duplicate.
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:
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).