From 72cc250b0260af76db45dcc95417da290217811f Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 19 May 2005 00:15:30 +0000 Subject: [PATCH] * src/dates/Date_de.py: handle dates in the form of dd. mon year svn: r4623 --- gramps2/ChangeLog | 3 ++ gramps2/src/dates/Date_de.py | 55 +++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 22619b4bc..eae947281 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,6 @@ +2005-05-18 Don Allingham + * src/dates/Date_de.py: handle dates in the form of dd. mon year + 2005-05-18 Richard Bos * src/data/gramps.desktop: Add Dutch strings. diff --git a/gramps2/src/dates/Date_de.py b/gramps2/src/dates/Date_de.py index e47ed47cc..9df2e7830 100644 --- a/gramps2/src/dates/Date_de.py +++ b/gramps2/src/dates/Date_de.py @@ -114,6 +114,10 @@ class DateParserDE(DateParser): DateParser.init_strings(self) self._span = re.compile("(von|vom)\s+(.+)\s+(bis)\s+(.+)",re.IGNORECASE) self._range = re.compile("(zwischen)\s+(.+)\s+(und)\s+(.+)", re.IGNORECASE) + 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) #------------------------------------------------------------------------- # @@ -135,9 +139,58 @@ class DateDisplayDE(DateDisplay): formats = ( "JJJJ-MM-DD (ISO)", "Numerisch", "Monat Tag Jahr", - "MONAT Tag Jahr", "Tag Monat Jahr", "Tag MONAT Jahr" + "MONAT Tag Jahr", "Tag. Monat Jahr", "Tag. MONAT Jahr" ) + def _display_gregorian(self,date_val): + year = self._slash_year(date_val[2],date_val[3]) + if self.format == 0: + value = self.display_iso(date_val) + elif self.format == 1: + if date_val[0] == 0 and date_val[1] == 0: + value = str(date_val[2]) + else: + value = self._tformat.replace('%m',str(date_val[1])) + value = value.replace('%d',str(date_val[0])) + value = value.replace('%Y',str(date_val[2])) + elif self.format == 2: + # Month Day, Year + if date_val[0] == 0: + if date_val[1] == 0: + value = year + else: + value = "%s %s" % (self._months[date_val[1]],year) + else: + value = "%s %d, %s" % (self._months[date_val[1]],date_val[0],year) + elif self.format == 3: + # MON Day, Year + if date_val[0] == 0: + if date_val[1] == 0: + value = year + else: + value = "%s %s" % (self._MONS[date_val[1]],year) + else: + value = "%s %d, %s" % (self._MONS[date_val[1]],date_val[0],year) + elif self.format == 4: + # Day Month Year + if date_val[0] == 0: + if date_val[1] == 0: + value = year + else: + value = "%s %s" % (self._months[date_val[1]],year) + else: + value = "%d. %s %s" % (date_val[0],self._months[date_val[1]],year) + else: + # Day MON Year + if date_val[0] == 0: + if date_val[1] == 0: + value = year + else: + value = "%s %s" % (self._MONS[date_val[1]],year) + else: + value = "%d. %s %s" % (date_val[0],self._MONS[date_val[1]],year) + return value + def display(self,date): """ Returns a text string representing the date.