Package zope :: Package i18n :: Package locales :: Class LocaleCalendar
[show private | hide private]
[frames | no frames]

Type LocaleCalendar

      object --+        
               |        
     Inheritance --+    
                   |    
AttributeInheritance --+
                       |
                      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'

Method Summary
  __init__(self, type)
Initialize the object.
  getDayAbbreviations(self)
See zope.i18n.interfaces.ILocaleCalendar
  getDayNames(self)
See zope.i18n.interfaces.ILocaleCalendar
  getDayTypeFromAbbreviation(self, abbr)
See zope.i18n.interfaces.ILocaleCalendar
  getDayTypeFromName(self, name)
See zope.i18n.interfaces.ILocaleCalendar
  getFirstWeekDayName(self)
See zope.i18n.interfaces.ILocaleCalendar
  getMonthAbbreviations(self)
See zope.i18n.interfaces.ILocaleCalendar
  getMonthNames(self)
See zope.i18n.interfaces.ILocaleCalendar
  getMonthTypeFromAbbreviation(self, abbr)
See zope.i18n.interfaces.ILocaleCalendar
  getMonthTypeFromName(self, name)
See zope.i18n.interfaces.ILocaleCalendar
  isWeekend(self, datetime)
See zope.i18n.interfaces.ILocaleCalendar
    Inherited from AttributeInheritance
  __getattr__(self, name)
See zope.i18n.interfaces.locales.ILocaleInheritance
  __setattr__(self, name, value)
See zope.i18n.interfaces.locales.ILocaleInheritance
    Inherited from Inheritance
  getInheritedSelf(self)
See zope.i18n.interfaces.locales.ILocaleInheritance
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
Implements __implemented__ = <implementedBy zope.i18n.locales.Local...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...
    Inherited from Inheritance
str __name__ = 'Inheritance'
NoneType __parent__ = None                                                                  
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...

Method Details

__init__(self, type)
(Constructor)

Initialize the object.
Overrides:
__builtin__.object.__init__

getDayAbbreviations(self)

See zope.i18n.interfaces.ILocaleCalendar

getDayNames(self)

See zope.i18n.interfaces.ILocaleCalendar

getDayTypeFromAbbreviation(self, abbr)

See zope.i18n.interfaces.ILocaleCalendar

getDayTypeFromName(self, name)

See zope.i18n.interfaces.ILocaleCalendar

getFirstWeekDayName(self)

See zope.i18n.interfaces.ILocaleCalendar

getMonthAbbreviations(self)

See zope.i18n.interfaces.ILocaleCalendar

getMonthNames(self)

See zope.i18n.interfaces.ILocaleCalendar

getMonthTypeFromAbbreviation(self, abbr)

See zope.i18n.interfaces.ILocaleCalendar

getMonthTypeFromName(self, name)

See zope.i18n.interfaces.ILocaleCalendar

isWeekend(self, datetime)

See zope.i18n.interfaces.ILocaleCalendar

Class Variable Details

__implemented__

Type:
Implements
Value:
<implementedBy zope.i18n.locales.LocaleCalendar>                       

__provides__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0xb5ed7b0c>       

Generated by Epydoc 2.1 on Fri Jun 24 12:01:26 2005 http://epydoc.sf.net