* src/dates/Date_nl.py: Replace dashes with slashes, other

enhancements.


svn: r5498
This commit is contained in:
Alex Roitman 2005-12-07 18:12:57 +00:00
parent a09e1818c7
commit ee63ee0204
2 changed files with 22 additions and 19 deletions

View File

@ -1,3 +1,7 @@
2005-12-07 Benny Malengier <bm@cage.UGent.be>
* src/dates/Date_nl.py: Replace dashes with slashes, other
enhancements.
2005-12-07 Alex Roitman <shura@gramps-project.org> 2005-12-07 Alex Roitman <shura@gramps-project.org>
* src/DateDisplay.py (_display_gregorian): Replace dashes with * src/DateDisplay.py (_display_gregorian): Replace dashes with
slashes to prevent collision with the ISO format. slashes to prevent collision with the ISO format.

View File

@ -22,6 +22,10 @@
# $Id$ # $Id$
# Written by Benny Malengier # Written by Benny Malengier
# Last change 2005/12/05:
# Correspond naming of dates with actual action, so for abbreviation
# of month given by mnd. not MAAND
# Also less possibilities
""" """
Dutch-specific classes for parsing and displaying dates. Dutch-specific classes for parsing and displaying dates.
@ -143,22 +147,23 @@ class DateDisplayNL(DateDisplay):
_bce_str = "%s v. Chr." _bce_str = "%s v. Chr."
formats = ( formats = (
"JJJJ-MM-DD (ISO)", "Numerisch", "Maand Dag Jaar", "JJJJ-MM-DD (ISO)", "Numerisch DD/MM/JJ", "Maand Dag, Jaar",
"MAAND Dag Jaar", "Dag. Maand Jaar", "Dag. MAAND Jaar", "Mnd. Dag Jaar", "Dag Maand Jaar", "Dag Mnd. Jaar"
"Dag Maand Jaar"
) )
def _display_gregorian(self,date_val): def _display_gregorian(self,date_val):
year = self._slash_year(date_val[2],date_val[3]) year = self._slash_year(date_val[2],date_val[3])
if self.format == 0: if self.format == 0:
value = self.display_iso(date_val) return self.display_iso(date_val)
elif self.format == 1: elif self.format == 1:
# Numeric
if date_val[0] == 0 and date_val[1] == 0: if date_val[0] == 0 and date_val[1] == 0:
value = str(date_val[2]) value = str(date_val[2])
else: else:
value = self._tformat.replace('%m',str(date_val[1])) value = self._tformat.replace('%m',str(date_val[1]))
value = value.replace('%d',str(date_val[0])) value = value.replace('%d',str(date_val[0]))
value = value.replace('%Y',str(date_val[2])) value = value.replace('%Y',str(abs(date_val[2])))
value = value.replace('-','/')
elif self.format == 2: elif self.format == 2:
# Month Day, Year # Month Day, Year
if date_val[0] == 0: if date_val[0] == 0:
@ -169,7 +174,7 @@ class DateDisplayNL(DateDisplay):
else: else:
value = "%s %d, %s" % (self._months[date_val[1]],date_val[0],year) value = "%s %d, %s" % (self._months[date_val[1]],date_val[0],year)
elif self.format == 3: elif self.format == 3:
# MON Day, Year # Mnd Day, Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
@ -178,25 +183,16 @@ class DateDisplayNL(DateDisplay):
else: else:
value = "%s %d, %s" % (self._MONS[date_val[1]],date_val[0],year) value = "%s %d, %s" % (self._MONS[date_val[1]],date_val[0],year)
elif self.format == 4: elif self.format == 4:
# Day. Month Year # Day Month Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self._months[date_val[1]],year) value = "%s %s" % (self._months[date_val[1]],year)
else: else:
value = "%d. %s %s" % (date_val[0],self._months[date_val[1]],year) value = "%d %s %s" % (date_val[0],self._months[date_val[1]],year)
elif self.format == 5:
# 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)
else: else:
# Day Mon Year # Day Mnd Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
@ -204,7 +200,10 @@ class DateDisplayNL(DateDisplay):
value = "%s %s" % (self._MONS[date_val[1]],year) value = "%s %s" % (self._MONS[date_val[1]],year)
else: else:
value = "%d %s %s" % (date_val[0],self._MONS[date_val[1]],year) value = "%d %s %s" % (date_val[0],self._MONS[date_val[1]],year)
return value if date_val[2] < 0:
return self._bce_str % value
else:
return value
def display(self,date): def display(self,date):
""" """