Trees | Index | Help |
|
---|
Package zope :: Package i18n :: Package locales :: Class 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 | |
---|---|
Initialize the object. | |
See zope.i18n.interfaces.ILocaleCalendar | |
See zope.i18n.interfaces.ILocaleCalendar | |
See zope.i18n.interfaces.ILocaleCalendar | |
See zope.i18n.interfaces.ILocaleCalendar | |
See zope.i18n.interfaces.ILocaleCalendar | |
See zope.i18n.interfaces.ILocaleCalendar | |
See zope.i18n.interfaces.ILocaleCalendar | |
See zope.i18n.interfaces.ILocaleCalendar | |
See zope.i18n.interfaces.ILocaleCalendar | |
See zope.i18n.interfaces.ILocaleCalendar | |
Inherited from AttributeInheritance | |
See zope.i18n.interfaces.locales.ILocaleInheritance | |
See zope.i18n.interfaces.locales.ILocaleInheritance | |
Inherited from Inheritance | |
See zope.i18n.interfaces.locales.ILocaleInheritance | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(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)
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 |
Class Variable Details |
---|
__implemented__
|
__provides__
|
Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Fri Jun 24 12:01:26 2005 | http://epydoc.sf.net |