* src/DateHandler.py: add more English locales

* src/dates/Date_fi.py: fix estimated/calculated, handle span
properly
* src/dates/Makefile.am: remove Date_fi for 2.0.2


svn: r4782
This commit is contained in:
Don Allingham 2005-06-04 04:06:47 +00:00
parent d9edb0bd9c
commit c5b68976e1
9 changed files with 50 additions and 24 deletions

View File

@ -1,3 +1,9 @@
2005-06-03 Don Allingham <don@gramps-project.org>
* src/DateHandler.py: add more English locales
* src/dates/Date_fi.py: fix estimated/calculated, handle span
properly
* src/dates/Makefile.am: remove Date_fi for 2.0.2
2005-06-04 Eero Tamminen <eerot@sf>
* src/po/fi.po: Updated translation to 2.0.2 template.pot.
Everything except for a few dozen tips is translated.

View File

@ -49,21 +49,41 @@ _lang = locale.getlocale(locale.LC_TIME)[0]
_lang_to_parser = {
'C' : DateParser.DateParser,
'en_US' : DateParser.DateParser,
'en_GB' : DateParser.DateParser,
'en_AU' : DateParser.DateParser,
'en_BW' : DateParser.DateParser,
'en_CA' : DateParser.DateParser,
'en_DK' : DateParser.DateParser,
'en_GB' : DateParser.DateParser,
'en_HK' : DateParser.DateParser,
'en_IE' : DateParser.DateParser,
'en_IN' : DateParser.DateParser,
'en_NZ' : DateParser.DateParser,
'en_PH' : DateParser.DateParser,
'en_SE' : DateParser.DateParser,
'en_SG' : DateParser.DateParser,
'en_US' : DateParser.DateParser,
'en_ZA' : DateParser.DateParser,
'en_ZW' : DateParser.DateParser,
'en' : DateParser.DateParser,
}
_lang_to_display = {
'C' : DateDisplay.DateDisplayEn,
'en_US' : DateDisplay.DateDisplayEn,
'en_GB' : DateDisplay.DateDisplayEn,
'en_AU' : DateDisplay.DateDisplayEn,
'en_BW' : DateDisplay.DateDisplayEn,
'en_CA' : DateDisplay.DateDisplayEn,
'en_DK' : DateDisplay.DateDisplayEn,
'en_GB' : DateDisplay.DateDisplayEn,
'en_HK' : DateDisplay.DateDisplayEn,
'en_IE' : DateDisplay.DateDisplayEn,
'en_IN' : DateDisplay.DateDisplayEn,
'en_NZ' : DateDisplay.DateDisplayEn,
'en_PH' : DateDisplay.DateDisplayEn,
'en_SE' : DateDisplay.DateDisplayEn,
'en_SG' : DateDisplay.DateDisplayEn,
'en_US' : DateDisplay.DateDisplayEn,
'en_ZA' : DateDisplay.DateDisplayEn,
'en_ZW' : DateDisplay.DateDisplayEn,
'en' : DateDisplay.DateDisplayEn,
'zh_CN' : DateDisplay.DateDisplay,
'zh_TW' : DateDisplay.DateDisplay,
@ -142,3 +162,4 @@ try:
except:
print "Date displayer for",_lang,"not available, using default"
displayer = _lang_to_display["C"](val)

View File

@ -257,9 +257,9 @@ class DateParser:
re.IGNORECASE)
self._qual = re.compile("%s\s+(.+)" % self._qual_str,
re.IGNORECASE)
self._span = re.compile("(from)\s+(.+)\s+(to)\s+(.+)",
self._span = re.compile("(from)\s+(?P<start>.+)\s+to\s+(?P<stop>.+)",
re.IGNORECASE)
self._range = re.compile("(bet|bet.|between)\s+(.+)\s+(and)\s+(.+)",
self._range = re.compile("(bet|bet.|between)\s+(?P<start>.+)\s+and\s+(?P<stop>.+)",
re.IGNORECASE)
self._modifier = re.compile('%s\s+(.*)' % self._mod_str,
re.IGNORECASE)
@ -452,10 +452,9 @@ class DateParser:
"""
match = self._span.match(text)
if match:
grps = match.groups()
text_parser = self.parser[cal]
start = self._parse_subdate(grps[1],text_parser)
stop = self._parse_subdate(grps[3],text_parser)
start = self._parse_subdate(match.group('start'),text_parser)
stop = self._parse_subdate(match.group('stop'),text_parser)
date.set(qual,Date.MOD_SPAN,cal,start + stop)
return 1
return 0
@ -468,10 +467,9 @@ class DateParser:
"""
match = self._range.match(text)
if match:
grps = match.groups()
text_parser = self.parser[cal]
start = self._parse_subdate(grps[1],text_parser)
stop = self._parse_subdate(grps[3],text_parser)
start = self._parse_subdate(match.group('start'),text_parser)
stop = self._parse_subdate(match.group('stop'),text_parser)
date.set(qual,Date.MOD_RANGE,cal,start + stop)
return 1
return 0

View File

@ -112,8 +112,8 @@ class DateParserDE(DateParser):
def init_strings(self):
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._span = re.compile("(von|vom)\s+(?P<start>.+)\s+(bis)\s+(?P<stop>.+)",re.IGNORECASE)
self._range = re.compile("zwischen\s+(?P<start>.+)\s+und\s+(?P<stop>.+)", 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,

View File

@ -98,10 +98,10 @@ class DateParserES(DateParser):
_span_2 = [u'a']
_range_1 = [u'ent.',u'ent',u'entre']
_range_2 = [u'y']
self._span = re.compile("(%s)\s+(.+)\s+(%s)\s+(.+)" %
self._span = re.compile("(%s)\s+(?P<start>.+)\s+(%s)\s+(?P<stop>.+)" %
('|'.join(_span_1),'|'.join(_span_2)),
re.IGNORECASE)
self._range = re.compile("(%s)\s+(.+)\s+(%s)\s+(.+)" %
self._range = re.compile("(%s)\s+(?P<start>.+)\s+(%s)\s+(?P<stop>.+)" %
('|'.join(_range_1),'|'.join(_range_2)),
re.IGNORECASE)

View File

@ -95,9 +95,9 @@ class DateParserFI(DateParser):
def init_strings(self):
DateParser.init_strings(self)
# date, whitespace
self._span = re.compile("(.+)\s+-\s+(.+)",
self._span = re.compile("(?P<start>.+)\s+(-)\s+(?P<stop>.+)",
re.IGNORECASE)
self._range = re.compile("(vuosien\s*)?(.+)\s+ja\s+(.+)\s+väliltä",
self._range = re.compile("(vuosien\s*)?(?P<start>.+)\s+ja\s+(?P<stop>.+)\s+väliltä",
re.IGNORECASE)
#-------------------------------------------------------------------------
@ -114,7 +114,7 @@ class DateDisplayFI(DateDisplay):
u"(Persialainen)",
u"(Islamilainen)")
_qual_str = ("", "laskettuna", "arviolta")
_qual_str = ("", "arviolta", "laskettuna")
formats = (
"VVVV-KK-PP (ISO)",

View File

@ -92,10 +92,10 @@ class DateParserFR(DateParser):
_span_2 = [u'à']
_range_1 = [u'ent.',u'ent',u'entre']
_range_2 = [u'et']
self._span = re.compile("(%s)\s+(.+)\s+(%s)\s+(.+)" %
self._span = re.compile("(%s)\s+(?P<start>.+)\s+(%s)\s+(?P<stop>.+)" %
('|'.join(_span_1),'|'.join(_span_2)),
re.IGNORECASE)
self._range = re.compile("(%s)\s+(.+)\s+(%s)\s+(.+)" %
self._range = re.compile("(%s)\s+(?P<start>.+)\s+(%s)\s+(?P<stop>.+)" %
('|'.join(_range_1),'|'.join(_range_2)),
re.IGNORECASE)

View File

@ -102,10 +102,10 @@ class DateParserRU(DateParser):
_span_2 = [u'по',u'до']
_range_1 = [u'между',u'меж',u'меж.']
_range_2 = [u'и']
self._span = re.compile("(%s)\s+(.+)\s+(%s)\s+(.+)" %
self._span = re.compile("(%s)\s+(?P<start>.+)\s+(%s)\s+(?P<stop>.+)" %
('|'.join(_span_1),'|'.join(_span_2)),
re.IGNORECASE)
self._range = re.compile("(%s)\s+(.+)\s+(%s)\s+(.+)" %
self._range = re.compile("(%s)\s+(?P<start>.+)\s+(%s)\s+(?P<stop>.+)" %
('|'.join(_range_1),'|'.join(_range_2)),
re.IGNORECASE)

View File

@ -9,9 +9,10 @@ pkgdata_PYTHON = \
Date_de.py\
Date_ru.py\
Date_fr.py\
Date_fi.py\
Date_es.py
# Date_fi.py
pkgpyexecdir = @pkgpyexecdir@/dates
pkgpythondir = @pkgpythondir@/dates