From d587ffe6184746f43109d724f50a126ddbbb341b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Wed, 4 Feb 2009 16:58:46 +0000 Subject: [PATCH] #2657,#1718 use ngettext svn: r11848 --- src/plugins/drawreport/Calendar.py | 19 +++++++++++-------- src/plugins/textreport/BirthdayReport.py | 19 +++++++++++-------- src/plugins/webreport/WebCal.py | 13 +++++++------ 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/plugins/drawreport/Calendar.py b/src/plugins/drawreport/Calendar.py index 00ae35b7d..54621a97c 100644 --- a/src/plugins/drawreport/Calendar.py +++ b/src/plugins/drawreport/Calendar.py @@ -23,6 +23,7 @@ # #------------------------------------------------------------------------ from gettext import gettext as _ +from gettext import ngettext import datetime import time @@ -290,10 +291,11 @@ class Calendar(Report): 'person' : short_name, 'relation' : ""} else: - text = _('%(person)s, %(age)d%(relation)s') % { - 'person' : short_name, - 'age' : nyears, - 'relation' : ""} + text = ngettext('%(person)s, %(age)d%(relation)s', + '%(person)s, %(age)d%(relation)s', nyears) + % {'person' : short_name, + 'age' : nyears, + 'relation' : ""} self.add_day_item(text, month, day) if self.anniversaries: family_list = person.get_family_handle_list() @@ -340,10 +342,11 @@ class Calendar(Report): 'person' : short_name, } else: - text = _("%(spouse)s and\n %(person)s, %(nyears)d") % { - 'spouse' : spouse_name, - 'person' : short_name, - 'nyears' : nyears} + text = ngettext("%(spouse)s and\n %(person)s, %(nyears)d", + "%(spouse)s and\n %(person)s, %(nyears)d", nyears) + % {'spouse' : spouse_name, + 'person' : short_name, + 'nyears' : nyears} alive1 = probably_alive(person, self.database, \ prob_alive_date) diff --git a/src/plugins/textreport/BirthdayReport.py b/src/plugins/textreport/BirthdayReport.py index 7ac3b8444..39b0ef4a8 100644 --- a/src/plugins/textreport/BirthdayReport.py +++ b/src/plugins/textreport/BirthdayReport.py @@ -23,6 +23,7 @@ # #------------------------------------------------------------------------ from gettext import gettext as _ +from gettext import ngettext import datetime import time @@ -246,10 +247,11 @@ class CalendarReport(Report): 'person' : short_name, 'relation' : comment} else: - text = _('%(person)s, %(age)d%(relation)s') % { - 'person' : short_name, - 'age' : nyears, - 'relation' : comment} + text = ngettext('%(person)s, %(age)d%(relation)s', + '%(person)s, %(age)d%(relation)s', nyears) + % {'person' : short_name, + 'age' : nyears, + 'relation' : comment} self.add_day_item(text, month, day) if self.anniversaries: @@ -293,10 +295,11 @@ class CalendarReport(Report): 'spouse' : spouse_name, 'person' : short_name} else: - text = _("%(spouse)s and\n %(person)s, %(nyears)d") % { - 'spouse' : spouse_name, - 'person' : short_name, - 'nyears' : nyears} + text = ngettext("%(spouse)s and\n %(person)s, %(nyears)d", + "%(spouse)s and\n %(person)s, %(nyears)d", nyears) + % {'spouse' : spouse_name, + 'person' : short_name, + 'nyears' : nyears} prob_alive_date = gen.lib.Date(self.year, month, day) alive1 = probably_alive(person, self.database, \ diff --git a/src/plugins/webreport/WebCal.py b/src/plugins/webreport/WebCal.py index fae0e1afc..a30a262da 100644 --- a/src/plugins/webreport/WebCal.py +++ b/src/plugins/webreport/WebCal.py @@ -48,6 +48,7 @@ import calendar import codecs import shutil from gettext import gettext as _ +from gettext import ngettext #------------------------------------------------------------------------ # @@ -1527,9 +1528,9 @@ def get_day_list(event_date, holiday_list, bday_anniv_list): txt_str = _('%(person)s, birth') % { 'person' : text} else: - txt_str = _('%(person)s, %(age)s old') % { - 'person' : text, - 'age' : age_str} + txt_str = ngettext('%(person)s, %(age)s old', + '%(person)s, %(age)s old', age_str) + % {'person' : text, 'age' : age_str} # an anniversary elif event == 'Anniversary': @@ -1538,9 +1539,9 @@ def get_day_list(event_date, holiday_list, bday_anniv_list): txt_str = _('%(couple)s, wedding') % { 'couple' : text} else: - txt_str = _('%(couple)s, %(years)d year anniversary') % { - 'couple' : text, - 'years' : nyears} + txt_str = ngettext('%(couple)s, %(years)d year anniversary' + '%(couple)s, %(years)d year anniversary', nyears) + % {'couple' : text, 'years' : nyears} txt_str = '%s' % txt_str if txt_str is not None: