Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 9 additions & 20 deletions databags/translate.ini
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ past_events = Past events
upcoming_events = Upcoming events
running_sprint = BeeWare will be running a sprint at
what_is_a_sprint = What is a Sprint?
sprint_description = Code sprints are events held normally after a conference where attendees can use the conference venue to work in small groups on various projects. Learn more about how sprints work with the
sprint_pycon_video = PyCon US 'What is a sprint?' video
sprint_description = Code sprints are events held normally after a conference where attendees can use the conference venue to work in small groups on various projects. Learn more about how sprints work with the {{ pycon_link("PyCon US 'What is a sprint?' video") }}.
challenge_coin = Challenge Coin
date = Date
speakers = Speakers
Expand Down Expand Up @@ -209,8 +208,7 @@ past_events = الأحداث السابقة
upcoming_events = الأحداث القادمة
running_sprint = BeeWare سيقوم بتشغيل سبرينت في
what_is_a_sprint = ما هو سبرينت؟
sprint_description = كود سبرينت هي أحداث تعقد عادة بعد مؤتمر حيث يمكن للحاضرين استخدام مكان المؤتمر للعمل في مجموعات صغيرة في مشاريع مختلفة. اعرف المزيد عن كيفية عمل سبرينت مع
sprint_pycon_video = PyCon US 'ما هو سبرينت?' فيديو
sprint_description = كود سبرينت هي أحداث تعقد عادة بعد مؤتمر حيث يمكن للحاضرين استخدام مكان المؤتمر للعمل في مجموعات صغيرة في مشاريع مختلفة. اعرف المزيد عن كيفية عمل سبرينت مع {{ pycon_link("PyCon US 'ما هو سبرينت?' فيديو") }}
challenge_coin = عملة التحدي
date = تاريخ
speakers = المتحدثون
Expand Down Expand Up @@ -321,8 +319,7 @@ past_events = Eventos anteriores
upcoming_events = Próximos eventos
running_sprint = BeeWare fará um sprint em
what_is_a_sprint = O que é um Sprint?
sprint_description = Sprints de código são eventos, realizados normalmente após conferências, onde os participantes podem usar o local da conferência para trabalhar em grupos pequenos em vários projetos. Saiba mais como funcionam os sprints com o
sprint_pycon_video = vídeo da PyCon US 'What is a sprint?'
sprint_description = Sprints de código são eventos, realizados normalmente após conferências, onde os participantes podem usar o local da conferência para trabalhar em grupos pequenos em vários projetos. Saiba mais como funcionam os sprints com o {{ pycon_link("vídeo da PyCon US 'What is a sprint?'") }}.
challenge_coin = Challenge Coin
date = Data
speakers = Palestrantes
Expand Down Expand Up @@ -433,8 +430,7 @@ past_events = Past events
upcoming_events = Upcoming events
running_sprint = BeeWare will be running a sprint at
what_is_a_sprint = What is a Sprint?
sprint_description = Code sprints are events held normally after a conference where attendees can use the conference venue to work in small groups on various projects. Learn more about how sprints work with the
sprint_pycon_video = PyCon US 'What is a sprint?' video
sprint_description = Code sprints are events held normally after a conference where attendees can use the conference venue to work in small groups on various projects. Learn more about how sprints work with the {{ pycon_link("PyCon US 'What is a sprint?' video") }}.
challenge_coin = Challenge Coin
date = Date
speakers = Speakers
Expand Down Expand Up @@ -545,8 +541,7 @@ past_events = Eventos pasados
upcoming_events = Eventos futuros
running_sprint = BeeWare va a realizar un sprint en
what_is_a_sprint = ¿Qué es un sprint?
sprint_description = Los sprints de código son eventos que se llevan a cabo normalmente después de una conferencia donde los asistentes pueden usar el lugar de la conferencia para trabajar en grupos pequeños en varios proyectos. Para obtener más información sobre cómo funcionan los sprints mira
sprint_pycon_video = el video de PyCon USA 'What is a sprint?'
sprint_description = Los sprints de código son eventos que se llevan a cabo normalmente después de una conferencia donde los asistentes pueden usar el lugar de la conferencia para trabajar en grupos pequeños en varios proyectos. Para obtener más información sobre cómo funcionan los sprints mira {{ pycon_link("el video de PyCon USA 'What is a sprint?'") }}.
challenge_coin = Moneda de desafío
date = Fecha
speakers = Conferencistas
Expand Down Expand Up @@ -657,8 +652,7 @@ past_events = Evénements passés
upcoming_events = Evénements à venir
running_sprint = BeeWare will be running a sprint at
what_is_a_sprint = What is a Sprint?
sprint_description = Code sprints are events held normally after a conference where attendees can use the conference venue to work in small groups on various projects. Learn more about how sprints work with the
sprint_pycon_video = PyCon US 'What is a sprint?' video
sprint_description = Code sprints are events held normally after a conference where attendees can use the conference venue to work in small groups on various projects. Learn more about how sprints work with the {{ pycon_link("PyCon US 'What is a sprint?' video") }}.
challenge_coin = Challenge Coin
date = Date
speakers = Speakers
Expand Down Expand Up @@ -769,8 +763,7 @@ past_events = Eventi passati
upcoming_events = Prossimi eventi
running_sprint = BeeWare eseguirà uno sprint a
what_is_a_sprint = Cos'è uno sprint?
sprint_description = Gli sprint in codice sono eventi che si tengono normalmente dopo una conferenza, dove i partecipanti possono utilizzare la sede della conferenza per lavorare in piccoli gruppi su vari progetti. Per saperne di più su come funzionano gli sprint con il
sprint_pycon_video = Video PyCon US 'Cos'è uno sprint?
sprint_description = Gli sprint in codice sono eventi che si tengono normalmente dopo una conferenza, dove i partecipanti possono utilizzare la sede della conferenza per lavorare in piccoli gruppi su vari progetti. Per saperne di più su come funzionano gli sprint con il {{ pycon_link("Video PyCon US 'Cos'è uno sprint?") }}.
challenge_coin = Challenge coin (moneta sfida)
data = Data
speakers = Relatori
Expand Down Expand Up @@ -881,8 +874,7 @@ past_events = Poprzednie wydarzenia
upcoming_events = Nadchodzące wydarzenia
running_sprint = BeeWare poprowadzi sprint na
what_is_a_sprint = Co to jest sprint?
sprint_description = Sprint to wydarzenie odbywające się zwykle po konferencji, na którym uczestnicy mogą popracować w małych grupach nad różnymi projektami. Dowiedz się więcej z
sprint_pycon_video = nagrania z PyCon US "Co to jest sprint?"
sprint_description = Sprint to wydarzenie odbywające się zwykle po konferencji, na którym uczestnicy mogą popracować w małych grupach nad różnymi projektami. Dowiedz się więcej z {{ pycon_link('nagrania z PyCon US "Co to jest sprint?"') }}.
challenge_coin = odznakę
date = Data
speakers = Prowadzący
Expand Down Expand Up @@ -1001,10 +993,7 @@ past_events = 过去的活动
upcoming_events = 即将到来的活动
running_sprint = BeeWare 将会举行一场冲刺
what_is_a_sprint = 什么是冲刺
sprint_description = 代码冲刺是通常在会议结束后举行的活动,与会者可以使用会议场地分组处理各种项目。用
sprint_pycon_video = PyCon US 什么是冲刺视频
; chinese-specific
post_sprint_pycon_video = 了解更多关于冲刺是如何工作的。
sprint_description = 代码冲刺是通常在会议结束后举行的活动,与会者可以使用会议场地分组处理各种项目。用{{ pycon_link("PyCon US 什么是冲刺视频") }}了解更多关于冲刺是如何工作的。
challenge_coin = 挑战币
date = 日期
speakers = 演讲者
Expand Down
23 changes: 18 additions & 5 deletions packages/lektor_beeware_plugin/lektor_beeware_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,33 @@
from datetime import date

from lektor.pluginsystem import Plugin
from jinja2 import pass_context
from jinja2 import pass_context, Template
from markupsafe import Markup


@pass_context
def translate(context, string, bag_name="translate"):
# Make sure that any macros which need to call this are imported with context.
alt = context["this"].alt
bag = context["bag"]
result = ""
if trans := bag(f"{bag_name}.{alt}.{string}"):
return trans
result = trans

if en := bag(f"{bag_name}.en.{string}"):
return en
if not result and (en := bag(f"{bag_name}.en.{string}")):
result = en

return ""
template = Template(result)

# Wrapping it in Markup() marks it as safe, so it won't be escaped.
return Markup(template.render(context))


def link_to(address):
def link_maker(text):
return f'<a href="{address}">{text}</a>'

return link_maker


class BeeWarePlugin(Plugin):
Expand All @@ -27,4 +39,5 @@ class BeeWarePlugin(Plugin):

def on_setup_env(self, **extra):
self.env.jinja_env.globals["today"] = date.today()
self.env.jinja_env.globals["link_to"] = link_to
self.env.jinja_env.filters["trans"] = translate
5 changes: 3 additions & 2 deletions templates/event.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
}
%}

{# Note: for some reason this has to be defined outside of the block it's needed in. #}
{% set pycon_link = link_to("https://www.youtube.com/watch?v=hOtKgFaFcz0") %}
{% set member_slugs = this.speaker %}
{% set members = site.query("/about/team") %}
{% set speaker_names = {} %}
Expand Down Expand Up @@ -54,8 +56,7 @@ <h1>{{ this.title }} ({{ this.event_type|title }})</h1>
</p>
<p>{{ "event_more_info"|trans }} <a href="{{ this.url }}">{{ this.title }} {{ "website"|trans }}</a>.</p>
<h3>{{ "what_is_a_sprint"|trans }}</h3>
{%- set post = "post_sprint_pycon_video"|trans %}
<p>{{ "sprint_description"|trans }} <a href="https://www.youtube.com/watch?v=hOtKgFaFcz0">{{ "sprint_pycon_video"|trans }}</a>{% if post %} {% endif %}{{ post }}.</p>
<p>{{ "sprint_description"|trans }}</p>
{% endif %}
<p><em>{{ this.description }}</em></p>
{% endblock %}
Expand Down