Repository: fossasia/open-event-server

Issue:
Translations issues second part
Incomplete sentences
- has just scheduled
- on %(app_name)s.
- of your account
- of your account.
- Late payments can be subject to a
- finance fee.
- This is an automatic email from %(app_name)s for organizers of the
- Your
- has received a new session proposal with the following details
- You can view all speaker details on the speaker profile page and the session proposal on the
- To change the status of sessions please go to the
- and click on the status badge of the session.
- Or paste this token in your


No full stop
- You can unsubscribe from emails from this group by unfollowing the group
- You have been invited as a speaker for the session submission "%(session_title)s" for the event

Wrong sentence - what is the real meaning?
- Click on the following link to manage your event

Change "eventyay" with "app name"
- The invoice for your event %(event_name)s on eventyay.com for %(date)s is now available.


Discussion:
- https://stackoverflow.com/questions/35220207/using-links-with-babel-in-jinja2?rq=1
- https://stackoverflow.com/questions/37598729/with-jinja2-and-babel-how-do-i-translate-sentences-containing-html-tags/42026259#42026259
These sentences are completely missing:

* You can download your 
* Please login to the platform to access the video room on the event page

![Screenshot from 2021-10-29 13-52-06](https://user-images.githubusercontent.com/1583873/139429758-d1c8bd4d-bd4a-4c42-8872-b299810f6e40.png)

the first string `You can download your`, i have added the url to the string, so it's complete now. See [this](https://github.com/fossasia/open-event-server/blob/f3d4dfff70f2d526a12516f1ed48f9484975373c/app/templates/email/ticket_purchased.html#L3)

the second string is not in templates. It is added from a python file
How to get the translations from the Python files? A lot of system emails are still missing too.
I would need to make strings in python files translatable. Which system mails are missing??
Please check other system emails here:
https://github.com/fossasia/open-event-server/blob/6295f65d1f1a6aad55e62a58d95c197c3ba88233/app/api/helpers/system_mails.py

Please also substitute "Eventyay" with "app name".
https://github.com/fossasia/open-event-server/blob/6295f65d1f1a6aad55e62a58d95c197c3ba88233/app/templates/email/after_event.html
@mariobehling The system mails are missing from where?? All of them are there only.
Are they in the PO files and can be translated?

Yes @mariobehling 
I have made every URL part of the translatable string in every template
I was searching for strings from https://github.com/fossasia/open-event-server/blob/6295f65d1f1a6aad55e62a58d95c197c3ba88233/app/api/helpers/system_mails.py in weblate and cannot find them.

![Screenshot from 2021-10-29 15-34-11](https://user-images.githubusercontent.com/1583873/139444528-ee8dd9b0-a410-481d-9797-a4e15eb8dd1b.png)

For example, where are the strings for this email? Where can this be translated?

```
        },
        'canceled': {
            'subject': 'Canceled! Your submission for {event_name} titled {session_name} has been Canceled',
            'message': "Hello,<br/><br/>"
            "This is an automatic message from {app_name}.<br/><br/>"
            "Your session status for the submission {session_name} for {event_name} was changed to \"Canceled\".<br/><br/>"
            "The status change was done by event organizers. If there are questions about this change please contact the organizers.<br/><br/>"
            "You can also check the status and details of your submission on the session page {session_cfs_link}. You need to be logged in to view it.<br/><br/>"
            "More details about the event are on the event page at {event_link}.<br/><br/>"
            "Thank you.<br/>"
            "{frontend_link}",
        },
```
This will need changes in the python file. I will do that.
I am going to make the subjects and rest of the system mails translatable in this PR only. This https://github.com/fossasia/open-event-server/issues/8293#issuecomment-954579140 will be done in this PR too.

So, all the translations are at one place and weblate doesn't show merge conflicts when translations come from different PRs.
There is still a string `Thank you for using the Eventyay platform for your event.` here https://github.com/fossasia/open-event-server/blob/1897a2990a789f5715d7891892b1e8f42ea56d13/app/templates/email/after_event.html. Please also change this one using "app name".

Resolving patch:
diff --git a/app/api/helpers/mail.py b/app/api/helpers/mail.py
--- a/app/api/helpers/mail.py
+++ b/app/api/helpers/mail.py
@@ -750,6 +750,7 @@ def send_email_to_moderator(video_stream_moderator):
 
 
 def send_email_after_event(email, event_name):
+    app_name = get_settings()['app_name']
     action = MailType.AFTER_EVENT
     mail = MAILS[action]
 
@@ -759,6 +760,7 @@ def send_email_after_event(email, event_name):
         subject=mail['subject'].format(event_name=event_name),
         html=render_template(
             mail['template'],
+            app_name=app_name,
             email=email,
             eventname=event_name,
         ),


Test patch: