svn: r5460
This commit is contained in:
Alex Roitman 2005-12-01 19:21:10 +00:00
parent 11d24648f9
commit 60c52bb9cf

View File

@ -22,7 +22,7 @@
# $Id$ # $Id$
""" """
German-specific classes for parsing and displaying dates. Dutch-specific classes for parsing and displaying dates.
""" """
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -49,7 +49,8 @@ from DateDisplay import DateDisplay
class DateParserNL(DateParser): class DateParserNL(DateParser):
month_to_int = DateParser.month_to_int month_to_int = DateParser.month_to_int
# Always add dutch and flemish name variants no matter what the current locale is # Always add dutch and flemish name variants
# no matter what the current locale is
month_to_int[u"januari"] = 1 month_to_int[u"januari"] = 1
month_to_int[u"jan"] = 1 month_to_int[u"jan"] = 1
# Add other common latin, local and historical variants # Add other common latin, local and historical variants
@ -104,15 +105,21 @@ class DateParserNL(DateParser):
u'ber.' : Date.QUAL_CALCULATED, u'ber.' : Date.QUAL_CALCULATED,
} }
bce = DateParser.bce + ["voor onze tijdrekening", "voor Christus", "v\. Chr\."] bce = DateParser.bce + ["voor onze tijdrekening",
"voor Christus",
"v\. Chr\."]
def init_strings(self): def init_strings(self):
DateParser.init_strings(self) DateParser.init_strings(self)
self._span = re.compile("(van)\s+(?P<start>.+)\s+(tot)\s+(?P<stop>.+)",re.IGNORECASE) self._span = re.compile("(van)\s+(?P<start>.+)\s+(tot)\s+(?P<stop>.+)",
self._range = re.compile("tussen\s+(?P<start>.+)\s+en\s+(?P<stop>.+)", re.IGNORECASE) re.IGNORECASE)
self._text2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._mon_str, self._range = re.compile("tussen\s+(?P<start>.+)\s+en\s+(?P<stop>.+)",
re.IGNORECASE) re.IGNORECASE)
self._jtext2= re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._jmon_str, self._text2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?'
% self._mon_str,
re.IGNORECASE)
self._jtext2= re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?'
% self._jmon_str,
re.IGNORECASE) re.IGNORECASE)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -135,7 +142,8 @@ class DateDisplayNL(DateDisplay):
formats = ( formats = (
"JJJJ-MM-DD (ISO)", "Numerisch", "Maand Dag Jaar", "JJJJ-MM-DD (ISO)", "Numerisch", "Maand Dag Jaar",
"MAAND Dag Jaar", "Dag. Maand Jaar", "Dag. MAAND Jaar", "Dag Maand Jaar" "MAAND Dag Jaar", "Dag. Maand Jaar", "Dag. MAAND Jaar",
"Dag Maand Jaar"
) )
def _display_gregorian(self,date_val): def _display_gregorian(self,date_val):
@ -229,4 +237,5 @@ class DateDisplayNL(DateDisplay):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from DateHandler import register_datehandler from DateHandler import register_datehandler
register_datehandler(('nl_NL','dutch','nl_BE','nl'),DateParserNL, DateDisplayNL) register_datehandler(('nl_NL','dutch','nl_BE','nl'),
DateParserNL, DateDisplayNL)