Class
zope.i18n.locales.LocaleCalendar

Represents locale data for a calendar, like 'gregorian'.

This object is particular tricky, since the calendar not only inherits from higher-up locales, but also from the specified gregorian calendar available for this locale. This was done, since most other calendars have different year and era data, but everything else remains the same.

Example:

Even though the 'Locale' object has no 'calendar' attribute for real, it helps us here to make the example simpler.

>>> from zope.i18n.locales.tests.test_docstrings import \
...     LocaleInheritanceStub
>>> root = LocaleInheritanceStub()
>>> root.calendar = LocaleCalendar('gregorian')
>>> locale = LocaleInheritanceStub(nextLocale=root)
>>> locale.calendar = LocaleCalendar('gregorian')
>>> root.calendar.months = InheritingDictionary(
...     {1: (u'January', u'Jan'), 2: (u'February', u'Feb')})
>>> locale.calendar.months = InheritingDictionary(
...     {2: (u'Februar', u'Feb'), 3: (u'Maerz', u'Mrz')})
>>> locale.calendar.getMonthNames()[:4]
[u'January', u'Februar', u'Maerz', None]
>>> locale.calendar.getMonthTypeFromName(u'January')
1
>>> locale.calendar.getMonthTypeFromName(u'Februar')
2
>>> locale.calendar.getMonthAbbreviations()[:4]
[u'Jan', u'Feb', u'Mrz', None]
>>> locale.calendar.getMonthTypeFromAbbreviation(u'Jan')
1
>>> locale.calendar.getMonthTypeFromAbbreviation(u'Mrz')
3
>>> root.calendar.days = InheritingDictionary(
...     {1: (u'Monday', u'Mon'), 2: (u'Tuesday', u'Tue')})
>>> locale.calendar.days = InheritingDictionary(
...     {2: (u'Dienstag', u'Die'), 3: (u'Mittwoch', u'Mit')})
>>> locale.calendar.getDayNames()[:4]
[u'Monday', u'Dienstag', u'Mittwoch', None]
>>> locale.calendar.getDayTypeFromName(u'Monday')
1
>>> locale.calendar.getDayTypeFromName(u'Dienstag')
2
>>> locale.calendar.getDayAbbreviations()[:4]
[u'Mon', u'Die', u'Mit', None]
>>> locale.calendar.getDayTypeFromAbbreviation(u'Mon')
1
>>> locale.calendar.getDayTypeFromAbbreviation(u'Die')
2

Let's test the direct attribute access as well.

>>> root.am = u'AM'
>>> root.pm = u'PM'
>>> locale.pm = u'nachm.'
>>> locale.pm
u'nachm.'
>>> locale.am
u'AM'

Base classes

Implemented Interfaces

Attributes/Properties

There are no attributes in this class.

Methods

Known Subclasses

There are no known subclasses.