-
-
Notifications
You must be signed in to change notification settings - Fork 954
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
feat: Translation preparation for fundraising app #1687
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plaintext files need to be handled a bit differently since spaces and newlines there are significant (unlike in HTML).
Localization is hard work, isn't it? 😁
djangoproject/templates/fundraising/includes/display_django_heroes.html
Outdated
Show resolved
Hide resolved
DSF via payroll deduction.</li> | ||
<li> | ||
{% blocktranslate trimmed %} | ||
<a href="https://django.threadless.com/" target="_blank">Official merchandise store</a> - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope for this PR, but I wonder if this is a problem with a known solution:
with the current translation infrastructure, translators have the power to do some significant (and potentially malicious) modifications to the HTML like changing the href
or even injecting a <script>
tag.
Are there tools that can help with that, or is that something that needs to be verified by hand for each language/string?
@bmispelon Ok, I think I've addressed all the issues here - thanks for another review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's still an issue with plaintext templates: the { %blocktranslate %}
are inserting extra new lines.
Here's the code I used to test this:
from django.template import loader
print(loader.get_template("fundraising/email/payment_failed.txt").render({"donation":{"donor": {"pk": 1234, "name_with_fallback": "TEST"}}}))
If you run this code on main
vs. marksweb:feat/i18n-fundraising/1648
you'll see extra blank lines between paragraphs. Ideally, the output should be identical.
@bmispelon Ah yes, apologies - didn't realise that I've corrected the 3 email templates - though we are adding a blank line at the end of files so there is that still.
|
@@ -1,10 +1,15 @@ | |||
Hi {{ donation.donor.name_with_fallback }}, | |||
{% load i18n %}{% spaceless %}{% url 'fundraising:manage-donations' donation.donor.pk as manage_url %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever use of spaceless
👍🏻
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
This adds translations tags to the fundraising app as suggested in #1648