polish date handler for french locales

This commit is contained in:
Jérôme Rapinat 2014-05-21 19:40:22 +02:00
parent 20ca667b61
commit c2ee4b0ab9

View File

@ -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)
#-------------------------------------------------------------------------
@ -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):
@ -340,7 +340,7 @@ class DateDisplayFR(DateDisplay):
# self.short_months[date_val[1]], year)
value = "%d. %s %s" % (date_val[0],
self.short_months[date_val[1]], year)
self.short_months[date_val[1]], year)
elif self.format == 6:
# month_name day, year
@ -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)