polish date handler for french locales
This commit is contained in:
parent
20ca667b61
commit
c2ee4b0ab9
@ -77,7 +77,7 @@ class DateParserFR(DateParser):
|
||||
'vers' : Date.MOD_ABOUT,
|
||||
'~' : Date.MOD_ABOUT,
|
||||
}
|
||||
|
||||
|
||||
quality_to_int = {
|
||||
'estimée': Date.QUAL_ESTIMATED,
|
||||
'est.' : Date.QUAL_ESTIMATED,
|
||||
@ -96,7 +96,7 @@ class DateParserFR(DateParser):
|
||||
def init_strings(self):
|
||||
"""
|
||||
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
|
||||
@ -105,13 +105,13 @@ class DateParserFR(DateParser):
|
||||
override stuff from this method. See DateParserRU() as an example.
|
||||
"""
|
||||
DateParser.init_strings(self)
|
||||
|
||||
|
||||
DateParser.calendar_to_int.update({
|
||||
'révolutionnaire' : Date.CAL_FRENCH,
|
||||
'r' : Date.CAL_FRENCH,
|
||||
'perse' : Date.CAL_PERSIAN,
|
||||
})
|
||||
|
||||
|
||||
DateParser.month_to_int.update({
|
||||
"januaris" : 1,
|
||||
"januarii" : 1,
|
||||
@ -155,7 +155,7 @@ class DateParserFR(DateParser):
|
||||
"ernting" : 8,
|
||||
"septembris" : 9,
|
||||
"7bre" : 9,
|
||||
"7bris" : 9,
|
||||
"7bris" : 9,
|
||||
"september" : 9,
|
||||
"scheidling" : 9,
|
||||
"october" : 10,
|
||||
@ -163,7 +163,7 @@ class DateParserFR(DateParser):
|
||||
"8bre" : 10,
|
||||
"8bris" : 10,
|
||||
"gilbhard" : 10,
|
||||
"november" : 11,
|
||||
"november" : 11,
|
||||
"novembris" : 11,
|
||||
"9bre" : 11,
|
||||
"9bris" : 11,
|
||||
@ -177,15 +177,15 @@ class DateParserFR(DateParser):
|
||||
"xbris" : 12,
|
||||
"julmond" : 12,
|
||||
"christmond" : 12,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
# This self._numeric is different from the base
|
||||
# avoid bug gregorian / french calendar conversion (+/-10 days)
|
||||
|
||||
self._numeric = re.compile("((\d+)[/\. ])?\s*((\d+)[/\.])?\s*(\d+)\s*$")
|
||||
self._span = re.compile("(de)\s+(?P<start>.+)\s+(à)\s+(?P<stop>.+)",
|
||||
self._numeric = re.compile(r"((\d+)[/\. ])?\s*((\d+)[/\.])?\s*(\d+)\s*$")
|
||||
self._span = re.compile(r"(de)\s+(?P<start>.+)\s+(à)\s+(?P<stop>.+)",
|
||||
re.IGNORECASE)
|
||||
self._range = re.compile("(entre|ent\.|ent)\s+(?P<start>.+)\s+(et)\s+(?P<stop>.+)",
|
||||
self._range = re.compile(r"(entre|ent\.|ent)\s+(?P<start>.+)\s+(et)\s+(?P<stop>.+)",
|
||||
re.IGNORECASE)
|
||||
|
||||
# This self._text are different from the base
|
||||
@ -193,32 +193,32 @@ class DateParserFR(DateParser):
|
||||
|
||||
#gregorian and julian
|
||||
|
||||
self._text2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._text2 = re.compile(r'(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._mon_str, re.IGNORECASE)
|
||||
|
||||
#hebrew
|
||||
|
||||
self._jtext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._jtext2 = re.compile(r'(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._jmon_str, re.IGNORECASE)
|
||||
|
||||
#french
|
||||
|
||||
self._ftext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._ftext2 = re.compile(r'(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._fmon_str, re.IGNORECASE)
|
||||
|
||||
#persian
|
||||
|
||||
self._ptext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._ptext2 = re.compile(r'(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._pmon_str, re.IGNORECASE)
|
||||
|
||||
#islamic
|
||||
|
||||
self._itext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._itext2 = re.compile(r'(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._imon_str, re.IGNORECASE)
|
||||
|
||||
#swedish
|
||||
|
||||
self._stext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._stext2 = re.compile(r'(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' %
|
||||
self._smon_str, re.IGNORECASE)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -228,7 +228,7 @@ class DateParserFR(DateParser):
|
||||
#-------------------------------------------------------------------------
|
||||
class DateDisplayFR(DateDisplay):
|
||||
"""
|
||||
French language date display class.
|
||||
French language date display class.
|
||||
"""
|
||||
|
||||
_bce_str = "%s avant le calendrier"
|
||||
@ -239,7 +239,7 @@ class DateDisplayFR(DateDisplay):
|
||||
_locale_tformat = _locale_tformat.replace('%d', "J")
|
||||
_locale_tformat = _locale_tformat.replace('%m', "M")
|
||||
_locale_tformat = _locale_tformat.replace('%Y', "A")
|
||||
|
||||
|
||||
formats = ("AAAA-MM-JJ (ISO)", # 0
|
||||
"Défaut système (" + _locale_tformat + ")", # 1
|
||||
"Jour Mois Année", # 2
|
||||
@ -247,8 +247,8 @@ class DateDisplayFR(DateDisplay):
|
||||
"Jour. Mois Année", # 4
|
||||
"Jour. MOI Année", # 5
|
||||
"Mois Jour, Année", # 6
|
||||
"MOI Jour, Année", # 7
|
||||
)
|
||||
"MOI Jour, Année",) # 7
|
||||
|
||||
# this definition must agree with its "_display_gregorian" method
|
||||
|
||||
def _display_gregorian(self, date_val, **kwargs):
|
||||
@ -291,7 +291,7 @@ class DateDisplayFR(DateDisplay):
|
||||
value = "%s %s" % (self.long_months[date_val[1]], year)
|
||||
else:
|
||||
|
||||
value = "%d %s %s" % (date_val[0],
|
||||
value = "%d %s %s" % (date_val[0],
|
||||
self.long_months[date_val[1]], year)
|
||||
elif self.format == 3:
|
||||
|
||||
@ -304,7 +304,7 @@ class DateDisplayFR(DateDisplay):
|
||||
value = "%s %s" % (self.short_months[date_val[1]], year)
|
||||
else:
|
||||
|
||||
value = "%d %s %s" % (date_val[0],
|
||||
value = "%d %s %s" % (date_val[0],
|
||||
self.short_months[date_val[1]], year)
|
||||
elif self.format == 4:
|
||||
|
||||
@ -318,10 +318,10 @@ class DateDisplayFR(DateDisplay):
|
||||
else:
|
||||
|
||||
# base_display :
|
||||
# value = "%d %s %s" % (date_val[0],
|
||||
# value = "%d %s %s" % (date_val[0],
|
||||
# self.long_months[date_val[1]], year)
|
||||
|
||||
value = "%d. %s %s" % (date_val[0],
|
||||
value = "%d. %s %s" % (date_val[0],
|
||||
self.long_months[date_val[1]],
|
||||
year)
|
||||
elif self.format == 5:
|
||||
@ -336,11 +336,11 @@ class DateDisplayFR(DateDisplay):
|
||||
else:
|
||||
|
||||
# base_display :
|
||||
# value = "%d %s %s" % (date_val[0],
|
||||
# value = "%d %s %s" % (date_val[0],
|
||||
# self.short_months[date_val[1]], year)
|
||||
|
||||
value = "%d. %s %s" % (date_val[0],
|
||||
self.short_months[date_val[1]], year)
|
||||
value = "%d. %s %s" % (date_val[0],
|
||||
self.short_months[date_val[1]], year)
|
||||
elif self.format == 6:
|
||||
|
||||
# month_name day, year
|
||||
@ -367,12 +367,12 @@ class DateDisplayFR(DateDisplay):
|
||||
date_val[0], year)
|
||||
else:
|
||||
return self.display_iso(date_val)
|
||||
|
||||
|
||||
if date_val[2] < 0:
|
||||
return self._bce_str % value
|
||||
else:
|
||||
return value
|
||||
|
||||
|
||||
display = DateDisplay.display_formatted
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -382,4 +382,4 @@ class DateDisplayFR(DateDisplay):
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
register_datehandler(('fr_FR', 'fr', 'french', 'French', 'fr_CA',
|
||||
'fr_BE', 'fr_CH'), DateParserFR, DateDisplayFR)
|
||||
'fr_BE', 'fr_CH'), DateParserFR, DateDisplayFR)
|
||||
|
Loading…
Reference in New Issue
Block a user