Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Aug 23, 2013
2 parents b8df8d3 + aab1f63 commit 132f6fe
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
8 changes: 4 additions & 4 deletions trans/templatetags/translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,12 @@ def naturaltime(value, now=None):
) % {'count': count}
elif delta.days >= 14:
count = delta.days / 7
if count == 1:
return _('a week ago')
return ungettext(
'%(count)s week ago', '%(count)s weeks ago', count
) % {'count': count}
elif delta.days > 0:
if delta.days == 7:
return _('a week ago')
if delta.days == 1:
return _('yesterday')
return ungettext(
Expand Down Expand Up @@ -378,14 +378,14 @@ def naturaltime(value, now=None):
) % {'count': count}
elif delta.days >= 14:
count = delta.days / 7
if count == 1:
return _('a week from now')
return ungettext(
'%(count)s week from now', '%(count)s weeks from now', count
) % {'count': count}
elif delta.days > 0:
if delta.days == 1:
return _('tomorrow')
if delta.days == 7:
return _('a week from now')
return ungettext(
'%(count)s day from now', '%(count)s days from now', delta.days
) % {'count': delta.days}
Expand Down
10 changes: 10 additions & 0 deletions trans/tests/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ def test_report(self):
response = self.client.get(reverse('admin-report'))
self.assertContains(response, 'On branch master')

def test_create_project(self):
response = self.client.get(reverse('admin:trans_project_add'))
self.assertContains(response, 'Required fields are marked as bold')

def test_create_subproject(self):
response = self.client.get(reverse('admin:trans_subproject_add'))
self.assertContains(
response, 'Importing a new translation can take some time'
)


class SSHKeysTest(TestCase):
def test_parse(self):
Expand Down
22 changes: 18 additions & 4 deletions trans/tests/test_naturaldate.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,32 @@

TEST_DATA = (
(0, 'now'),
(1, 'a second from now'),
(-1, 'a second ago'),
(60, 'a minute from now'),
(-60, 'a minute ago'),
(120, '2 minutes from now'),
(-120, '2 minutes ago'),
(3600 * 24, 'tomorrow'),
(-3600 * 24, 'yesterday'),
(3600 * 24 * 2, '2 days from now'),
(-3600 * 24 * 2, '2 days ago'),
(3600, 'an hour from now'),
(-3600, 'an hour ago'),
(3600 * 2, '2 hours from now'),
(-3600 * 2, '2 hours ago'),
(3600 * 24, 'tomorrow'),
(-3600 * 24, 'yesterday'),
(3600 * 24 * 2, '2 days from now'),
(-3600 * 24 * 2, '2 days ago'),
(3600 * 24 * 7, 'a week from now'),
(-3600 * 24 * 7, 'a week ago'),
(3600 * 24 * 14, '2 weeks from now'),
(-3600 * 24 * 14, '2 weeks ago'),
(3600 * 24 * 30, 'a month from now'),
(-3600 * 24 * 30, 'a month ago'),
(3600 * 24 * 60, '2 months from now'),
(-3600 * 24 * 60, '2 months ago'),
(3600 * 24 * 365, 'a year from now'),
(-3600 * 24 * 365, 'a year ago'),
(3600 * 24 * 365 * 2, '2 years from now'),
(-3600 * 24 * 365 * 2, '2 years ago'),
)


Expand Down

0 comments on commit 132f6fe

Please sign in to comment.