From c8c475cdda38fb02f93d9f21af1cc74d1acbc4ce Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Sat, 3 Sep 2016 09:20:30 -0700 Subject: [PATCH] emable deferred translation of Span ages --- gramps/gen/lib/date.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gramps/gen/lib/date.py b/gramps/gen/lib/date.py index b0a20ad07..abcb93107 100644 --- a/gramps/gen/lib/date.py +++ b/gramps/gen/lib/date.py @@ -387,7 +387,7 @@ class Span: return True return int(self) > int(other) - def format(self, precision=2, as_age=True): + def format(self, precision=2, as_age=True, dlocale=glocale): """ Force a string representation at a level of precision. @@ -396,9 +396,15 @@ class Span: 2 only most two significant levels (year, month, day) 3 at most three items of signifance (year, month, day) == ==================================================== + + If dlocale is passed in (a :class:`.GrampsLocale`) then + the translated value will be returned instead. + + :param dlocale: allow deferred translation of strings + :type dlocale: a :class:`.GrampsLocale` instance """ self.precision = precision - return self.get_repr(as_age) + return self.get_repr(as_age, dlocale=dlocale) def _format(self, diff_tuple, dlocale=glocale): """