From 358208d34f12c44f504706ffcf22fc5c54fa1191 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Fri, 13 May 2005 15:32:58 +0000 Subject: [PATCH] * src/DateDisplay.py: Allow B.C.E. in years to be localized * src/dates/Date_de.py: Some more translations including B.C.E. svn: r4584 --- gramps2/ChangeLog | 3 +++ gramps2/src/DateDisplay.py | 14 ++++++++++---- gramps2/src/dates/Date_de.py | 13 ++++++++++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 65442fd0a..03b5c1073 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -11,6 +11,9 @@ * src/plugins/TestcaseGenerator.py: Handle DateError exception * src/plugins/ImportGeneWeb.py: Distinguish unknown people + + * src/DateDisplay.py: Allow B.C.E. in years to be localized + * src/dates/Date_de.py: Some more translations including B.C.E. 2005-05-12 Don Allingham * src/GrampsBSDDB.py: force database sync on transaction commit diff --git a/gramps2/src/DateDisplay.py b/gramps2/src/DateDisplay.py index cee4aa15e..b8ebf5ea5 100644 --- a/gramps2/src/DateDisplay.py +++ b/gramps2/src/DateDisplay.py @@ -111,6 +111,8 @@ class DateDisplay: _mod_str = ("","before ","after ","about ","","","") _qual_str = ("","estimated ","calculated ") + + _bce_str = "%s B.C.E." def __init__(self,format=None): self.display_cal = [ @@ -172,15 +174,19 @@ class DateDisplay: return "%s%s%s%s" % (qual_str,self._mod_str[mod],text,self.calendar[cal]) def _slash_year(self,val,slash): - bc = "" if val < 0: val = - val - bc = " B.C.E" + # self._bce_str is a localizes string that prints B.C.E. at the apropriate place + format_string = self._bce_str + else: + format_string = "%s" if slash: - return "%d/%d%s" % (val,(val%10)+1,bc) + year = "%d/%d" % (val,(val%10)+1) else: - return "%d%s" % (val,bc) + year = "%d" % (val) + + return format_string % year def display_iso(self,date_val): # YYYY-MM-DD (ISO) diff --git a/gramps2/src/dates/Date_de.py b/gramps2/src/dates/Date_de.py index 47b3acbb4..e47ed47cc 100644 --- a/gramps2/src/dates/Date_de.py +++ b/gramps2/src/dates/Date_de.py @@ -83,23 +83,33 @@ class DateParserDE(DateParser): u'um' : Date.MOD_ABOUT, u'etwa' : Date.MOD_ABOUT, u'circa' : Date.MOD_ABOUT, + u'ca.' : Date.MOD_ABOUT, } calendar_to_int = { u'Gregorianisch' : Date.CAL_GREGORIAN, + u'Greg.' : Date.CAL_GREGORIAN, u'Julianisch' : Date.CAL_JULIAN, + u'Jul.' : Date.CAL_JULIAN, u'Hebräisch' : Date.CAL_HEBREW, + u'Hebr.' : Date.CAL_HEBREW, u'Islamisch' : Date.CAL_ISLAMIC, - u'Französischer Republikaner': Date.CAL_FRENCH, + u'Isl.' : Date.CAL_ISLAMIC, + u'Französisch Republikanisch': Date.CAL_FRENCH, + u'Franz.' : Date.CAL_FRENCH, u'Persisch' : Date.CAL_PERSIAN, } quality_to_int = { u'geschätzt' : Date.QUAL_ESTIMATED, + u'gesch.' : Date.QUAL_ESTIMATED, u'errechnet' : Date.QUAL_CALCULATED, u'berechnet' : Date.QUAL_CALCULATED, + u'ber.' : Date.QUAL_CALCULATED, } + bce = DateParser.bce + ["vor (unserer|der) Zeit(rechnung)?", "v\. (u|d)\. Z\.", "vor Christus", "vor Christi Geburt", "v\. Chr\."] + def init_strings(self): DateParser.init_strings(self) self._span = re.compile("(von|vom)\s+(.+)\s+(bis)\s+(.+)",re.IGNORECASE) @@ -121,6 +131,7 @@ class DateDisplayDE(DateDisplay): _qual_str = ("",u"geschätzt ",u"errechnet ") + _bce_str = "%s v. u. Z." formats = ( "JJJJ-MM-DD (ISO)", "Numerisch", "Monat Tag Jahr",