Skip to content

Commit e9584eb

Browse files
committed
Translation problems resolved.
1 parent 73d3369 commit e9584eb

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ coverage.xml
9494
.hypothesis/
9595

9696
# Translations
97-
*.mo
97+
#*.mo
9898
*.pot
9999

100100
# Django stuff:
6.73 KB
Binary file not shown.

driver27/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def teams_verbose(self):
8282
return ', '.join([team.name for team in teams.all()]) if teams.count() else None
8383

8484
def __str__(self):
85-
return _('%(driver)s in %(competition)s') % {'driver': self.driver, 'competition': self.competition}
85+
return _(u'%(driver)s in %(competition)s') % {'driver': self.driver, 'competition': self.competition}
8686

8787
class Meta:
8888
unique_together = ('driver', 'competition')

driver27/tests/test_contender.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# -*- coding: utf-8 -*-
22
from django.test import TestCase
3-
from .common import CommonContenderTestCase
3+
from django.utils.translation import ugettext as _
4+
from .common import CommonContenderTestCase, retro_encode
5+
46

57
class ContenderTestCase(TestCase, CommonContenderTestCase):
68
def test_contender_unicode(self):
79
contender = self.get_test_contender()
8-
expected_str = ' in '.join((str(contender.driver), str(contender.competition)))
9-
self.assertEquals(str(contender), expected_str)
10+
expected_str = _(u'%(driver)s in %(competition)s') % {'driver': contender.driver,
11+
'competition': contender.competition}
12+
self.assertEquals(str(contender), retro_encode(expected_str))
1013

1114
def test_contender_team(self):
1215
contender = self.get_test_contender()
13-
self.assertEquals(contender.teams_verbose, None)
16+
self.assertEquals(contender.teams_verbose, None)

driver27/views.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
from django.db.models import Count
23
from django.http import Http404
34
from django.shortcuts import render
@@ -62,7 +63,7 @@ def _rank_view(request, competition_slug, year, rank_model='driver'):
6263
else:
6364
raise Http404(_('Impossible rank'))
6465

65-
title = '{season} [{title}]'.format(season=season, title=rank_title)
66+
title = u'{season} [{title}]'.format(season=season, title=rank_title)
6667

6768
context = {'rank': rank,
6869
'season': season,
@@ -84,7 +85,7 @@ def driver_olympic_view(request, competition_slug, year):
8485
rank_title = _('DRIVERS rank by olympic mode')
8586
tpl = 'driver27/driver/driver-list.html'
8687

87-
title = '{season} [{title}]'.format(season=season, title=rank_title)
88+
title = u'{season} [{title}]'.format(season=season, title=rank_title)
8889

8990
context = {'rank': rank,
9091
'season': season,

0 commit comments

Comments
 (0)