Skip to content

added babel for messages extraction #509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions babel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[jinja2: **/templates/**.txt]
encoding = utf-8
trimmed = true

[jinja2: **/templates/**.html]
encoding = utf-8
trimmed = true
5 changes: 4 additions & 1 deletion newdle/templates/base_email.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
<tr>
<td style="text-align: center; color: #aaa; font-size: 11px; padding-bottom: 10px;">
<p style="padding: 0 50px; margin-top: 10px;">
This email was sent by <a href="{{ url_for('index', _external=true) }}">newdle</a>.
{% set newdle_link -%}
<a href="{{ url_for('index', _external=true) }}">newdle</a>
{%- endset %}
{% trans %}This email was sent by {{ newdle_link }}.{% endtrans %}
</p>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion newdle/templates/base_email.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{%- endfilter %}

--
This email was sent by newdle
{% trans %}This email was sent by newdle{% endtrans %}
{{ url_for('index', _external=true) }}
6 changes: 3 additions & 3 deletions newdle/templates/deletion_email.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

{% block content %}
<p>
Hi {{ participant }}
{% trans %}Hi {{ participant }}{% endtrans %}
</p>

<table border="0" cellpadding="0" cellspacing="0"
style="padding: 20px; margin: 35px auto 0 auto; border-radius: 5px; background: #ffe6e8; min-width: 550px;">
<tr>
<td style="border: 0; padding: 0 0 0 20px; text-align: left;">
<p>
<b>{{ creator }}</b> has deleted the newdle "<b>{{ title }}</b>".
{% trans %}<b>{{ creator }}</b> has deleted the newdle "<b>{{ title }}</b>".{% endtrans %}
</p>
{% if comment %}
<p>
<br>
<b>Comment</b>
{% trans %}<b>Comment</b>{% endtrans %}
<br>
{{ comment }}
</p>
Expand Down
4 changes: 3 additions & 1 deletion newdle/templates/deletion_email.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{% extends 'base_email.txt' %}
{% block content -%}
{% trans %}
Hi {{ participant }},

{{ creator }} has deleted the newdle "{{ title }}".
{% endtrans %}

{%- if comment %}

Comment: {{ comment }}
{% trans %}Comment: {{ comment }}{% endtrans %}
{%- endif -%}
{%- endblock %}
8 changes: 4 additions & 4 deletions newdle/templates/invitation_email.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

{% block content %}
<p>
Hi {{ participant }}, you have a fresh newdle!
{% trans %}Hi {{ participant }}, you have a fresh newdle!{% endtrans %}
</p>

<table border="0" cellpadding="0" cellspacing="0"
style="padding: 20px; margin: 35px auto 0 auto; border-radius: 5px; background: #ffe6e8; min-width: 550px;">
<tr>
<td style="border: 0; padding: 0 0 0 20px; text-align: left;">
<p>
Please help <b>{{ creator }}</b> choose a time for the event "<b>{{ title }}</b>".
{% trans %}Please help <b>{{ creator }}</b> choose a time for the event "<b>{{ title }}</b>".{% endtrans %}
</p>
</td>
</tr>
</table>
<p style="margin: 30px 0 15px">
<a href="{{ answer_link }}"
style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none; text-decoration: none;">
Go to the newdle to respond
{% trans %}Go to the newdle to respond{% endtrans %}
</a>
</p>
<p style="margin-top: 30px; font-size: 12px;">
The link above is personalized for you; please do not forward/share it.
{% trans %}The link above is personalized for you; please do not forward/share it.{% endtrans %}
</p>
{% endblock %}
2 changes: 2 additions & 0 deletions newdle/templates/invitation_email.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{% extends 'base_email.txt' %}
{% block content -%}
{% trans %}
Hi {{ participant }},

Please help {{ creator }} choose a time for the event
"{{ title }}".

Respond to their newdle poll now using this personalized link:
{{ answer_link }}
{% endtrans %}
{%- endblock %}
6 changes: 3 additions & 3 deletions newdle/templates/login_result.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Login · newdle</title>
<title>{% trans %}Login · newdle{% endtrans %}</title>
</head>
<body>
{% if payload.error %}
Login failed: <code>{{ payload.error }}</code>
{% trans %}Login failed:{% endtrans %} <code>{{ payload.error }}</code>
{% else %}
Login successful! You may now close this window.
{% trans %}Login successful! You may now close this window.{% endtrans %}
{% endif %}
<script>
if (window.opener) {
Expand Down
14 changes: 7 additions & 7 deletions newdle/templates/replied_email.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@

{% block content %}
<p>
Hi {{ creator }}
{% trans %}Hi {{ creator }}{% endtrans %}
</p>
<p>
<b>{{ participant }}</b> replied to "<b>{{ title }}</b>".
{% trans %}<b>{{ participant }}</b> replied to "<b>{{ title }}</b>".{% endtrans %}
</p>

<table border="0" cellpadding="0" cellspacing="0"
style="padding: 20px; margin: 35px auto 0 auto; border-radius: 5px; background: #ffe6e8; min-width: 550px;">
<tr>
<td style="border: 0; padding: 0 0 0 20px; text-align: left;">
{% if answers %}
<p><b>Available dates:</b></p>
<p><b>{% trans %}Available dates:{% endtrans %}</b></p>
<ul>
{% for slot, ifneedbe in answers -%}
<li>
{{- slot.strftime('%d/%m/%Y, %H:%M') -}}
{%- if ifneedbe %} (if needed){% endif %}
{%- if ifneedbe %} {% trans %}(if needed){% endtrans %}{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<p><b>Not available</b> at any of the dates.</p>
<p>{% trans %}<b>Not available</b> at any of the dates.{% endtrans %}</p>
{% endif %}
{% if comment %}
<p>
<br>
<b>Comment</b>
<b>{% trans %}Comment{% endtrans %}</b>
<br>
{{ comment }}
</p>
Expand All @@ -40,7 +40,7 @@
<p style="margin: 30px 0 15px">
<a href="{{ summary_link }}"
style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none; text-decoration: none;">
View all results for your newdle
{% trans %}View all results for your newdle{% endtrans %}
</a>
</p>
{% endblock %}
16 changes: 8 additions & 8 deletions newdle/templates/replied_email.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,40 @@ that the empty lines are consistent:

{%- macro render_message() -%}
{%- if update -%}
{{ participant }} updated their answer for "{{ title }}".
{% trans %}{{ participant }} updated their answer for "{{ title }}".{% endtrans %}
{%- else -%}
{{ participant }} replied to "{{ title }}".
{% trans %}{{ participant }} replied to "{{ title }}".{% endtrans %}
{%- endif -%}
{%- endmacro -%}

{%- macro render_comment() -%}
{%- if comment %}

Comment: {{ comment }}
{% trans %}Comment: {{ comment }}{% endtrans %}
{%- endif -%}
{%- endmacro -%}

{%- macro render_availability() -%}
{%- if answers -%}
Available dates:
{% trans %}Available dates:{% endtrans %}
{%- for slot, ifneedbe in answers %}
- {{ slot.strftime('%d/%m/%Y, %H:%M') -}}
{%- if ifneedbe %} (if needed){% endif -%}
{%- if ifneedbe %} {% trans %}(if needed){% endtrans %}{% endif -%}
{%- endfor -%}
{%- else -%}
Not available at any of the dates.
{% trans %}Not available at any of the dates.{% endtrans %}
{%- endif -%}
{%- endmacro -%}


{% block content -%}
Hi {{ creator }},
{% trans %}Hi {{ creator }},{% endtrans %}

{{ render_message() }}

{{ render_availability() -}}
{{- render_comment() }}

Check all results on the summary page:
{% trans %}Check all results on the summary page:{% endtrans %}
{{ summary_link }}
{%- endblock %}
6 changes: 3 additions & 3 deletions newdle/templates/result_email.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

{% block content %}
<p>
Hi {{ participant }}
{% trans %}Hi {{ participant }}{% endtrans %}
</p>

<table border="0" cellpadding="0" cellspacing="0"
style="padding: 20px; margin: 35px auto 0 auto; border-radius: 5px; background: #ffe6e8; min-width: 550px;">
<tr>
<td style="border: 0; padding: 0;">
<p>
<b>{{ creator }}</b> has chosen a final date for "<b>{{ title }}</b>":
{% trans %}<b>{{ creator }}</b> has chosen a final date for "<b>{{ title }}</b>":{% endtrans %}
</p>
<p style="text-align: center; font-size: 19px;">
<i>
Expand All @@ -25,7 +25,7 @@
<p style="margin: 30px 0 15px">
<a href="{{ newdle_link }}"
style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none; text-decoration: none;">
Go to the newdle
{% trans %}Go to the newdle{% endtrans %}
</a>
</p>
{% endblock %}
2 changes: 2 additions & 0 deletions newdle/templates/result_email.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{% extends 'base_email.txt' %}
{% block content -%}
{% trans %}
Hi {{ participant }},

{{ creator }} picked a final date for the event "{{ title }}".

It will take place on:
{{ date }}
{{ start_time }} - {{ end_time }} ({{ timezone }})
{% endtrans %}
{%- endblock %}
6 changes: 3 additions & 3 deletions newdle/templates/result_email_limited_slots.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

{% block content %}
<p>
Hi {{ participant }}
{% trans %}Hi {{ participant }}{% endtrans %}
</p>

<table border="0" cellpadding="0" cellspacing="0"
style="padding: 20px; margin: 35px auto 0 auto; border-radius: 5px; background: #ffe6e8; min-width: 550px;">
<tr>
<td style="border: 0; padding: 0;">
<p>
<b>{{ creator }}</b> confirmed your answer for the event "<b>{{ title }}</b>":
{% trans %}<b>{{ creator }}</b> confirmed your answer for the event "<b>{{ title }}</b>":{% endtrans %}
</p>
<p style="text-align: center; font-size: 19px;">
<i>
Expand All @@ -25,7 +25,7 @@
<p style="margin: 30px 0 15px">
<a href="{{ newdle_link }}"
style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none; text-decoration: none;">
Go to the newdle
{% trans %}Go to the newdle{% endtrans %}
</a>
</p>
{% endblock %}
2 changes: 2 additions & 0 deletions newdle/templates/result_email_limited_slots.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{% extends 'base_email.txt' %}
{% block content -%}
{% trans %}
Hi {{ participant }},

{{ creator }} confirmed your answer for the event "{{ title }}".

Your chosen timeslot is:
{{ date }}
{{ start_time }} - {{ end_time }} ({{ timezone }})
{% endtrans %}
{%- endblock %}
Loading
Loading