mirror of
https://github.com/Kunsi/pretalx-plugin-broadcast-tools
synced 2024-11-22 01:01:02 +00:00
Add i18n support
This commit is contained in:
parent
7107150736
commit
07474c6976
3 changed files with 20 additions and 10 deletions
|
@ -1,23 +1,21 @@
|
|||
from django import forms
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from hierarkey.forms import HierarkeyForm
|
||||
from i18nfield.forms import I18nFormField, I18nFormMixin, I18nTextInput
|
||||
|
||||
|
||||
class LowerThirdsSettingsForm(HierarkeyForm):
|
||||
lower_thirds_no_talk_info = forms.CharField(
|
||||
class LowerThirdsSettingsForm(I18nFormMixin, HierarkeyForm):
|
||||
lower_thirds_no_talk_info = I18nFormField(
|
||||
help_text=_(
|
||||
"Will be shown as talk title if there's currently no talk "
|
||||
"running."
|
||||
),
|
||||
initial="Sorry, there's currently no talk running",
|
||||
label=_('"no talk running" information'),
|
||||
widget=I18nTextInput,
|
||||
required=True,
|
||||
)
|
||||
lower_thirds_info_string = forms.CharField(
|
||||
help_text=_(
|
||||
"Will only be shown if there's a talk running."
|
||||
),
|
||||
initial="",
|
||||
lower_thirds_info_string = I18nFormField(
|
||||
help_text=_("Will only be shown if there's a talk running."),
|
||||
label=_("info line"),
|
||||
required=False,
|
||||
widget=I18nTextInput,
|
||||
)
|
||||
|
|
|
@ -1,8 +1,19 @@
|
|||
from django.dispatch import receiver
|
||||
from django.urls import resolve, reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_noop, ugettext_lazy as _
|
||||
from i18nfield.strings import LazyI18nString
|
||||
from pretalx.common.models.settings import hierarkey
|
||||
from pretalx.orga.signals import nav_event_settings
|
||||
|
||||
hierarkey.add_default(
|
||||
"lower_thirds_no_talk_info",
|
||||
LazyI18nString.from_gettext(
|
||||
gettext_noop("Sorry, there's currently no talk running")
|
||||
),
|
||||
LazyI18nString,
|
||||
)
|
||||
hierarkey.add_default("lower_thirds_info_string", "", LazyI18nString)
|
||||
|
||||
|
||||
@receiver(nav_event_settings)
|
||||
def navbar_info(sender, request, **kwargs):
|
||||
|
|
|
@ -37,6 +37,7 @@ class LowerThirdsOrgaView(PermissionRequired, FormView):
|
|||
return {
|
||||
"obj": self.request.event,
|
||||
"attribute_name": "settings",
|
||||
"locales": self.request.event.locales,
|
||||
**kwargs,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue