Make short and long month strings constants in the DateDisplay class instead of using the localized month strings detected by GrampsLocale. This will allow DateDisplayers to work for languages other than the current locale - will be useful for user selectable report translations.

svn: r13436
This commit is contained in:
Brian Matherly 2009-10-28 03:25:57 +00:00
parent d920e3479a
commit 758d69ec88
21 changed files with 272 additions and 115 deletions

View File

@ -90,8 +90,8 @@ QUAL_TEXT = (
(Date.QUAL_CALCULATED, _('Calculated')) ) (Date.QUAL_CALCULATED, _('Calculated')) )
CAL_TO_MONTHS_NAMES = { CAL_TO_MONTHS_NAMES = {
Date.CAL_GREGORIAN : DateHandler.displayer.MONS, Date.CAL_GREGORIAN : DateHandler.displayer.short_months,
Date.CAL_JULIAN : DateHandler.displayer.MONS, Date.CAL_JULIAN : DateHandler.displayer.short_months,
Date.CAL_HEBREW : DateHandler.displayer.hebrew, Date.CAL_HEBREW : DateHandler.displayer.hebrew,
Date.CAL_FRENCH : DateHandler.displayer.french, Date.CAL_FRENCH : DateHandler.displayer.french,
Date.CAL_PERSIAN : DateHandler.displayer.persian, Date.CAL_PERSIAN : DateHandler.displayer.persian,

View File

@ -47,9 +47,15 @@ import GrampsLocale
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplay(object): class DateDisplay(object):
"""
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" )
_months = GrampsLocale.long_months short_months = ( u"Jan", u"Feb", u"Mar", u"Apr", u"May", u"Jun", u"Jul",
MONS = GrampsLocale.short_months u"Aug", u"Sep", u"Oct", u"Nov", u"Dec" )
_tformat = GrampsLocale.tformat _tformat = GrampsLocale.tformat
@ -120,7 +126,6 @@ class DateDisplay(object):
self._display_islamic, self._display_islamic,
self._display_swedish] self._display_swedish]
self.verify_format(format)
if format is None: if format is None:
self.format = 0 self.format = 0
else: else:
@ -129,19 +134,6 @@ class DateDisplay(object):
def set_format(self, format): def set_format(self, format):
self.format = 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): def format_extras(self, cal, newyear):
""" """
Formats the extra items (calendar, newyear) for a date. Formats the extra items (calendar, newyear) for a date.
@ -243,9 +235,9 @@ class DateDisplay(object):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self._months[date_val[1]], year) value = "%s %s" % (self.long_months[date_val[1]], year)
else: else:
value = "%s %d, %s" % (self._months[date_val[1]], value = "%s %d, %s" % (self.long_months[date_val[1]],
date_val[0], year) date_val[0], year)
elif self.format == 3: elif self.format == 3:
# MON Day, Year # MON Day, Year
@ -253,9 +245,9 @@ class DateDisplay(object):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self.MONS[date_val[1]], year) value = "%s %s" % (self.short_months[date_val[1]], year)
else: else:
value = "%s %d, %s" % (self.MONS[date_val[1]], value = "%s %d, %s" % (self.short_months[date_val[1]],
date_val[0], year) date_val[0], year)
elif self.format == 4: elif self.format == 4:
# Day Month Year # Day Month Year
@ -263,19 +255,20 @@ class DateDisplay(object):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self._months[date_val[1]], year) value = "%s %s" % (self.long_months[date_val[1]], year)
else: else:
value = "%d %s %s" % (date_val[0], self._months[date_val[1]], value = "%d %s %s" % (date_val[0],
year) self.long_months[date_val[1]], year)
else: else:
# Day MON Year # Day MON Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self.MONS[date_val[1]], year) value = "%s %s" % (self.short_months[date_val[1]], year)
else: 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: if date_val[2] < 0:
return self._bce_str % value return self._bce_str % value
else: else:
@ -296,7 +289,8 @@ class DateDisplay(object):
else: else:
value = u"%s %d" % (month_list[date_val[1]], year) value = u"%s %d" % (month_list[date_val[1]], year)
else: 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: if date_val[2] < 0:
return self._bce_str % value return self._bce_str % value
else: else:
@ -313,7 +307,8 @@ class DateDisplay(object):
else: else:
value = u"%s %d" % (self.french[date_val[1]], year) value = u"%s %d" % (self.french[date_val[1]], year)
else: 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: if date_val[2] < 0:
return self._bce_str % value return self._bce_str % value
else: else:

View File

@ -30,6 +30,7 @@ Class handling language-specific selection for date parser and displayer.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import locale import locale
import os
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -53,6 +54,10 @@ from _DateDisplay import DateDisplay, DateDisplayEn
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
LANG = locale.getlocale(locale.LC_TIME)[0] LANG = locale.getlocale(locale.LC_TIME)[0]
if not LANG:
if "LANG" in os.environ:
LANG = os.environ["LANG"]
if LANG: if LANG:
LANG_SHORT = LANG.split('_')[0] LANG_SHORT = LANG.split('_')[0]
else: else:

View File

@ -80,17 +80,3 @@ def get_date(date_base) :
def get_date_valid(date_base): def get_date_valid(date_base):
date_obj = date_base.get_date_object() date_obj = date_base.get_date_object()
return date_obj.get_valid() 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())

View File

@ -113,6 +113,16 @@ class DateParserCA(DateParser):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayCA(DateDisplay): 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 = ( calendar = (
"", u" (Julià)", u" (Hebreu)", "", u" (Julià)", u" (Hebreu)",

View File

@ -99,6 +99,16 @@ class DateParserCZ(DateParser):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayCZ(DateDisplay): 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 = ( calendar = (
"", u" (juliánský)", u" (hebrejský)", "", u" (juliánský)", u" (hebrejský)",

View File

@ -44,13 +44,14 @@ from _DateHandler import register_datehandler
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# French parser # German parser
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateParserDE(DateParser): class DateParserDE(DateParser):
month_to_int = DateParser.month_to_int 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"januar"] = 1
month_to_int[u"jan"] = 1 month_to_int[u"jan"] = 1
month_to_int[u"jänner"] = 1 month_to_int[u"jänner"] = 1
@ -129,10 +130,20 @@ class DateParserDE(DateParser):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# French display # German display
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayDE(DateDisplay): 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 = ( calendar = (
"", u" (julianisch)", u" (hebräisch)", "", u" (julianisch)", u" (hebräisch)",
@ -171,36 +182,40 @@ class DateDisplayDE(DateDisplay):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self._months[date_val[1]], year) value = "%s %s" % (self.long_months[date_val[1]], year)
else: 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: elif self.format == 3:
# MON Day, Year # MON Day, Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self.MONS[date_val[1]], year) value = "%s %s" % (self.short_months[date_val[1]], year)
else: 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: elif self.format == 4:
# Day Month Year # Day Month Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self._months[date_val[1]], year) value = "%s %s" % (self.long_months[date_val[1]], year)
else: 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: else:
# Day MON Year # Day MON Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self.MONS[date_val[1]], year) value = "%s %s" % (self.short_months[date_val[1]], year)
else: 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: if date_val[2] < 0:
return self._bce_str % value return self._bce_str % value
else: else:

View File

@ -114,6 +114,16 @@ class DateParserES(DateParser):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayES(DateDisplay): 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 = ( calendar = (
"", u" (Juliano)", u" (Hebreo)", "", u" (Juliano)", u" (Hebreo)",

View File

@ -113,6 +113,16 @@ class DateParserFI(DateParser):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayFI(DateDisplay): 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 = ("", calendar = ("",
u"(juliaaninen)", u"(juliaaninen)",

View File

@ -50,8 +50,6 @@ from _DateHandler import register_datehandler
# French parser # French parser
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateParserFR(DateParser): class DateParserFR(DateParser):
""" """
Convert a text string into a Date object. If the date cannot be Convert a text string into a Date object. If the date cannot be
@ -238,12 +236,17 @@ class DateParserFR(DateParser):
# French display # French display
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayFR(DateDisplay): class DateDisplayFR(DateDisplay):
""" """
French language date display class. 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)", calendar = ("", u" (Julien)", u" (Hébreu)", u" (Révolutionnaire)",
u" (Perse)", u" (Islamique)", u" (Suédois)") u" (Perse)", u" (Islamique)", u" (Suédois)")
@ -288,9 +291,9 @@ class DateDisplayFR(DateDisplay):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % ((self._months)[date_val[1]], year) value = "%s %s" % (self.long_months[date_val[1]], year)
else: else:
value = "%s %d, %s" % ((self._months)[date_val[1]], value = "%s %d, %s" % (self.long_months[date_val[1]],
date_val[0], year) date_val[0], year)
elif self.format == 3: elif self.format == 3:
@ -300,9 +303,9 @@ class DateDisplayFR(DateDisplay):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % ((self.MONS)[date_val[1]], year) value = "%s %s" % (self.short_months[date_val[1]], year)
else: else:
value = "%s %d, %s" % ((self.MONS)[date_val[1]], value = "%s %d, %s" % (self.short_months[date_val[1]],
date_val[0], year) date_val[0], year)
elif self.format == 4: elif self.format == 4:
@ -312,13 +315,15 @@ class DateDisplayFR(DateDisplay):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % ((self._months)[date_val[1]], year) value = "%s %s" % (self.long_months[date_val[1]], year)
else: else:
# base_display : # 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) year)
elif self.format == 5: elif self.format == 5:
@ -328,14 +333,15 @@ class DateDisplayFR(DateDisplay):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % ((self.MONS)[date_val[1]], year) value = "%s %s" % (self.short_months[date_val[1]], year)
else: else:
# base_display : # 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]], value = "%d.%s %s" % (date_val[0],
year) self.short_months[date_val[1]], year)
elif self.format == 6: elif self.format == 6:
@ -345,11 +351,11 @@ class DateDisplayFR(DateDisplay):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % ((self._months)[date_val[1]], year) value = "%s %s" % (self.long_months[date_val[1]], year)
else: else:
value = "%d %s %s" % (date_val[0], (self._months)[date_val[1]], value = "%d %s %s" % (date_val[0],
year) self.long_months[date_val[1]], year)
else: else:
# Day MON Year # Day MON Year
@ -358,11 +364,11 @@ class DateDisplayFR(DateDisplay):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % ((self.MONS)[date_val[1]], year) value = "%s %s" % (self.short_months[date_val[1]], year)
else: else:
value = "%d %s %s" % (date_val[0], (self.MONS)[date_val[1]], value = "%d %s %s" % (date_val[0],
year) self.short_months[date_val[1]], year)
if date_val[2] < 0: if date_val[2] < 0:
return self._bce_str % value return self._bce_str % value

View File

@ -201,8 +201,16 @@ class DateParserHR(DateParser):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayHR(DateDisplay): 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 = ( calendar = (
"", u" (julijanski)", u" (hebrejski)", "", u" (julijanski)", u" (hebrejski)",
u" (francuski republikanski)", u" (perzijski)", u" (islamski)", u" (francuski republikanski)", u" (perzijski)", u" (islamski)",

View File

@ -109,6 +109,16 @@ class DateParserIT(DateParser):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayIT(DateDisplay): 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 = ( calendar = (
"", u" (Giuliano)", u" (Ebraico)", "", u" (Giuliano)", u" (Ebraico)",

View File

@ -98,6 +98,16 @@ class DateParserLT(DateParser):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayLT(DateDisplay): 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 = ( calendar = (
u"", u" (julijaus)", u"", u" (julijaus)",

View File

@ -105,6 +105,13 @@ class DateDisplayNb(DateDisplay):
""" """
Norwegian language date display class. 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 = ( formats = (
u"ÅÅÅÅ-MM-DD (ISO)", u"ÅÅÅÅ-MM-DD (ISO)",

View File

@ -135,6 +135,16 @@ class DateParserNL(DateParser):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayNL(DateDisplay): 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 = ( calendar = (
"", u" (juliaans)", u" (hebreeuws)", "", u" (juliaans)", u" (hebreeuws)",
@ -174,36 +184,40 @@ class DateDisplayNL(DateDisplay):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self._months[date_val[1]], year) value = "%s %s" % (self.long_months[date_val[1]], year)
else: 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: elif self.format == 3:
# Mnd Day, Year # Mnd Day, Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self.MONS[date_val[1]], year) value = "%s %s" % (self.short_months[date_val[1]], year)
else: 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: elif self.format == 4:
# Day Month Year # Day Month Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self._months[date_val[1]], year) value = "%s %s" % (self.long_months[date_val[1]], year)
else: 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: else:
# Day Mnd Year # Day Mnd Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self.MONS[date_val[1]], year) value = "%s %s" % (self.short_months[date_val[1]], year)
else: 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: if date_val[2] < 0:
return self._bce_str % value return self._bce_str % value
else: else:

View File

@ -136,6 +136,16 @@ class DateParserPL(DateParser):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayPL(DateDisplay): 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 = ( calendar = (
"", u" (juliański)", u" (hebrajski)", "", u" (juliański)", u" (hebrajski)",
@ -190,9 +200,10 @@ class DateDisplayPL(DateDisplay):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self._months[date_val[1]],year) value = "%s %s" % (self.long_months[date_val[1]], year)
else: 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: elif self.format == 3:
# Day. Month. Year # Day. Month. Year
if date_val[0] == 0: if date_val[0] == 0:
@ -208,9 +219,10 @@ class DateDisplayPL(DateDisplay):
if date_val[1] == 0: if date_val[1] == 0:
value = year value = year
else: else:
value = "%s %s" % (self._months[date_val[1]],year) value = "%s %s" % (self.long_months[date_val[1]], year)
else: 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: else:
# Day RomanMon Year # Day RomanMon Year
if date_val[0] == 0: if date_val[0] == 0:
@ -219,7 +231,8 @@ class DateDisplayPL(DateDisplay):
else: else:
value = "%s %s" % (self.roman_months[date_val[1]], year) value = "%s %s" % (self.roman_months[date_val[1]], year)
else: 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: if date_val[2] < 0:
return self._bce_str % value return self._bce_str % value
else: else:
@ -243,14 +256,17 @@ class DateDisplayPL(DateDisplay):
elif mod == Date.MOD_SPAN: elif mod == Date.MOD_SPAN:
d1 = self.display_cal[cal](start) d1 = self.display_cal[cal](start)
d2 = self.display_cal[cal](date.get_stop_date()) 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: elif mod == Date.MOD_RANGE:
d1 = self.display_cal[cal](start) d1 = self.display_cal[cal](start)
d2 = self.display_cal[cal](date.get_stop_date()) 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: else:
text = self.display_cal[date.get_calendar()](start) 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])
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -113,6 +113,16 @@ class DateParserPT(DateParser):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayPT(DateDisplay): 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 = ( calendar = (
"", u" (Juliano)", u" (Hebreu)", "", u" (Juliano)", u" (Hebreu)",

View File

@ -184,6 +184,16 @@ class DateParserRU(DateParser):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplayRU(DateDisplay): 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 = ( calendar = (
u"", u"",

View File

@ -101,6 +101,16 @@ class DateParserSK(DateParser):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class DateDisplaySK(DateDisplay): 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 = ( calendar = (
"", u" (juliánský)", u" (hebrejský)", "", u" (juliánský)", u" (hebrejský)",

View File

@ -234,6 +234,14 @@ class DateDisplaySR_latin(DateDisplay):
""" """
Serbian (latin) date display class 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 = ( calendar = (
"", u" (julijanski)", u" (hebrejski)", "", u" (julijanski)", u" (hebrejski)",
u" (francuski republikanski)", u" (persijski)", u" (islamski)", u" (francuski republikanski)", u" (persijski)", u" (islamski)",

View File

@ -111,6 +111,13 @@ class DateDisplaySv(DateDisplay):
""" """
Swedish language date display class. 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 = ( formats = (
u"YYYY-MM-DD (ISO)", u"YYYY-MM-DD (ISO)",