2009-02-01 22:55:12 +05:30
|
|
|
#!/usr/bin/python
|
2004-11-16 09:14:23 +05:30
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2006-02-04 03:33:53 +05:30
|
|
|
# Copyright (C) 2004-2006 Donald N. Allingham
|
2004-11-16 09:14:23 +05:30
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
2009-02-01 22:55:12 +05:30
|
|
|
# This program is distributed in the hope that it will be useful,
|
2004-11-16 09:14:23 +05:30
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
"""
|
|
|
|
French-specific classes for parsing and displaying dates.
|
|
|
|
"""
|
|
|
|
|
2004-11-16 09:14:23 +05:30
|
|
|
import re
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-10-08 22:11:39 +05:30
|
|
|
from gen.lib import Date
|
2006-03-11 10:28:58 +05:30
|
|
|
from _DateParser import DateParser
|
|
|
|
from _DateDisplay import DateDisplay
|
|
|
|
from _DateHandler import register_datehandler
|
2004-11-16 09:14:23 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# French parser
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class DateParserFR(DateParser):
|
2009-04-29 18:08:30 +05:30
|
|
|
"""
|
|
|
|
Convert a text string into a Date object. If the date cannot be
|
|
|
|
converted, the text string is assigned.
|
|
|
|
"""
|
2004-11-16 09:14:23 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
month_to_int = DateParser.month_to_int
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2006-09-13 23:42:53 +05:30
|
|
|
# Add common value
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2009-06-25 23:46:50 +05:30
|
|
|
month_to_int[u"bluviose"] = 5
|
|
|
|
month_to_int[u"vendose"] = 6
|
2009-02-01 22:55:12 +05:30
|
|
|
month_to_int[u"7bre"] = 9
|
|
|
|
month_to_int[u"8bre"] = 10
|
|
|
|
month_to_int[u"9bre"] = 11
|
|
|
|
month_to_int[u"10bre"] = 12
|
|
|
|
month_to_int[u"xbre"] = 12
|
|
|
|
|
2006-09-13 23:42:53 +05:30
|
|
|
# Add common latin
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2006-09-13 23:42:53 +05:30
|
|
|
month_to_int[u"januaris"] = 1
|
|
|
|
month_to_int[u"januarii"] = 1
|
|
|
|
month_to_int[u"januarius"] = 1
|
2009-02-01 22:55:12 +05:30
|
|
|
month_to_int[u"februaris"] = 2
|
|
|
|
month_to_int[u"februarii"] = 2
|
|
|
|
month_to_int[u"februarius"] = 2
|
|
|
|
month_to_int[u"martii"] = 3
|
|
|
|
month_to_int[u"martius"] = 3
|
|
|
|
month_to_int[u"aprilis"] = 4
|
|
|
|
month_to_int[u"maius"] = 5
|
|
|
|
month_to_int[u"maii"] = 5
|
|
|
|
month_to_int[u"junius"] = 6
|
|
|
|
month_to_int[u"junii"] = 6
|
|
|
|
month_to_int[u"julius"] = 7
|
|
|
|
month_to_int[u"julii"] = 7
|
|
|
|
month_to_int[u"augustus"] = 8
|
|
|
|
month_to_int[u"augusti"] = 8
|
|
|
|
month_to_int[u"septembris"] = 9
|
|
|
|
month_to_int[u"7bris"] = 9
|
|
|
|
month_to_int[u"september"] = 9
|
|
|
|
month_to_int[u"october"] = 10
|
|
|
|
month_to_int[u"octobris"] = 10
|
|
|
|
month_to_int[u"8bris"] = 10
|
|
|
|
month_to_int[u"novembris"] = 11
|
|
|
|
month_to_int[u"9bris"] = 11
|
|
|
|
month_to_int[u"november"] = 11
|
|
|
|
month_to_int[u"decembris"] = 12
|
|
|
|
month_to_int[u"10bris"] = 12
|
|
|
|
month_to_int[u"xbris"] = 12
|
|
|
|
month_to_int[u"december"] = 12
|
|
|
|
|
2006-09-13 23:42:53 +05:30
|
|
|
#local and historical variants
|
|
|
|
# Add common on east france
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2006-09-13 23:42:53 +05:30
|
|
|
month_to_int[u"janer"] = 1
|
|
|
|
month_to_int[u"jenner"] = 1
|
|
|
|
month_to_int[u"hartmonat"] = 1
|
|
|
|
month_to_int[u"hartung"] = 1
|
|
|
|
month_to_int[u"eismond"] = 1
|
2009-02-01 22:55:12 +05:30
|
|
|
month_to_int[u"hornung"] = 2
|
|
|
|
month_to_int[u"wintermonat"] = 2
|
|
|
|
month_to_int[u"taumond"] = 2
|
|
|
|
month_to_int[u"narrenmond"] = 2
|
|
|
|
month_to_int[u"lenzing"] = 3
|
|
|
|
month_to_int[u"ostermond"] = 4
|
|
|
|
month_to_int[u"wonnemond"] = 5
|
|
|
|
month_to_int[u"wiesenmonat"] = 5
|
|
|
|
month_to_int[u"brachet"] = 6
|
|
|
|
month_to_int[u"heuet"] = 7
|
|
|
|
month_to_int[u"ernting"] = 8
|
|
|
|
month_to_int[u"scheiding"] = 9
|
|
|
|
month_to_int[u"gilbhard"] = 10
|
|
|
|
month_to_int[u"nebelmonat"] = 11
|
|
|
|
month_to_int[u"nebelung"] = 11
|
|
|
|
month_to_int[u"julmond"] = 12
|
2006-03-01 01:24:35 +05:30
|
|
|
|
2004-11-16 09:14:23 +05:30
|
|
|
modifier_to_int = {
|
2009-02-01 22:55:12 +05:30
|
|
|
u'avant': Date.MOD_BEFORE,
|
|
|
|
u'av.': Date.MOD_BEFORE,
|
|
|
|
u'après': Date.MOD_AFTER,
|
|
|
|
u'ap.': Date.MOD_AFTER,
|
|
|
|
u'ap': Date.MOD_AFTER,
|
|
|
|
u'env.': Date.MOD_ABOUT,
|
|
|
|
u'env': Date.MOD_ABOUT,
|
|
|
|
u'environ': Date.MOD_ABOUT,
|
|
|
|
u'circa': Date.MOD_ABOUT,
|
|
|
|
u'c.': Date.MOD_ABOUT,
|
|
|
|
u'ca': Date.MOD_ABOUT,
|
|
|
|
u'ca.': Date.MOD_ABOUT,
|
|
|
|
u'vers': Date.MOD_ABOUT,
|
|
|
|
u'~': Date.MOD_ABOUT,
|
2004-11-16 09:14:23 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
calendar_to_int = {
|
2009-02-01 22:55:12 +05:30
|
|
|
u'grégorien': Date.CAL_GREGORIAN,
|
|
|
|
u'g': Date.CAL_GREGORIAN,
|
|
|
|
u'julien': Date.CAL_JULIAN,
|
|
|
|
u'j': Date.CAL_JULIAN,
|
|
|
|
u'hébreu': Date.CAL_HEBREW,
|
|
|
|
u'h': Date.CAL_HEBREW,
|
|
|
|
u'islamique': Date.CAL_ISLAMIC,
|
|
|
|
u'i': Date.CAL_ISLAMIC,
|
|
|
|
u'révolutionnaire': Date.CAL_FRENCH,
|
|
|
|
u'r': Date.CAL_FRENCH,
|
|
|
|
u'perse': Date.CAL_PERSIAN,
|
|
|
|
u'p': Date.CAL_PERSIAN,
|
|
|
|
u'suédois': Date.CAL_SWEDISH,
|
|
|
|
u's': Date.CAL_SWEDISH,
|
2004-11-16 09:14:23 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
quality_to_int = {
|
2009-02-01 22:55:12 +05:30
|
|
|
u'estimée': Date.QUAL_ESTIMATED,
|
|
|
|
u'est.': Date.QUAL_ESTIMATED,
|
|
|
|
u'est': Date.QUAL_ESTIMATED,
|
|
|
|
u'calculée': Date.QUAL_CALCULATED,
|
|
|
|
u'calc.': Date.QUAL_CALCULATED,
|
|
|
|
u'calc': Date.QUAL_CALCULATED,
|
|
|
|
u'comptée': Date.QUAL_CALCULATED,
|
|
|
|
u'compt': Date.QUAL_CALCULATED,
|
|
|
|
u'compt.': Date.QUAL_CALCULATED,
|
2004-11-16 09:14:23 +05:30
|
|
|
}
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
bce = [u"avant le calendrier", u"avant notre ère", u"avant JC",
|
|
|
|
u"avant J.C"] + DateParser.bce
|
2004-11-16 09:14:23 +05:30
|
|
|
|
|
|
|
def init_strings(self):
|
2009-04-29 18:08:30 +05:30
|
|
|
"""
|
|
|
|
This method compiles regular expression strings for matching dates.
|
|
|
|
|
|
|
|
Most of the re's in most languages can stay as is. span and range
|
|
|
|
most likely will need to change. Whatever change is done, this method
|
|
|
|
may be called first as DateParser.init_strings(self) so that the
|
|
|
|
invariant expresions don't need to be repeteadly coded. All differences
|
|
|
|
can be coded after DateParser.init_strings(self) call, that way they
|
|
|
|
override stuff from this method. See DateParserRU() as an example.
|
|
|
|
"""
|
2004-11-16 09:14:23 +05:30
|
|
|
DateParser.init_strings(self)
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2006-05-02 02:41:26 +05:30
|
|
|
# This self._numeric is different from the base
|
2007-09-07 13:23:28 +05:30
|
|
|
# avoid bug gregorian / french calendar conversion (+/-10 days)
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
self._numeric = re.compile("((\d+)[/\. ])?\s*((\d+)[/\.])?\s*(\d+)\s*$")
|
|
|
|
self._span = re.compile(u"(de)\s+(?P<start>.+)\s+(à)\s+(?P<stop>.+)",
|
|
|
|
re.IGNORECASE)
|
|
|
|
self._range = re.compile(u"(entre|ent\.|ent)\s+(?P<start>.+)\s+(et)\s+(?P<stop>.+)",
|
|
|
|
re.IGNORECASE)
|
|
|
|
|
2008-01-06 01:40:26 +05:30
|
|
|
# This self._text are different from the base
|
2009-07-06 15:29:54 +05:30
|
|
|
# by adding ".?" after the first date and removing "\s*$" at the end
|
|
|
|
|
2008-01-06 01:40:26 +05:30
|
|
|
#gregorian and julian
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
self._text2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
|
|
|
self._mon_str, re.IGNORECASE)
|
|
|
|
|
2008-01-06 01:40:26 +05:30
|
|
|
#hebrew
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
self._jtext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
|
|
|
self._jmon_str, re.IGNORECASE)
|
|
|
|
|
2008-01-06 01:40:26 +05:30
|
|
|
#french
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
self._ftext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
|
|
|
self._fmon_str, re.IGNORECASE)
|
|
|
|
|
2008-01-06 01:40:26 +05:30
|
|
|
#persian
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
self._ptext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
|
|
|
self._pmon_str, re.IGNORECASE)
|
|
|
|
|
2008-01-06 01:40:26 +05:30
|
|
|
#islamic
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
self._itext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
|
|
|
self._imon_str, re.IGNORECASE)
|
|
|
|
|
2009-01-22 15:45:01 +05:30
|
|
|
#swedish
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
self._stext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
|
|
|
self._smon_str, re.IGNORECASE)
|
|
|
|
|
|
|
|
|
2004-11-16 09:14:23 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# French display
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class DateDisplayFR(DateDisplay):
|
2009-04-29 18:08:30 +05:30
|
|
|
"""
|
|
|
|
French language date display class.
|
|
|
|
"""
|
2009-10-28 20:30:16 +05:30
|
|
|
long_months = ( u"", u"Janvier", u"Février", u"Mars", u"Avril", u"Mai",
|
|
|
|
u"Juin", u"Juillet", u"Août", u"Septembre", u"Octobre",
|
|
|
|
u"Novembre", u"Décember" )
|
2009-10-28 08:55:57 +05:30
|
|
|
|
2009-10-28 20:30:16 +05:30
|
|
|
# jun / jul ?
|
|
|
|
short_months = ( u"", u"Jan", u"Fév", u"Mar", u"Avr", u"Mai", u"Jun",
|
|
|
|
u"Jul", u"Aou", u"Sep", u"Oct", u"Nov", u"Déc" )
|
2004-11-16 09:14:23 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
calendar = ("", u" (Julien)", u" (Hébreu)", u" (Révolutionnaire)",
|
|
|
|
u" (Perse)", u" (Islamique)", u" (Suédois)")
|
2004-11-16 09:14:23 +05:30
|
|
|
|
2007-06-27 10:20:33 +05:30
|
|
|
_mod_str = ("", u"avant ", u"après ", u"vers ", "", "", "")
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-06-27 10:20:33 +05:30
|
|
|
_qual_str = ("", u"estimée ", u"calculée ", "")
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-09-07 13:23:28 +05:30
|
|
|
_bce_str = u"%s avant le calendrier"
|
2005-01-19 10:43:09 +05:30
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
formats = ("AAAA-MM-JJ (ISO)", "Numérique", "Mois Jour, Année",
|
2009-07-06 15:29:54 +05:30
|
|
|
"MOI Jour, Année", "Jour. Mois Année", "Jour. MOI Année",
|
|
|
|
"Jour Mois Année", "Jour MOI Année")
|
2005-01-19 10:43:09 +05:30
|
|
|
|
2007-06-27 10:20:33 +05:30
|
|
|
def _display_gregorian(self, date_val):
|
2009-04-29 18:08:30 +05:30
|
|
|
"""
|
|
|
|
display gregorian calendar date in different format
|
|
|
|
"""
|
2007-06-27 10:20:33 +05:30
|
|
|
year = self._slash_year(date_val[2], date_val[3])
|
2006-03-01 01:24:35 +05:30
|
|
|
if self.format == 0:
|
2006-05-02 02:41:26 +05:30
|
|
|
return self.display_iso(date_val)
|
2006-03-01 01:24:35 +05:30
|
|
|
elif self.format == 1:
|
2009-02-01 22:55:12 +05:30
|
|
|
if date_val[2] < 0 or date_val[3]:
|
|
|
|
return self.display_iso(date_val)
|
2006-03-01 01:24:35 +05:30
|
|
|
else:
|
2008-06-16 20:31:46 +05:30
|
|
|
if date_val[0] == date_val[1] == 0:
|
2006-05-02 02:41:26 +05:30
|
|
|
value = str(date_val[2])
|
|
|
|
else:
|
2007-06-27 10:20:33 +05:30
|
|
|
value = self._tformat.replace('%m', str(date_val[1]))
|
|
|
|
value = value.replace('%d', str(date_val[0]))
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2009-07-06 15:29:54 +05:30
|
|
|
# base_display :
|
|
|
|
# value = value.replace('%Y', str(abs(date_val[2])))
|
2007-06-27 10:20:33 +05:30
|
|
|
# value = value.replace('-', '/')
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
value = value.replace('%Y', str(date_val[2]))
|
2006-03-01 01:24:35 +05:30
|
|
|
elif self.format == 2:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
# Month Day, Year
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
if date_val[0] == 0:
|
|
|
|
if date_val[1] == 0:
|
|
|
|
value = year
|
|
|
|
else:
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%s %s" % (self.long_months[date_val[1]], year)
|
2006-03-01 01:24:35 +05:30
|
|
|
else:
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%s %d, %s" % (self.long_months[date_val[1]],
|
|
|
|
date_val[0], year)
|
2006-03-01 01:24:35 +05:30
|
|
|
elif self.format == 3:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
# MON Day, Year
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
if date_val[0] == 0:
|
|
|
|
if date_val[1] == 0:
|
|
|
|
value = year
|
|
|
|
else:
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%s %s" % (self.short_months[date_val[1]], year)
|
2006-03-01 01:24:35 +05:30
|
|
|
else:
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%s %d, %s" % (self.short_months[date_val[1]],
|
|
|
|
date_val[0], year)
|
2006-03-01 01:24:35 +05:30
|
|
|
elif self.format == 4:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2009-01-22 15:45:01 +05:30
|
|
|
# Day. Month Year
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
if date_val[0] == 0:
|
|
|
|
if date_val[1] == 0:
|
|
|
|
value = year
|
|
|
|
else:
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%s %s" % (self.long_months[date_val[1]], year)
|
2006-03-01 01:24:35 +05:30
|
|
|
else:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2009-07-06 15:29:54 +05:30
|
|
|
# base_display :
|
2009-10-28 08:55:57 +05:30
|
|
|
# value = "%d %s %s" % (date_val[0],
|
|
|
|
# self.long_months[date_val[1]], year)
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%d. %s %s" % (date_val[0],
|
|
|
|
self.long_months[date_val[1]],
|
2009-02-01 22:55:12 +05:30
|
|
|
year)
|
2009-07-06 15:29:54 +05:30
|
|
|
elif self.format == 5:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2009-01-22 15:45:01 +05:30
|
|
|
# Day. MON Year
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
if date_val[0] == 0:
|
|
|
|
if date_val[1] == 0:
|
|
|
|
value = year
|
|
|
|
else:
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%s %s" % (self.short_months[date_val[1]], year)
|
2006-03-01 01:24:35 +05:30
|
|
|
else:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2009-07-06 15:29:54 +05:30
|
|
|
# base_display :
|
2009-10-28 08:55:57 +05:30
|
|
|
# value = "%d %s %s" % (date_val[0],
|
|
|
|
# self.short_months[date_val[1]], year)
|
2009-07-06 15:29:54 +05:30
|
|
|
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%d.%s %s" % (date_val[0],
|
|
|
|
self.short_months[date_val[1]], year)
|
2009-07-06 15:29:54 +05:30
|
|
|
|
|
|
|
elif self.format == 6:
|
|
|
|
|
|
|
|
# Day Month Year
|
|
|
|
|
|
|
|
if date_val[0] == 0:
|
|
|
|
if date_val[1] == 0:
|
|
|
|
value = year
|
|
|
|
else:
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%s %s" % (self.long_months[date_val[1]], year)
|
2009-07-06 15:29:54 +05:30
|
|
|
else:
|
|
|
|
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%d %s %s" % (date_val[0],
|
|
|
|
self.long_months[date_val[1]], year)
|
2009-07-06 15:29:54 +05:30
|
|
|
else:
|
|
|
|
|
|
|
|
# Day MON Year
|
|
|
|
|
|
|
|
if date_val[0] == 0:
|
|
|
|
if date_val[1] == 0:
|
|
|
|
value = year
|
|
|
|
else:
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%s %s" % (self.short_months[date_val[1]], year)
|
2009-07-06 15:29:54 +05:30
|
|
|
else:
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2009-10-28 08:55:57 +05:30
|
|
|
value = "%d %s %s" % (date_val[0],
|
|
|
|
self.short_months[date_val[1]], year)
|
2009-07-06 15:29:54 +05:30
|
|
|
|
2006-05-02 02:41:26 +05:30
|
|
|
if date_val[2] < 0:
|
|
|
|
return self._bce_str % value
|
|
|
|
else:
|
|
|
|
return value
|
2006-03-01 01:24:35 +05:30
|
|
|
|
2007-06-27 10:20:33 +05:30
|
|
|
def display(self, date):
|
2004-11-16 09:14:23 +05:30
|
|
|
"""
|
2008-02-24 19:25:55 +05:30
|
|
|
Return a text string representing the date.
|
2005-01-19 10:45:30 +05:30
|
|
|
"""
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2004-11-16 09:14:23 +05:30
|
|
|
mod = date.get_modifier()
|
|
|
|
cal = date.get_calendar()
|
|
|
|
qual = date.get_quality()
|
|
|
|
start = date.get_start_date()
|
|
|
|
|
2009-02-01 22:55:12 +05:30
|
|
|
qual_str = (self._qual_str)[qual]
|
|
|
|
|
2004-11-16 09:14:23 +05:30
|
|
|
if mod == Date.MOD_TEXTONLY:
|
|
|
|
return date.get_text()
|
|
|
|
elif start == Date.EMPTY:
|
|
|
|
return ""
|
|
|
|
elif mod == Date.MOD_SPAN:
|
2009-04-29 18:08:30 +05:30
|
|
|
date1 = (self.display_cal)[cal](start)
|
|
|
|
date2 = (self.display_cal)[cal](date.get_stop_date())
|
|
|
|
return "%s%s %s %s %s%s" % (qual_str, u'de', date1, u'à',
|
|
|
|
date2, (self.calendar)[cal])
|
2004-11-16 09:14:23 +05:30
|
|
|
elif mod == Date.MOD_RANGE:
|
2009-04-29 18:08:30 +05:30
|
|
|
date1 = (self.display_cal)[cal](start)
|
|
|
|
date2 = (self.display_cal)[cal](date.get_stop_date())
|
|
|
|
return "%s%s %s %s %s%s" % (qual_str, u'entre', date1, u'et',
|
|
|
|
date2, (self.calendar)[cal])
|
2004-11-16 09:14:23 +05:30
|
|
|
else:
|
2009-02-01 22:55:12 +05:30
|
|
|
text = (self.display_cal)[date.get_calendar()](start)
|
2009-04-29 18:08:30 +05:30
|
|
|
return "%s%s%s%s" % (qual_str, (self._mod_str)[mod], text,
|
|
|
|
(self.calendar)[cal])
|
2009-02-01 22:55:12 +05:30
|
|
|
|
2007-09-08 03:37:50 +05:30
|
|
|
|
2004-11-16 09:14:23 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Register classes
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2009-02-01 22:55:12 +05:30
|
|
|
|
|
|
|
register_datehandler(('fr_FR', 'fr', 'french', 'French', 'fr_CA',
|
|
|
|
'fr_BE', 'fr_CH'), DateParserFR, DateDisplayFR)
|