mirror of
https://github.com/Kunsi/pretalx-plugin-broadcast-tools
synced 2024-11-15 02:05:48 +00:00
add translation to pdf export
This commit is contained in:
parent
86a6075c30
commit
443c7ce85a
1 changed files with 15 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
from pretalx.schedule.exporters import ScheduleData
|
from pretalx.schedule.exporters import ScheduleData
|
||||||
from reportlab.lib import colors
|
from reportlab.lib import colors
|
||||||
from reportlab.lib.enums import TA_CENTER
|
from reportlab.lib.enums import TA_CENTER
|
||||||
|
@ -78,6 +79,9 @@ class PDFInfoPage(Flowable):
|
||||||
def _space(self):
|
def _space(self):
|
||||||
self._add(Spacer(1, PAGE_PADDING / 2))
|
self._add(Spacer(1, PAGE_PADDING / 2))
|
||||||
|
|
||||||
|
def _localize(self, translation):
|
||||||
|
return translation.localize(self.event.locale)
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
if hasattr(self.talk, "local_start"):
|
if hasattr(self.talk, "local_start"):
|
||||||
talk_start = self.talk.local_start
|
talk_start = self.talk.local_start
|
||||||
|
@ -112,7 +116,10 @@ class PDFInfoPage(Flowable):
|
||||||
|
|
||||||
if self.talk.submission.do_not_record:
|
if self.talk.submission.do_not_record:
|
||||||
self._add(
|
self._add(
|
||||||
Paragraph("DO NOT RECORD - DO NOT STREAM", style=self.style["Warning"]),
|
Paragraph(
|
||||||
|
self._localize(_("DO NOT RECORD - DO NOT STREAM")),
|
||||||
|
style=self.style["Warning"],
|
||||||
|
),
|
||||||
gap=0,
|
gap=0,
|
||||||
)
|
)
|
||||||
self._space()
|
self._space()
|
||||||
|
@ -121,8 +128,8 @@ class PDFInfoPage(Flowable):
|
||||||
Paragraph(
|
Paragraph(
|
||||||
" | ".join(
|
" | ".join(
|
||||||
[
|
[
|
||||||
self.event.name.localize(self.event.locale),
|
self._localize(self.event.name),
|
||||||
self.room["name"].localize(self.event.locale),
|
self._localize(self.room["name"]),
|
||||||
talk_start.strftime("%F"),
|
talk_start.strftime("%F"),
|
||||||
f'{talk_start.strftime("%T")} - {talk_end.strftime("%T")}',
|
f'{talk_start.strftime("%T")} - {talk_end.strftime("%T")}',
|
||||||
],
|
],
|
||||||
|
@ -193,7 +200,7 @@ class PDFInfoPage(Flowable):
|
||||||
self._space()
|
self._space()
|
||||||
self._add(
|
self._add(
|
||||||
Paragraph(
|
Paragraph(
|
||||||
"Questions",
|
self._localize(_("Questions")),
|
||||||
style=self.style["Heading"],
|
style=self.style["Heading"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -202,7 +209,7 @@ class PDFInfoPage(Flowable):
|
||||||
if answer.question.id not in self._questions:
|
if answer.question.id not in self._questions:
|
||||||
continue
|
continue
|
||||||
self._question_text(
|
self._question_text(
|
||||||
answer.question.question.localize(self.event.locale),
|
self._localize(answer.question.question),
|
||||||
answer.answer,
|
answer.answer,
|
||||||
style=self.style["Question"],
|
style=self.style["Question"],
|
||||||
)
|
)
|
||||||
|
@ -212,7 +219,7 @@ class PDFInfoPage(Flowable):
|
||||||
if answer.question.id not in self._questions:
|
if answer.question.id not in self._questions:
|
||||||
continue
|
continue
|
||||||
self._question_text(
|
self._question_text(
|
||||||
f"{answer.question.question.localize(self.event.locale)} ({spk.get_display_name()})",
|
f"{self._localize(answer.question.question)} ({spk.get_display_name()})",
|
||||||
answer.answer,
|
answer.answer,
|
||||||
style=self.style["Question"],
|
style=self.style["Question"],
|
||||||
)
|
)
|
||||||
|
@ -221,7 +228,7 @@ class PDFInfoPage(Flowable):
|
||||||
self._space()
|
self._space()
|
||||||
self._add(
|
self._add(
|
||||||
Paragraph(
|
Paragraph(
|
||||||
"Notes",
|
self._localize(_("Notes")),
|
||||||
style=self.style["Heading"],
|
style=self.style["Heading"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -243,7 +250,7 @@ class PDFInfoPage(Flowable):
|
||||||
self._space()
|
self._space()
|
||||||
self._add(
|
self._add(
|
||||||
Paragraph(
|
Paragraph(
|
||||||
"Internal Notes",
|
self._localize(_("Internal Notes")),
|
||||||
style=self.style["Heading"],
|
style=self.style["Heading"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue