You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dates.py 2.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "Commonly-used date structures"
  2. from django.utils.translation import pgettext_lazy, ugettext_lazy as _
  3. WEEKDAYS = {
  4. 0: _('Monday'), 1: _('Tuesday'), 2: _('Wednesday'), 3: _('Thursday'), 4: _('Friday'),
  5. 5: _('Saturday'), 6: _('Sunday')
  6. }
  7. WEEKDAYS_ABBR = {
  8. 0: _('Mon'), 1: _('Tue'), 2: _('Wed'), 3: _('Thu'), 4: _('Fri'),
  9. 5: _('Sat'), 6: _('Sun')
  10. }
  11. WEEKDAYS_REV = {
  12. 'monday': 0, 'tuesday': 1, 'wednesday': 2, 'thursday': 3, 'friday': 4,
  13. 'saturday': 5, 'sunday': 6
  14. }
  15. MONTHS = {
  16. 1: _('January'), 2: _('February'), 3: _('March'), 4: _('April'), 5: _('May'), 6: _('June'),
  17. 7: _('July'), 8: _('August'), 9: _('September'), 10: _('October'), 11: _('November'),
  18. 12: _('December')
  19. }
  20. MONTHS_3 = {
  21. 1: _('jan'), 2: _('feb'), 3: _('mar'), 4: _('apr'), 5: _('may'), 6: _('jun'),
  22. 7: _('jul'), 8: _('aug'), 9: _('sep'), 10: _('oct'), 11: _('nov'), 12: _('dec')
  23. }
  24. MONTHS_3_REV = {
  25. 'jan': 1, 'feb': 2, 'mar': 3, 'apr': 4, 'may': 5, 'jun': 6, 'jul': 7, 'aug': 8,
  26. 'sep': 9, 'oct': 10, 'nov': 11, 'dec': 12
  27. }
  28. MONTHS_AP = { # month names in Associated Press style
  29. 1: pgettext_lazy('abbrev. month', 'Jan.'),
  30. 2: pgettext_lazy('abbrev. month', 'Feb.'),
  31. 3: pgettext_lazy('abbrev. month', 'March'),
  32. 4: pgettext_lazy('abbrev. month', 'April'),
  33. 5: pgettext_lazy('abbrev. month', 'May'),
  34. 6: pgettext_lazy('abbrev. month', 'June'),
  35. 7: pgettext_lazy('abbrev. month', 'July'),
  36. 8: pgettext_lazy('abbrev. month', 'Aug.'),
  37. 9: pgettext_lazy('abbrev. month', 'Sept.'),
  38. 10: pgettext_lazy('abbrev. month', 'Oct.'),
  39. 11: pgettext_lazy('abbrev. month', 'Nov.'),
  40. 12: pgettext_lazy('abbrev. month', 'Dec.')
  41. }
  42. MONTHS_ALT = { # required for long date representation by some locales
  43. 1: pgettext_lazy('alt. month', 'January'),
  44. 2: pgettext_lazy('alt. month', 'February'),
  45. 3: pgettext_lazy('alt. month', 'March'),
  46. 4: pgettext_lazy('alt. month', 'April'),
  47. 5: pgettext_lazy('alt. month', 'May'),
  48. 6: pgettext_lazy('alt. month', 'June'),
  49. 7: pgettext_lazy('alt. month', 'July'),
  50. 8: pgettext_lazy('alt. month', 'August'),
  51. 9: pgettext_lazy('alt. month', 'September'),
  52. 10: pgettext_lazy('alt. month', 'October'),
  53. 11: pgettext_lazy('alt. month', 'November'),
  54. 12: pgettext_lazy('alt. month', 'December')
  55. }