Skip to content

Commit 5e6e48c

Browse files
author
Richard Jones
committed
I18N'ification
1 parent bbeaa64 commit 5e6e48c

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

I18N_PROGRESS.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ whether there is at least one use of "_()".
1717

1818
THESE FILES DO NOT USE _()
1919
==========================
20-
roundup/cgitb.py
21-
roundup/date.py
2220
roundup/htmltemplate.py
2321
roundup/hyperdb.py
2422
roundup/i18n.py
@@ -59,6 +57,8 @@ cgi-bin/roundup.cgi
5957
roundup/__init__.py
6058
roundup/cgi_client.py
6159
roundup/admin.py
60+
roundup/cgitb.py
61+
roundup/date.py
6262

6363

6464
WE DON'T CARE ABOUT THESE FILES

roundup/date.py

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: date.py,v 1.14 2001-11-22 15:46:42 jhermann Exp $
18+
# $Id: date.py,v 1.15 2002-01-05 02:27:00 richard Exp $
1919

2020
__doc__ = """
2121
Date, time and time interval handling.
@@ -178,7 +178,8 @@ def set(self, spec, offset=0, date_re=re.compile(r'''
178178
'''
179179
m = date_re.match(spec)
180180
if not m:
181-
raise ValueError, 'Not a date spec: [[yyyy-]mm-dd].[[h]h:mm[:ss]] [offset]'
181+
raise ValueError, _('Not a date spec: [[yyyy-]mm-dd].[[h]h:mm[:ss]]'
182+
'[offset]')
182183
info = m.groupdict()
183184

184185
# get the current date/time using the offset
@@ -292,7 +293,8 @@ def set(self, spec, interval_re = re.compile('''
292293
self.sign = 1
293294
m = interval_re.match(spec)
294295
if not m:
295-
raise ValueError, 'Not an interval spec: [+-] [#y] [#m] [#w] [#d] [[[H]H:MM]:SS]'
296+
raise ValueError, _('Not an interval spec: [+-] [#y] [#m] [#w] '
297+
'[#d] [[[H]H:MM]:SS]')
296298

297299
info = m.groupdict()
298300
for group, attr in {'y':'year', 'm':'month', 'w':'week', 'd':'day',
@@ -309,52 +311,45 @@ def set(self, spec, interval_re = re.compile('''
309311
def __repr__(self):
310312
return '<Interval %s>'%self.__str__()
311313

312-
def pretty(self, threshold=('d', 5)):
314+
def pretty(self):
313315
''' print up the date date using one of these nice formats..
314-
< 1 minute
315-
< 15 minutes
316-
< 30 minutes
317-
< 1 hour
318-
< 12 hours
319-
< 1 day
320-
otherwise, return None (so a full date may be displayed)
321316
'''
322317
if self.year or self.month > 2:
323318
return None
324319
if self.month or self.day > 13:
325320
days = (self.month * 30) + self.day
326321
if days > 28:
327322
if int(days/30) > 1:
328-
return '%s months'%int(days/30)
323+
return _('%(number)s months')%{'number': int(days/30)}
329324
else:
330-
return '1 month'
325+
return _('1 month')
331326
else:
332-
return '%s weeks'%int(days/7)
327+
return _('%(number)s weeks')%{'number': int(days/7)}
333328
if self.day > 7:
334-
return '1 week'
329+
return _('1 week')
335330
if self.day > 1:
336-
return '%s days'%self.day
331+
return _('%(number)s days')%{'number': self.day}
337332
if self.day == 1 or self.hour > 12:
338-
return 'yesterday'
333+
return _('yesterday')
339334
if self.hour > 1:
340-
return '%s hours'%self.hour
335+
return _('%(number)s hours')%{'number': self.hour}
341336
if self.hour == 1:
342337
if self.minute < 15:
343-
return 'an hour'
338+
return _('an hour')
344339
quart = self.minute/15
345340
if quart == 2:
346-
return '1 1/2 hours'
347-
return '1 %s/4 hours'%quart
341+
return _('1 1/2 hours')
342+
return _('1 %(number)s/4 hours')%{'number': quart}
348343
if self.minute < 1:
349-
return 'just now'
344+
return _('just now')
350345
if self.minute == 1:
351-
return '1 minute'
346+
return _('1 minute')
352347
if self.minute < 15:
353-
return '%s minutes'%self.minute
348+
return _('%(number)s minutes')%{'number': self.minute}
354349
quart = int(self.minute/15)
355350
if quart == 2:
356-
return '1/2 an hour'
357-
return '%s/4 hour'%quart
351+
return _('1/2 an hour')
352+
return _('%(number)s/4 hour')%{'number': quart}
358353

359354
def get_tuple(self):
360355
return (self.year, self.month, self.day, self.hour, self.minute,
@@ -383,6 +378,9 @@ def test():
383378

384379
#
385380
# $Log: not supported by cvs2svn $
381+
# Revision 1.14 2001/11/22 15:46:42 jhermann
382+
# Added module docstrings to all modules.
383+
#
386384
# Revision 1.13 2001/09/18 22:58:37 richard
387385
#
388386
# Added some more help to roundu-admin

0 commit comments

Comments
 (0)