Commit a34cff7f authored by Michal Čihař's avatar Michal Čihař

Simplify passing site title to the mail templates

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent b66cbb00
...@@ -41,7 +41,7 @@ from weblate.trans.models import Project, Change, Unit ...@@ -41,7 +41,7 @@ from weblate.trans.models import Project, Change, Unit
from weblate.trans.util import get_site_url, get_distinct_translations from weblate.trans.util import get_site_url, get_distinct_translations
from weblate.accounts.avatar import get_user_display from weblate.accounts.avatar import get_user_display
import weblate import weblate
from weblate.appsettings import ANONYMOUS_USER_NAME from weblate.appsettings import ANONYMOUS_USER_NAME, SITE_TITLE
def notify_merge_failure(subproject, error, status): def notify_merge_failure(subproject, error, status):
...@@ -215,6 +215,7 @@ def send_notification_email(language, email, notification, ...@@ -215,6 +215,7 @@ def send_notification_email(language, email, notification,
translation_obj.get_absolute_url() translation_obj.get_absolute_url()
) )
context['subject_template'] = subject_template context['subject_template'] = subject_template
context['site_title'] = SITE_TITLE
# Render subject # Render subject
subject = render_to_string(subject_template, context).strip() subject = render_to_string(subject_template, context).strip()
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</p> </p>
<p> <p>
{% blocktrans with site|site_title as site_title %}This is an automatic email to help you complete your registration with {{ site_title }}.{% endblocktrans %} {% blocktrans %}This is an automatic email to help you complete your registration with {{ site_title }}.{% endblocktrans %}
</p> </p>
<p> <p>
......
{% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %} {% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %}
{% blocktrans with site|site_title as site_title %}This is an automatic email to help you complete your registration with {{ site_title }}.{% endblocktrans %} {% blocktrans %}This is an automatic email to help you complete your registration with {{ site_title }}.{% endblocktrans %}
{% blocktrans %}Please open the following link in your web browser. If the link is split over several lines, you may need to copy it in the address bar.{% endblocktrans %} {% blocktrans %}Please open the following link in your web browser. If the link is split over several lines, you may need to copy it in the address bar.{% endblocktrans %}
......
{% load i18n %}{% load translations %}{% blocktrans with site|site_title as site_title %}Your registration on {{ site_title }}{% endblocktrans %} {% load i18n %}{% load translations %}{% blocktrans %}Your registration on {{ site_title }}{% endblocktrans %}
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</p> </p>
<p> <p>
{% blocktrans with site|site_title as site_title %}there has been a change in translation on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there has been a change in translation on {{ translation }} at {{ site_title }}.{% endblocktrans %}
</p> </p>
<table> <table>
......
{% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{%trans "Hi,"%} {% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{%trans "Hi,"%}
{% blocktrans with site|site_title as site_title %}there has been a change in translation on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there has been a change in translation on {{ translation }} at {{ site_title }}.{% endblocktrans %}
{% trans "Source string:" %} {% trans "Source string:" %}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</p> </p>
<p> <p>
{% blocktrans with site|site_title as site_title %}there has been a merge failure on {{ subproject }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there has been a merge failure on {{ subproject }} at {{ site_title }}.{% endblocktrans %}
<p> <p>
......
{% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %} {% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %}
{% blocktrans with site|site_title as site_title %}there has been a merge failure on {{ subproject }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there has been a merge failure on {{ subproject }} at {{ site_title }}.{% endblocktrans %}
{% trans "Error message:" %} {% trans "Error message:" %}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</p> </p>
<p> <p>
{% blocktrans with site|site_title as site_title %}there has been a new comment on {{ subproject }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there has been a new comment on {{ subproject }} at {{ site_title }}.{% endblocktrans %}
</p> </p>
<table> <table>
......
{% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %} {% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %}
{% blocktrans with site|site_title as site_title %}there has been a new comment on {{ subproject }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there has been a new comment on {{ subproject }} at {{ site_title }}.{% endblocktrans %}
{% trans "Source string:" %} {% trans "Source string:" %}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</p> </p>
<p> <p>
{% blocktrans with site|site_title as site_title and user.first_name as username %}{{ username }} has just made a first contribution on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans and user.first_name as username %}{{ username }} has just made a first contribution on {{ translation }} at {{ site_title }}.{% endblocktrans %}
<p> <p>
{% include "mail/footer.html" %} {% include "mail/footer.html" %}
......
{% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %} {% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %}
{% blocktrans with site|site_title as site_title and user.first_name as username %}{{ username }} has just made a first contribution on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans and user.first_name as username %}{{ username }} has just made a first contribution on {{ translation }} at {{ site_title }}.{% endblocktrans %}
{% endfilter%}{% endautoescape %}{% include "mail/footer.txt" %} {% endfilter%}{% endautoescape %}{% include "mail/footer.txt" %}
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</p> </p>
<p> <p>
{% blocktrans with site|site_title as site_title %}there has been a request for new language on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there has been a request for new language on {{ translation }} at {{ site_title }}.{% endblocktrans %}
</p> </p>
<table> <table>
......
{% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %} {% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %}
{% blocktrans with site|site_title as site_title %}there has been a request for new language on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there has been a request for new language on {{ translation }} at {{ site_title }}.{% endblocktrans %}
{% trans "Requested language:" %} {% trans "Requested language:" %}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</p> </p>
<p> <p>
{% blocktrans with site|site_title as site_title %}there are new strings to translate on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there are new strings to translate on {{ translation }} at {{ site_title }}.{% endblocktrans %}
<p> <p>
{% include "mail/footer.html" %} {% include "mail/footer.html" %}
......
{% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %} {% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %}
{% blocktrans with site|site_title as site_title %}there are new strings to translate on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there are new strings to translate on {{ translation }} at {{ site_title }}.{% endblocktrans %}
{% endfilter%}{% endautoescape %}{% include "mail/footer.txt" %} {% endfilter%}{% endautoescape %}{% include "mail/footer.txt" %}
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</p> </p>
<p> <p>
{% blocktrans with site|site_title as site_title %}there is a new suggestion to evaluate on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there is a new suggestion to evaluate on {{ translation }} at {{ site_title }}.{% endblocktrans %}
<p> <p>
<table> <table>
......
{% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %} {% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %}
{% blocktrans with site|site_title as site_title %}there is a new suggestion to evaluate on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there is a new suggestion to evaluate on {{ translation }} at {{ site_title }}.{% endblocktrans %}
{% trans "Source string:" %} {% trans "Source string:" %}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</p> </p>
<p> <p>
{% blocktrans with site|site_title as site_title %}there has been a new translation on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there has been a new translation on {{ translation }} at {{ site_title }}.{% endblocktrans %}
</p> </p>
<table> <table>
......
{% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %} {% load url from future %}{% load i18n %}{% load translations %}{% autoescape off %}{% filter wordwrap:72 %}{% trans "Hi," %}
{% blocktrans with site|site_title as site_title %}there has been a new translation on {{ translation }} at {{ site_title }}.{% endblocktrans %} {% blocktrans %}there has been a new translation on {{ translation }} at {{ site_title }}.{% endblocktrans %}
{% trans "Source string:" %} {% trans "Source string:" %}
......
...@@ -183,15 +183,6 @@ def fmtsourcediff(value, other): ...@@ -183,15 +183,6 @@ def fmtsourcediff(value, other):
return fmttranslation(other.source, diff=value) return fmttranslation(other.source, diff=value)
@register.filter
@stringfilter
def site_title(value):
'''
Returns site title
'''
return appsettings.SITE_TITLE
@register.simple_tag @register.simple_tag
def check_name(check): def check_name(check):
''' '''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment