From 8b3bc96e7d33956a975f555312a78fafda7985b5 Mon Sep 17 00:00:00 2001 From: richard Date: Sat, 5 Jan 2002 02:27:00 +0000 Subject: [PATCH] I18N'ification git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@499 57a73879-2fb5-44c3-a270-3262357dd7e2 --- I18N_PROGRESS.txt | 4 ++-- roundup/date.py | 50 +++++++++++++++++++++++------------------------ 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/I18N_PROGRESS.txt b/I18N_PROGRESS.txt index a664c53..dad31c0 100644 --- a/I18N_PROGRESS.txt +++ b/I18N_PROGRESS.txt @@ -17,8 +17,6 @@ whether there is at least one use of "_()". THESE FILES DO NOT USE _() ========================== -roundup/cgitb.py -roundup/date.py roundup/htmltemplate.py roundup/hyperdb.py roundup/i18n.py @@ -59,6 +57,8 @@ cgi-bin/roundup.cgi roundup/__init__.py roundup/cgi_client.py roundup/admin.py +roundup/cgitb.py +roundup/date.py WE DON'T CARE ABOUT THESE FILES diff --git a/roundup/date.py b/roundup/date.py index 8382ec3..c74b85d 100644 --- a/roundup/date.py +++ b/roundup/date.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: date.py,v 1.14 2001-11-22 15:46:42 jhermann Exp $ +# $Id: date.py,v 1.15 2002-01-05 02:27:00 richard Exp $ __doc__ = """ Date, time and time interval handling. @@ -178,7 +178,8 @@ class Date: ''' m = date_re.match(spec) if not m: - raise ValueError, 'Not a date spec: [[yyyy-]mm-dd].[[h]h:mm[:ss]] [offset]' + raise ValueError, _('Not a date spec: [[yyyy-]mm-dd].[[h]h:mm[:ss]]' + '[offset]') info = m.groupdict() # get the current date/time using the offset @@ -292,7 +293,8 @@ class Interval: self.sign = 1 m = interval_re.match(spec) if not m: - raise ValueError, 'Not an interval spec: [+-] [#y] [#m] [#w] [#d] [[[H]H:MM]:SS]' + raise ValueError, _('Not an interval spec: [+-] [#y] [#m] [#w] ' + '[#d] [[[H]H:MM]:SS]') info = m.groupdict() for group, attr in {'y':'year', 'm':'month', 'w':'week', 'd':'day', @@ -309,15 +311,8 @@ class Interval: def __repr__(self): return ''%self.__str__() - def pretty(self, threshold=('d', 5)): + def pretty(self): ''' print up the date date using one of these nice formats.. - < 1 minute - < 15 minutes - < 30 minutes - < 1 hour - < 12 hours - < 1 day - otherwise, return None (so a full date may be displayed) ''' if self.year or self.month > 2: return None @@ -325,36 +320,36 @@ class Interval: days = (self.month * 30) + self.day if days > 28: if int(days/30) > 1: - return '%s months'%int(days/30) + return _('%(number)s months')%{'number': int(days/30)} else: - return '1 month' + return _('1 month') else: - return '%s weeks'%int(days/7) + return _('%(number)s weeks')%{'number': int(days/7)} if self.day > 7: - return '1 week' + return _('1 week') if self.day > 1: - return '%s days'%self.day + return _('%(number)s days')%{'number': self.day} if self.day == 1 or self.hour > 12: - return 'yesterday' + return _('yesterday') if self.hour > 1: - return '%s hours'%self.hour + return _('%(number)s hours')%{'number': self.hour} if self.hour == 1: if self.minute < 15: - return 'an hour' + return _('an hour') quart = self.minute/15 if quart == 2: - return '1 1/2 hours' - return '1 %s/4 hours'%quart + return _('1 1/2 hours') + return _('1 %(number)s/4 hours')%{'number': quart} if self.minute < 1: - return 'just now' + return _('just now') if self.minute == 1: - return '1 minute' + return _('1 minute') if self.minute < 15: - return '%s minutes'%self.minute + return _('%(number)s minutes')%{'number': self.minute} quart = int(self.minute/15) if quart == 2: - return '1/2 an hour' - return '%s/4 hour'%quart + return _('1/2 an hour') + return _('%(number)s/4 hour')%{'number': quart} def get_tuple(self): return (self.year, self.month, self.day, self.hour, self.minute, @@ -383,6 +378,9 @@ if __name__ == '__main__': # # $Log: not supported by cvs2svn $ +# Revision 1.14 2001/11/22 15:46:42 jhermann +# Added module docstrings to all modules. +# # Revision 1.13 2001/09/18 22:58:37 richard # # Added some more help to roundu-admin -- 2.30.2