diff --git a/src/DateEdit.py b/src/DateEdit.py index 71514635c..dac59b27b 100644 --- a/src/DateEdit.py +++ b/src/DateEdit.py @@ -90,8 +90,8 @@ QUAL_TEXT = ( (Date.QUAL_CALCULATED, _('Calculated')) ) CAL_TO_MONTHS_NAMES = { - Date.CAL_GREGORIAN : DateHandler.displayer.MONS, - Date.CAL_JULIAN : DateHandler.displayer.MONS, + Date.CAL_GREGORIAN : DateHandler.displayer.short_months, + Date.CAL_JULIAN : DateHandler.displayer.short_months, Date.CAL_HEBREW : DateHandler.displayer.hebrew, Date.CAL_FRENCH : DateHandler.displayer.french, Date.CAL_PERSIAN : DateHandler.displayer.persian, diff --git a/src/DateHandler/_DateDisplay.py b/src/DateHandler/_DateDisplay.py index 3880e67e6..9153abf23 100644 --- a/src/DateHandler/_DateDisplay.py +++ b/src/DateHandler/_DateDisplay.py @@ -47,9 +47,15 @@ import GrampsLocale # #------------------------------------------------------------------------- class DateDisplay(object): - - _months = GrampsLocale.long_months - MONS = GrampsLocale.short_months + """ + Base date display class. + """ + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) _tformat = GrampsLocale.tformat @@ -120,7 +126,6 @@ class DateDisplay(object): self._display_islamic, self._display_swedish] - self.verify_format(format) if format is None: self.format = 0 else: @@ -129,19 +134,6 @@ class DateDisplay(object): def set_format(self, format): self.format = format - def verify_format(self, format): - pass - - def quote_display(self, date): - """ - Similar to the display task, except that if the value is a text only - value, it is enclosed in quotes. - """ - if date.get_modifier() == Date.MOD_TEXTONLY: - return '"%s"' % self.display(date) - else: - return self.display(date) - def format_extras(self, cal, newyear): """ Formats the extra items (calendar, newyear) for a date. @@ -243,9 +235,9 @@ class DateDisplay(object): if date_val[1] == 0: value = year else: - value = "%s %s" % (self._months[date_val[1]], year) + value = "%s %s" % (self.long_months[date_val[1]], year) else: - value = "%s %d, %s" % (self._months[date_val[1]], + value = "%s %d, %s" % (self.long_months[date_val[1]], date_val[0], year) elif self.format == 3: # MON Day, Year @@ -253,9 +245,9 @@ class DateDisplay(object): if date_val[1] == 0: value = year else: - value = "%s %s" % (self.MONS[date_val[1]], year) + value = "%s %s" % (self.short_months[date_val[1]], year) else: - value = "%s %d, %s" % (self.MONS[date_val[1]], + value = "%s %d, %s" % (self.short_months[date_val[1]], date_val[0], year) elif self.format == 4: # Day Month Year @@ -263,19 +255,20 @@ class DateDisplay(object): if date_val[1] == 0: value = year else: - value = "%s %s" % (self._months[date_val[1]], year) + value = "%s %s" % (self.long_months[date_val[1]], year) else: - value = "%d %s %s" % (date_val[0], self._months[date_val[1]], - year) + value = "%d %s %s" % (date_val[0], + self.long_months[date_val[1]], year) else: # Day MON Year if date_val[0] == 0: if date_val[1] == 0: value = year else: - value = "%s %s" % (self.MONS[date_val[1]], year) + value = "%s %s" % (self.short_months[date_val[1]], year) else: - value = "%d %s %s" % (date_val[0], self.MONS[date_val[1]], year) + value = "%d %s %s" % (date_val[0], + self.short_months[date_val[1]], year) if date_val[2] < 0: return self._bce_str % value else: @@ -296,7 +289,8 @@ class DateDisplay(object): else: value = u"%s %d" % (month_list[date_val[1]], year) else: - value = u"%s %d, %s" % (month_list[date_val[1]], date_val[0], year) + value = u"%s %d, %s" % (month_list[date_val[1]], date_val[0], + year) if date_val[2] < 0: return self._bce_str % value else: @@ -313,7 +307,8 @@ class DateDisplay(object): else: value = u"%s %d" % (self.french[date_val[1]], year) else: - value = u"%d %s %s" % (date_val[0], self.french[date_val[1]], year) + value = u"%d %s %s" % (date_val[0], self.french[date_val[1]], + year) if date_val[2] < 0: return self._bce_str % value else: diff --git a/src/DateHandler/_DateHandler.py b/src/DateHandler/_DateHandler.py index 06dfc101d..37c072f24 100644 --- a/src/DateHandler/_DateHandler.py +++ b/src/DateHandler/_DateHandler.py @@ -30,6 +30,7 @@ Class handling language-specific selection for date parser and displayer. # #------------------------------------------------------------------------- import locale +import os #------------------------------------------------------------------------- # @@ -53,6 +54,10 @@ from _DateDisplay import DateDisplay, DateDisplayEn # #------------------------------------------------------------------------- LANG = locale.getlocale(locale.LC_TIME)[0] +if not LANG: + if "LANG" in os.environ: + LANG = os.environ["LANG"] + if LANG: LANG_SHORT = LANG.split('_')[0] else: diff --git a/src/DateHandler/_DateUtils.py b/src/DateHandler/_DateUtils.py index 8c473833d..7b86932bf 100644 --- a/src/DateHandler/_DateUtils.py +++ b/src/DateHandler/_DateUtils.py @@ -80,17 +80,3 @@ def get_date(date_base) : def get_date_valid(date_base): date_obj = date_base.get_date_object() return date_obj.get_valid() - -def get_quote_date(date_base): - """ - Return a string representation of the date of the DateBase instance. - - This representation is based off the default date display format - determined by the locale's DateDisplay instance. The date is - enclosed in quotes if the Date is not a valid date. - - @return: Returns a string representing the DateBase date - @rtype: str - - """ - return displayer.quote_display(date_base.get_date_object()) diff --git a/src/DateHandler/_Date_ca.py b/src/DateHandler/_Date_ca.py index 4479420a2..82ffa3754 100644 --- a/src/DateHandler/_Date_ca.py +++ b/src/DateHandler/_Date_ca.py @@ -113,6 +113,16 @@ class DateParserCA(DateParser): # #------------------------------------------------------------------------- class DateDisplayCA(DateDisplay): + """ + Catalan language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) calendar = ( "", u" (Julià)", u" (Hebreu)", diff --git a/src/DateHandler/_Date_cs.py b/src/DateHandler/_Date_cs.py index 846afca0d..c034b42f0 100644 --- a/src/DateHandler/_Date_cs.py +++ b/src/DateHandler/_Date_cs.py @@ -99,6 +99,16 @@ class DateParserCZ(DateParser): # #------------------------------------------------------------------------- class DateDisplayCZ(DateDisplay): + """ + Czech language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) calendar = ( "", u" (juliánský)", u" (hebrejský)", diff --git a/src/DateHandler/_Date_de.py b/src/DateHandler/_Date_de.py index 6ace5c9e9..76172731a 100644 --- a/src/DateHandler/_Date_de.py +++ b/src/DateHandler/_Date_de.py @@ -44,13 +44,14 @@ from _DateHandler import register_datehandler #------------------------------------------------------------------------- # -# French parser +# German parser # #------------------------------------------------------------------------- class DateParserDE(DateParser): month_to_int = DateParser.month_to_int - # Always add german and austrian name variants no matter what the current locale is + # Always add german and austrian name variants no matter what the current + # locale is month_to_int[u"januar"] = 1 month_to_int[u"jan"] = 1 month_to_int[u"jänner"] = 1 @@ -129,10 +130,20 @@ class DateParserDE(DateParser): #------------------------------------------------------------------------- # -# French display +# German display # #------------------------------------------------------------------------- class DateDisplayDE(DateDisplay): + """ + German language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) calendar = ( "", u" (julianisch)", u" (hebräisch)", @@ -171,36 +182,40 @@ class DateDisplayDE(DateDisplay): if date_val[1] == 0: value = year else: - value = "%s %s" % (self._months[date_val[1]], year) + value = "%s %s" % (self.long_months[date_val[1]], year) else: - value = "%s %d, %s" % (self._months[date_val[1]], date_val[0], year) + value = "%s %d, %s" % (self.long_months[date_val[1]], + date_val[0], year) elif self.format == 3: # MON Day, Year if date_val[0] == 0: if date_val[1] == 0: value = year else: - value = "%s %s" % (self.MONS[date_val[1]], year) + value = "%s %s" % (self.short_months[date_val[1]], year) else: - value = "%s %d, %s" % (self.MONS[date_val[1]], date_val[0], year) + value = "%s %d, %s" % (self.short_months[date_val[1]], + date_val[0], year) elif self.format == 4: # Day Month Year if date_val[0] == 0: if date_val[1] == 0: value = year else: - value = "%s %s" % (self._months[date_val[1]], year) + value = "%s %s" % (self.long_months[date_val[1]], year) else: - value = "%d. %s %s" % (date_val[0], self._months[date_val[1]], year) + value = "%d. %s %s" % (date_val[0], + self.long_months[date_val[1]], year) else: # Day MON Year if date_val[0] == 0: if date_val[1] == 0: value = year else: - value = "%s %s" % (self.MONS[date_val[1]], year) + value = "%s %s" % (self.short_months[date_val[1]], year) else: - value = "%d. %s %s" % (date_val[0], self.MONS[date_val[1]], year) + value = "%d. %s %s" % (date_val[0], + self.short_months[date_val[1]], year) if date_val[2] < 0: return self._bce_str % value else: diff --git a/src/DateHandler/_Date_es.py b/src/DateHandler/_Date_es.py index 1608b9043..0ca84c283 100644 --- a/src/DateHandler/_Date_es.py +++ b/src/DateHandler/_Date_es.py @@ -114,6 +114,16 @@ class DateParserES(DateParser): # #------------------------------------------------------------------------- class DateDisplayES(DateDisplay): + """ + Spanish language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"enero", u"febrero", u"marzo", u"abril", u"mayo", + u"junio", u"julio", u"agosto", u"septiembre", u"octubre", + u"noviembre", u"diciembre" ) + + short_months = ( u"enero", u"feb.", u"marzo", u"abr.", u"mayo", u"jun.", + u"jul.", u"agosto", u"set.", u"oct.", u"nov.", u"dic" ) calendar = ( "", u" (Juliano)", u" (Hebreo)", diff --git a/src/DateHandler/_Date_fi.py b/src/DateHandler/_Date_fi.py index 783b45b38..906787cab 100644 --- a/src/DateHandler/_Date_fi.py +++ b/src/DateHandler/_Date_fi.py @@ -113,7 +113,17 @@ class DateParserFI(DateParser): # #------------------------------------------------------------------------- class DateDisplayFI(DateDisplay): - + """ + Finnish language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) + calendar = ("", u"(juliaaninen)", u"(heprealainen)", diff --git a/src/DateHandler/_Date_fr.py b/src/DateHandler/_Date_fr.py index 98e7d0641..1385b508b 100644 --- a/src/DateHandler/_Date_fr.py +++ b/src/DateHandler/_Date_fr.py @@ -50,8 +50,6 @@ from _DateHandler import register_datehandler # French parser # #------------------------------------------------------------------------- - - class DateParserFR(DateParser): """ Convert a text string into a Date object. If the date cannot be @@ -238,12 +236,17 @@ class DateParserFR(DateParser): # French display # #------------------------------------------------------------------------- - - class DateDisplayFR(DateDisplay): """ French language date display class. """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) calendar = ("", u" (Julien)", u" (Hébreu)", u" (Révolutionnaire)", u" (Perse)", u" (Islamique)", u" (Suédois)") @@ -288,10 +291,10 @@ class DateDisplayFR(DateDisplay): if date_val[1] == 0: value = year else: - value = "%s %s" % ((self._months)[date_val[1]], year) + value = "%s %s" % (self.long_months[date_val[1]], year) else: - value = "%s %d, %s" % ((self._months)[date_val[1]], - date_val[0], year) + value = "%s %d, %s" % (self.long_months[date_val[1]], + date_val[0], year) elif self.format == 3: # MON Day, Year @@ -300,10 +303,10 @@ class DateDisplayFR(DateDisplay): if date_val[1] == 0: value = year else: - value = "%s %s" % ((self.MONS)[date_val[1]], year) + value = "%s %s" % (self.short_months[date_val[1]], year) else: - value = "%s %d, %s" % ((self.MONS)[date_val[1]], - date_val[0], year) + value = "%s %d, %s" % (self.short_months[date_val[1]], + date_val[0], year) elif self.format == 4: # Day. Month Year @@ -312,13 +315,15 @@ class DateDisplayFR(DateDisplay): if date_val[1] == 0: value = year else: - value = "%s %s" % ((self._months)[date_val[1]], year) + value = "%s %s" % (self.long_months[date_val[1]], year) else: # base_display : - # value = "%d %s %s" % (date_val[0], self._months[date_val[1]], year) + # value = "%d %s %s" % (date_val[0], + # self.long_months[date_val[1]], year) - value = "%d. %s %s" % (date_val[0], (self._months)[date_val[1]], + value = "%d. %s %s" % (date_val[0], + self.long_months[date_val[1]], year) elif self.format == 5: @@ -328,14 +333,15 @@ class DateDisplayFR(DateDisplay): if date_val[1] == 0: value = year else: - value = "%s %s" % ((self.MONS)[date_val[1]], year) + value = "%s %s" % (self.short_months[date_val[1]], year) else: # base_display : - # value = "%d %s %s" % (date_val[0], self.MONS[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.MONS)[date_val[1]], - year) + value = "%d.%s %s" % (date_val[0], + self.short_months[date_val[1]], year) elif self.format == 6: @@ -345,11 +351,11 @@ class DateDisplayFR(DateDisplay): if date_val[1] == 0: value = year else: - value = "%s %s" % ((self._months)[date_val[1]], year) + value = "%s %s" % (self.long_months[date_val[1]], year) else: - value = "%d %s %s" % (date_val[0], (self._months)[date_val[1]], - year) + value = "%d %s %s" % (date_val[0], + self.long_months[date_val[1]], year) else: # Day MON Year @@ -358,11 +364,11 @@ class DateDisplayFR(DateDisplay): if date_val[1] == 0: value = year else: - value = "%s %s" % ((self.MONS)[date_val[1]], year) + value = "%s %s" % (self.short_months[date_val[1]], year) else: - value = "%d %s %s" % (date_val[0], (self.MONS)[date_val[1]], - year) + value = "%d %s %s" % (date_val[0], + self.short_months[date_val[1]], year) if date_val[2] < 0: return self._bce_str % value diff --git a/src/DateHandler/_Date_hr.py b/src/DateHandler/_Date_hr.py index f237ea6f7..e13ec7914 100644 --- a/src/DateHandler/_Date_hr.py +++ b/src/DateHandler/_Date_hr.py @@ -201,8 +201,16 @@ class DateParserHR(DateParser): #------------------------------------------------------------------------- class DateDisplayHR(DateDisplay): """ - Croatian date display class + Croatian language date display class. """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) + calendar = ( "", u" (julijanski)", u" (hebrejski)", u" (francuski republikanski)", u" (perzijski)", u" (islamski)", diff --git a/src/DateHandler/_Date_it.py b/src/DateHandler/_Date_it.py index 477679d97..08f972012 100644 --- a/src/DateHandler/_Date_it.py +++ b/src/DateHandler/_Date_it.py @@ -109,7 +109,17 @@ class DateParserIT(DateParser): # #------------------------------------------------------------------------- class DateDisplayIT(DateDisplay): - + """ + Italian language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) + calendar = ( "", u" (Giuliano)", u" (Ebraico)", u" (Rivoluzionario)", u" (Persiano)", u" (Islamico)", diff --git a/src/DateHandler/_Date_lt.py b/src/DateHandler/_Date_lt.py index 6feb8f9b7..343239b67 100644 --- a/src/DateHandler/_Date_lt.py +++ b/src/DateHandler/_Date_lt.py @@ -98,7 +98,17 @@ class DateParserLT(DateParser): # #------------------------------------------------------------------------- class DateDisplayLT(DateDisplay): - + """ + Lithuanian language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) + calendar = ( u"", u" (julijaus)", u" (hebrajų)", diff --git a/src/DateHandler/_Date_nb.py b/src/DateHandler/_Date_nb.py index bdfcb14b2..64c3cb2b0 100644 --- a/src/DateHandler/_Date_nb.py +++ b/src/DateHandler/_Date_nb.py @@ -105,6 +105,13 @@ class DateDisplayNb(DateDisplay): """ Norwegian language date display class. """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) formats = ( u"ÅÅÅÅ-MM-DD (ISO)", diff --git a/src/DateHandler/_Date_nl.py b/src/DateHandler/_Date_nl.py index 1242b0fdf..be5762d6b 100644 --- a/src/DateHandler/_Date_nl.py +++ b/src/DateHandler/_Date_nl.py @@ -135,7 +135,17 @@ class DateParserNL(DateParser): # #------------------------------------------------------------------------- class DateDisplayNL(DateDisplay): - + """ + Dutch language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) + calendar = ( "", u" (juliaans)", u" (hebreeuws)", u" (franse republiek)", u" (persisch)", u" (islamitisch)", @@ -174,36 +184,40 @@ class DateDisplayNL(DateDisplay): if date_val[1] == 0: value = year else: - value = "%s %s" % (self._months[date_val[1]], year) + value = "%s %s" % (self.long_months[date_val[1]], year) else: - value = "%s %d, %s" % (self._months[date_val[1]], date_val[0], year) + value = "%s %d, %s" % (self.long_months[date_val[1]], + date_val[0], year) elif self.format == 3: # Mnd Day, Year if date_val[0] == 0: if date_val[1] == 0: value = year else: - value = "%s %s" % (self.MONS[date_val[1]], year) + value = "%s %s" % (self.short_months[date_val[1]], year) else: - value = "%s %d, %s" % (self.MONS[date_val[1]], date_val[0], year) + value = "%s %d, %s" % (self.short_months[date_val[1]], + date_val[0], year) elif self.format == 4: # Day Month Year if date_val[0] == 0: if date_val[1] == 0: value = year else: - value = "%s %s" % (self._months[date_val[1]], year) + value = "%s %s" % (self.long_months[date_val[1]], year) else: - value = "%d %s %s" % (date_val[0], self._months[date_val[1]], year) + value = "%d %s %s" % (date_val[0], + self.long_months[date_val[1]], year) else: # Day Mnd Year if date_val[0] == 0: if date_val[1] == 0: value = year else: - value = "%s %s" % (self.MONS[date_val[1]], year) + value = "%s %s" % (self.short_months[date_val[1]], year) else: - value = "%d %s %s" % (date_val[0], self.MONS[date_val[1]], year) + value = "%d %s %s" % (date_val[0], + self.short_months[date_val[1]], year) if date_val[2] < 0: return self._bce_str % value else: diff --git a/src/DateHandler/_Date_pl.py b/src/DateHandler/_Date_pl.py index 01d69cff0..c2a9ae36e 100644 --- a/src/DateHandler/_Date_pl.py +++ b/src/DateHandler/_Date_pl.py @@ -136,16 +136,26 @@ class DateParserPL(DateParser): # #------------------------------------------------------------------------- class DateDisplayPL(DateDisplay): - + """ + Polish language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) + calendar = ( "", u" (juliański)", u" (hebrajski)", u" (francuski republikański)", u" (perski)", u" (islamski)", u" (swedish)" ) - _mod_str = ("",u"przed ",u"po ",u"ok. ","","","") + _mod_str = ("", u"przed ", u"po ", u"ok. ", "", "", "") - _qual_str = ("",u"szacowany ",u"obliczony ") + _qual_str = ("", u"szacowany ", u"obliczony ") _bce_str = "%s p.n.e." @@ -170,8 +180,8 @@ class DateDisplayPL(DateDisplay): "XII" ) - def _display_gregorian(self,date_val): - year = self._slash_year(date_val[2],date_val[3]) + def _display_gregorian(self, date_val): + year = self._slash_year(date_val[2], date_val[3]) if self.format == 0: return self.display_iso(date_val) elif self.format == 1: @@ -181,51 +191,54 @@ class DateDisplayPL(DateDisplay): if date_val[0] == date_val[1] == 0: value = str(date_val[2]) else: - value = self._tformat.replace('%m',str(date_val[0])) - value = value.replace('%d',str(date_val[1])) - value = value.replace('%y',str(date_val[2])) + value = self._tformat.replace('%m', str(date_val[0])) + value = value.replace('%d', str(date_val[1])) + value = value.replace('%y', str(date_val[2])) elif self.format == 2: # Month Day, Year if date_val[0] == 0: if date_val[1] == 0: value = year else: - value = "%s %s" % (self._months[date_val[1]],year) + value = "%s %s" % (self.long_months[date_val[1]], year) else: - value = "%s %d, %s" % (self._months[date_val[1]],date_val[0],year) + value = "%s %d, %s" % (self.long_months[date_val[1]], + date_val[0], year) elif self.format == 3: # Day. Month. Year if date_val[0] == 0: if date_val[1] == 0: value = year else: - value = "%d.%s" % (date_val[1],year) + value = "%d.%s" % (date_val[1], year) else: - value = "%d.%d.%s" % (date_val[0],date_val[1],year) + value = "%d.%d.%s" % (date_val[0], date_val[1], year) elif self.format == 4: # Day Month Year if date_val[0] == 0: if date_val[1] == 0: value = year else: - value = "%s %s" % (self._months[date_val[1]],year) + value = "%s %s" % (self.long_months[date_val[1]], year) else: - value = "%d %s %s" % (date_val[0],self._months[date_val[1]],year) + value = "%d %s %s" % (date_val[0], + self.long_months[date_val[1]], year) else: # Day RomanMon Year if date_val[0] == 0: if date_val[1] == 0: value = year else: - value = "%s %s" % (self.roman_months[date_val[1]],year) + value = "%s %s" % (self.roman_months[date_val[1]], year) else: - value = "%d %s %s" % (date_val[0],self.roman_months[date_val[1]],year) + value = "%d %s %s" % (date_val[0], + self.roman_months[date_val[1]], year) if date_val[2] < 0: return self._bce_str % value else: return value - def display(self,date): + def display(self, date): """ Return a text string representing the date. """ @@ -243,14 +256,17 @@ class DateDisplayPL(DateDisplay): elif mod == Date.MOD_SPAN: d1 = self.display_cal[cal](start) d2 = self.display_cal[cal](date.get_stop_date()) - return "%s%s %s %s %s%s" % (qual_str,u'od',d1,u'do',d2,self.calendar[cal]) + return "%s%s %s %s %s%s" % (qual_str, u'od', d1, u'do', d2, + self.calendar[cal]) elif mod == Date.MOD_RANGE: d1 = self.display_cal[cal](start) d2 = self.display_cal[cal](date.get_stop_date()) - return "%s%s %s %s %s%s" % (qual_str,u'między',d1,u'a',d2,self.calendar[cal]) + return "%s%s %s %s %s%s" % (qual_str, u'między', d1, u'a', d2, + self.calendar[cal]) else: text = self.display_cal[date.get_calendar()](start) - return "%s%s%s%s" % (qual_str,self._mod_str[mod],text,self.calendar[cal]) + return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, + self.calendar[cal]) #------------------------------------------------------------------------- # diff --git a/src/DateHandler/_Date_pt.py b/src/DateHandler/_Date_pt.py index 38683f58e..489a62317 100644 --- a/src/DateHandler/_Date_pt.py +++ b/src/DateHandler/_Date_pt.py @@ -113,7 +113,17 @@ class DateParserPT(DateParser): # #------------------------------------------------------------------------- class DateDisplayPT(DateDisplay): - + """ + Portuguese language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) + calendar = ( "", u" (Juliano)", u" (Hebreu)", u" (Revolucionário)", u" (Persa)", u" (Islâmico)", diff --git a/src/DateHandler/_Date_ru.py b/src/DateHandler/_Date_ru.py index 4f3e7b6bc..f469e93c9 100644 --- a/src/DateHandler/_Date_ru.py +++ b/src/DateHandler/_Date_ru.py @@ -184,7 +184,17 @@ class DateParserRU(DateParser): # #------------------------------------------------------------------------- class DateDisplayRU(DateDisplay): - + """ + Russian language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) + calendar = ( u"", u" (юлианский)", diff --git a/src/DateHandler/_Date_sk.py b/src/DateHandler/_Date_sk.py index 3a58b773d..54ef2bd19 100644 --- a/src/DateHandler/_Date_sk.py +++ b/src/DateHandler/_Date_sk.py @@ -101,7 +101,17 @@ class DateParserSK(DateParser): # #------------------------------------------------------------------------- class DateDisplaySK(DateDisplay): - + """ + Slovak language date display class. + """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) + calendar = ( "", u" (juliánský)", u" (hebrejský)", u" (republikánsky)", u" (perzský)", u" (islamský)", diff --git a/src/DateHandler/_Date_sr.py b/src/DateHandler/_Date_sr.py index 0a82ca74d..86b92df9f 100644 --- a/src/DateHandler/_Date_sr.py +++ b/src/DateHandler/_Date_sr.py @@ -234,6 +234,14 @@ class DateDisplaySR_latin(DateDisplay): """ Serbian (latin) date display class """ + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) + calendar = ( "", u" (julijanski)", u" (hebrejski)", u" (francuski republikanski)", u" (persijski)", u" (islamski)", diff --git a/src/DateHandler/_Date_sv.py b/src/DateHandler/_Date_sv.py index 723b766c9..d156cb6cf 100644 --- a/src/DateHandler/_Date_sv.py +++ b/src/DateHandler/_Date_sv.py @@ -111,7 +111,14 @@ class DateDisplaySv(DateDisplay): """ Swedish language date display class. """ - + # TODO: Translate these month strings: + long_months = ( u"January", u"February", u"March", u"April", u"May", + u"June", u"July", u"August", u"September", u"October", + u"November", u"December" ) + + short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul", + u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" ) + formats = ( u"YYYY-MM-DD (ISO)", u"Numerisk",