Setting the year as an ordinal number in Croatian

With this commit, the "master" version of the Statistics Chart
report will show a year as an ordinal number in Croatian.

So our translators will have until 5.1.0 is released to translate
the two new strings, in all the supported gramps languages.

Issue #10822
This commit is contained in:
Paul Franklin 2018-10-07 23:45:40 -07:00
parent 15db2dd603
commit 7da8811327

View File

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