1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2024-11-21 20:51:03 +00:00

lower_thirds: always use event locale when localizing text

This commit is contained in:
Franzi 2022-11-22 19:19:11 +01:00
parent f618654ee0
commit d42a2744d0
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 13 additions and 5 deletions

View file

@ -18,11 +18,11 @@
hide itself. hide itself.
</p> </p>
{% if request.event.rooms %} {% if localized_rooms %}
<h3>{% trans "room list" %}</h3> <h3>{% trans "room list" %}</h3>
<ul> <ul>
{% for room in request.event.rooms.all %} {% for room in localized_rooms %}
<li><a href="{% url 'plugins:pretalx_broadcast_tools:lowerthirds' request.event.slug %}#{{ room.name }}">{{ room.name }}</a></li> <li><a href="{% url 'plugins:pretalx_broadcast_tools:lowerthirds' request.event.slug %}#{{ room }}">{{ room }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}

View file

@ -24,6 +24,14 @@ class BroadcastToolsOrgaView(PermissionRequired, FormView):
def get_success_url(self): def get_success_url(self):
return self.request.path return self.request.path
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['localized_rooms'] = [
room.name.localize(self.request.event.locale)
for room in self.request.event.rooms.all()
]
return context
def form_valid(self, form): def form_valid(self, form):
form.save() form.save()
return super().form_valid(form) return super().form_valid(form)
@ -73,7 +81,7 @@ class BroadcastToolsScheduleView(EventPermissionRequired, ScheduleMixin, Templat
{ {
"rooms": sorted( "rooms": sorted(
{ {
str(room["name"]) room["name"].localize(schedule.event.locale)
for day in schedule.data for day in schedule.data
for room in day["rooms"] for room in day["rooms"]
} }
@ -99,7 +107,7 @@ class BroadcastToolsScheduleView(EventPermissionRequired, ScheduleMixin, Templat
} }
if talk.submission.track if talk.submission.track
else None, else None,
"room": str(room["name"]), "room": room["name"].localize(schedule.event.locale),
"infoline": infoline.format(**placeholders(schedule, talk)), "infoline": infoline.format(**placeholders(schedule, talk)),
} }
for day in schedule.data for day in schedule.data