diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py
index 7fe19c4e9..aa7c13132 100644
--- a/openslides/agenda/views.py
+++ b/openslides/agenda/views.py
@@ -16,7 +16,7 @@ from django.core.urlresolvers import reverse
from django.contrib import messages
from django.db import transaction
from django.db.models import Model
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import ugettext as _
from django.views.generic.detail import SingleObjectMixin
from openslides.utils.pdf import stylesheet
@@ -254,7 +254,7 @@ def register_tab(request):
"""
register the agenda tab.
"""
- selected = True if request.path.startswith('/agenda/') else False
+ selected = request.path.startswith('/agenda/')
return Tab(
title=_('Agenda'),
url=reverse('item_overview'),
diff --git a/openslides/application/views.py b/openslides/application/views.py
index b02e4f7dc..b7b0ae3d2 100644
--- a/openslides/application/views.py
+++ b/openslides/application/views.py
@@ -34,7 +34,7 @@ from django.core.context_processors import csrf
from django.core.urlresolvers import reverse
from django.db import transaction
from django.shortcuts import redirect
-from django.utils.translation import ugettext_lazy as _, ungettext
+from django.utils.translation import ugettext as _, ungettext
from openslides.utils import csv_ext
from openslides.utils.pdf import stylesheet
@@ -852,13 +852,13 @@ class ApplicationPollPDF(PDFView):
circle = " " % imgpath
cell = []
cell.append(Spacer(0,0.8*cm))
- cell.append(Paragraph(_("Application No.")+" "+str(self.poll.application.number), stylesheet['Ballot_title']))
+ cell.append(Paragraph(_("Application No. %s") % self.poll.application.number, stylesheet['Ballot_title']))
cell.append(Paragraph(self.poll.application.title, stylesheet['Ballot_subtitle']))
- cell.append(Paragraph(str(self.poll.get_ballot())+". "+_("Vote"), stylesheet['Ballot_description']))
+ cell.append(Paragraph(_("%d. Vote") % self.poll.get_ballot(), stylesheet['Ballot_description']))
cell.append(Spacer(0,0.5*cm))
- cell.append(Paragraph(circle+_("Yes"), stylesheet['Ballot_option']))
- cell.append(Paragraph(circle+_("No"), stylesheet['Ballot_option']))
- cell.append(Paragraph(circle+_("Abstention"), stylesheet['Ballot_option']))
+ cell.append(Paragraph(circle + unicode(_("Yes")), stylesheet['Ballot_option']))
+ cell.append(Paragraph(circle + unicode(_("No")), stylesheet['Ballot_option']))
+ cell.append(Paragraph(circle + unicode(_("Abstention")), stylesheet['Ballot_option']))
data= []
# get ballot papers config values
ballot_papers_selection = config["application_pdf_ballot_papers_selection"]
@@ -875,15 +875,15 @@ class ApplicationPollPDF(PDFView):
# print ballot papers
if number > 0:
- for user in xrange(number/2):
- data.append([cell,cell])
+ for user in xrange(number / 2):
+ data.append([cell, cell])
rest = number % 2
if rest:
- data.append([cell,''])
- t=Table(data, 10.5*cm, 7.42*cm)
- t.setStyle(TableStyle([ ('GRID', (0,0), (-1,-1), 0.25, colors.grey),
- ('VALIGN', (0,0), (-1,-1), 'TOP'),
- ]))
+ data.append([cell, ''])
+ t=Table(data, 10.5 * cm, 7.42 * cm)
+ t.setStyle(TableStyle([('GRID', (0, 0), (-1, -1), 0.25, colors.grey),
+ ('VALIGN', (0, 0), (-1, -1), 'TOP'),
+ ]))
story.append(t)
diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py
index 6d5b814ce..21eb10d7b 100644
--- a/openslides/assignment/models.py
+++ b/openslides/assignment/models.py
@@ -227,9 +227,10 @@ class AssignmentPoll(BasePoll, CountInvalid, CountVotesCast, PublishPollMixin):
self.yesnoabstain = False
self.save()
if self.yesnoabstain:
- return [_('Yes'), _('No'), _('Abstain')]
+ return [ugettext_noop('Yes'), ugettext_noop('No'),
+ ugettext_noop('Abstain')]
else:
- return [_('Votes')]
+ return [ugettext_noop('Votes')]
def append_pollform_fields(self, fields):
CountInvalid.append_pollform_fields(self, fields)
diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py
index 7f1532f5e..9f54de109 100644
--- a/openslides/assignment/views.py
+++ b/openslides/assignment/views.py
@@ -23,7 +23,7 @@ from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.shortcuts import redirect
-from django.utils.translation import ungettext, ugettext_lazy as _
+from django.utils.translation import ungettext, ugettext as _
from utils.pdf import stylesheet
from utils.template import Tab
@@ -325,9 +325,9 @@ class AssignmentPDF(PDFView):
story.append(Paragraph(title, stylesheet['Heading1']))
preamble = config["assignment_pdf_preamble"]
if preamble:
- story.append(Paragraph("%s" % preamble.replace('\r\n','
'),
+ story.append(Paragraph("%s" % preamble.replace('\r\n', '
'),
stylesheet['Paragraph']))
- story.append(Spacer(0,0.75*cm))
+ story.append(Spacer(0, 0.75 * cm))
assignments = Assignment.objects.order_by('name')
if not assignments: # No assignments existing
story.append(Paragraph(_("No assignments available."),
@@ -349,9 +349,9 @@ class AssignmentPDF(PDFView):
def get_assignment(self, assignment, story):
# title
- story.append(Paragraph(_("Election")+": %s" % assignment.name,
+ story.append(Paragraph(_("Election: %s") % assignment.name,
stylesheet['Heading1']))
- story.append(Spacer(0,0.5*cm))
+ story.append(Spacer(0, 0.5 * cm))
# posts
cell1a = []
cell1a.append(Paragraph("%s:" %
@@ -371,7 +371,7 @@ class AssignmentPDF(PDFView):
cell2b.append(Paragraph(". "
"__________________________________________",
stylesheet['Signaturefield']))
- cell2b.append(Spacer(0,0.2*cm))
+ cell2b.append(Spacer(0, 0.2 * cm))
# Vote results
@@ -380,7 +380,6 @@ class AssignmentPDF(PDFView):
polls = assignment.poll_set.filter(published=True)
data_votes = []
-
# Left side
cell3a = []
cell3a.append(Paragraph("%s:" % (_("Vote results")),
@@ -416,10 +415,8 @@ class AssignmentPDF(PDFView):
if vote == None:
row.append('–')
elif 'Yes' in vote and 'No' in vote and 'Abstain' in vote:
- tmp = _("Y")+": " + vote['Yes'] + "\n"
- tmp += _("N")+": " + vote['No'] + "\n"
- tmp += _("A")+": " + vote['Abstain']
- row.append(tmp)
+ row.append(_("Y: %s\nN: %s\nA: %s") % (vote['Yes'],
+ vote['No'], vote['Abstain']))
elif 'Votes' in vote:
row.append(vote['Votes'])
else:
@@ -452,10 +449,10 @@ class AssignmentPDF(PDFView):
# table
data = []
- data.append([cell1a,cell1b])
+ data.append([cell1a, cell1b])
if polls:
- data.append([cell3a,table_votes])
- data.append(['', '* = '+_('elected')])
+ data.append([cell3a, table_votes])
+ data.append(['', '* = ' + _('elected')])
else:
data.append([cell2a, cell2b])
data.append([Spacer(0, 0.2 * cm), ''])
@@ -649,6 +646,6 @@ def register_tab(request):
def get_widgets(request):
return [
- Widget(name=ugettext('Assignments'), template='assignment/widget.html',
+ Widget(name=_('Assignments'), template='assignment/widget.html',
context={'assignments': Assignment.objects.all()})
]
diff --git a/openslides/participant/views.py b/openslides/participant/views.py
index 2516d3499..5d3c67bcd 100644
--- a/openslides/participant/views.py
+++ b/openslides/participant/views.py
@@ -32,7 +32,7 @@ from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User, Group
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
-from django.utils.translation import ugettext_lazy as _, ungettext
+from django.utils.translation import ugettext as _, ungettext
from openslides.utils import csv_ext
from openslides.utils.pdf import stylesheet
diff --git a/openslides/utils/pdf.py b/openslides/utils/pdf.py
index 6a120e7d6..0ed1859e7 100755
--- a/openslides/utils/pdf.py
+++ b/openslides/utils/pdf.py
@@ -214,23 +214,22 @@ def firstPage(canvas, doc):
title_line = u"%s | %s" % (config["event_name"], config["event_description"])
if len(title_line) > 75:
title_line = "%s ..." % title_line[:70]
- canvas.drawString(2.75*cm, 28*cm, title_line)
+ canvas.drawString(2.75 * cm, 28 * cm, title_line)
if config["event_date"] and config["event_location"]:
canvas.drawString(2.75 * cm, 27.6 * cm, u"%s, %s" % (config["event_date"], config["event_location"]))
# time
canvas.setFont('Ubuntu', 7)
time = datetime.now().strftime(str(_("%Y-%m-%d %H:%Mh")))
- canvas.drawString(15 * cm, 28 * cm, _("Printed") + ": %s" % time)
+ canvas.drawString(15 * cm, 28 * cm, unicode(_("Printed: %s") % time))
# title
if doc.title:
canvas.setFont('Ubuntu-Bold', 24)
canvas.setFillGray(0)
- #canvas.drawCentredString(PAGE_WIDTH/2.0, PAGE_HEIGHT-108, doc.title)
- canvas.drawString(2.75 * cm, PAGE_HEIGHT - 108, doc.title)
+ canvas.drawString(2.75 * cm, PAGE_HEIGHT - 108, unicode(doc.title))
# footer (with page number)
canvas.setFont('Ubuntu', 8)
canvas.setFillGray(0.4)
- canvas.drawString(10 * cm, 1*cm, _("Page") + " %s" % doc.page)
+ canvas.drawString(10 * cm, 1 * cm, unicode(_("Page %s") % doc.page))
canvas.restoreState()
@@ -239,5 +238,5 @@ def laterPages(canvas, doc):
# footer (with page number)
canvas.setFont('Ubuntu', 7)
canvas.setFillGray(0.4)
- canvas.drawString(10 * cm, 1 * cm, _("Page") + " %s" % doc.page)
+ canvas.drawString(10 * cm, 1 * cm, unicode(_("Page %s") % doc.page))
canvas.restoreState()
diff --git a/openslides/utils/views.py b/openslides/utils/views.py
index efde945dc..97a183ae1 100644
--- a/openslides/utils/views.py
+++ b/openslides/utils/views.py
@@ -282,9 +282,6 @@ class PDFView(PermissionMixin, View):
response.write(pdf)
return response
- def append_to_pdf(self, story):
- pass
-
def get_filename(self):
return self.filename