Setting the year as an ordinal number in Croatian

With this commit, three more reports now show a year as an
ordinal number in Croatian.

Issue #10822
This commit is contained in:
Paul Franklin 2018-10-04 09:21:29 -07:00
parent a40eca36d9
commit 54be8d62f3
4 changed files with 14 additions and 19 deletions

View File

@ -57,7 +57,7 @@ from gramps.gen.plug.report import MenuReportOptions
from gramps.gen.plug.report import stdoptions
from gramps.gen.config import config
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
from gramps.gen.lib import EventType
from gramps.gen.lib import EventType, Date
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.display.name import displayer as _nd
@ -329,7 +329,8 @@ class FanChart(Report):
bth = ""
if birth:
bth = birth.get_date_object()
bth = str(bth.to_calendar(self.calendar).get_year())
bth = self._get_date(
Date(bth.to_calendar(self.calendar).get_year())) # localized
if bth == 0:
bth = ""
elif birth.get_type() != EventType.BIRTH:
@ -339,7 +340,8 @@ class FanChart(Report):
dth = ""
if death:
dth = death.get_date_object()
dth = str(dth.to_calendar(self.calendar).get_year())
dth = self._get_date(
Date(dth.to_calendar(self.calendar).get_year())) # localized
if dth == 0:
dth = ""
elif death.get_type() != EventType.DEATH:

View File

@ -421,7 +421,7 @@ class Extract:
if date:
year = date.get_year()
if year:
return [str(year)]
return [self._get_date(Date(year))] # localized year
return [_T_("Date(s) missing")]
def get_month(self, event):
@ -672,6 +672,7 @@ class Extract:
self._locale = rlocale
self._ = rlocale.translation.sgettext
self._get_type = rlocale.get_type
self._get_date = rlocale.get_date
data = []
ext = self.extractors
@ -788,21 +789,12 @@ class StatisticsChart(Report):
else:
genders = None
# needed for keyword based localization
mapping = {
'genders': genders,
'year_from': year_from,
'year_to': year_to
}
if genders:
span_string = self._("%(genders)s born "
"%(year_from)04d-%(year_to)04d"
) % mapping
span_string = self._("%s born") % genders
else:
span_string = self._("Persons born "
"%(year_from)04d-%(year_to)04d"
) % mapping
span_string = self._("Persons born")
span_string += " %s-%s" % (self._get_date(Date(year_from)), # localized
self._get_date(Date(year_to)))
people = self.filter.apply(self.database,
self.database.iter_person_handles(),

View File

@ -45,6 +45,7 @@ from gramps.gen.sort import Sort
from gramps.gen.config import config
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.lib import Date
#------------------------------------------------------------------------
#
@ -297,7 +298,7 @@ class TimeLine(Report):
delta = (stop_pos - start_pos) / 5
for val in range(0, 6):
xpos = start_pos + (val * delta)
year_str = str(int(year_low + (incr * val)))
year_str = self._get_date(Date(year_low + int(incr * val)))
self.doc.center_text('TLG-label', year_str, xpos, label_y)
def draw_no_date_heading(self):

View File

@ -20981,7 +20981,7 @@ msgstr "Spremanje dijagrama..."
#: ../gramps/plugins/drawreport/statisticschart.py:939
#, python-format
msgid "%s (persons):"
msgstr "%s (persons):"
msgstr "%s (osobe):"
#: ../gramps/plugins/drawreport/statisticschart.py:991
#: ../gramps/plugins/textreport/recordsreport.py:219