Repository: translate/pootle

Issue:
Translation of the Report Email
I would like to translate the words of the report email, if you could integrate this kind of template on the po file, it would be amazing... naturally title of the email included, which it would be `[(name-site)] Unit #(num) ((lang))`

```
Username: (username)
Current URL: (url)
IP address: (ip_address)
User-Agent: (user_agent)

Unit: (url_string)

Source: (source_string)

Current translation: 

Your question or comment:
```

Thx in advance ;)



Discussion:
I don't think this is a good idea. I can imagine some scenario where a klingon translator sends a report, and then the manager has trouble to understand what the translator reported. But perhaps I am going too far.

Why it should not to be a good idea?? The pootle adminastrator translates in the local language Username, Current URL, IP Address etc, so every admins that have access to the domain mail (eg report@domain.com) will read the report in the correct local language except for the source string :)

Emails should be translated in the preferred language of the receiver, not the sender. I believe the way Pootle currently works is it will use the language of the sender (and this is what Leandro is referring to and is trying to advise against).

That's fine for me, but still i don't get it... the report email is different from the confirmation email sent to the private email box of the user who registered... the report email is something sent to the admin email account which needs to be in the language of the receiver??? who's the receiver in this case??? it's just a domain name not related to any users registered, how can you tell report@domain.com wants the email in the local language, if it's not the sender to tell that???

Receiver of the message is the admin/manager. I, as a manager, don't want to get reports in random languages from different translators, when I only understand one or two languages. Since Pootle doesn't know what language manager is capable reading in, English is the next best option.

This is intentional, and others have already explained the reasoning behind this.

Ok, i got the point, but if all the admins are from the same country and they know that specific language??? I mean, my pootle server is intended only for italian people, my admin team is composed of italians and the email box is accessible for them... so i mean, you point the logic to multi-country people, but i intend only my country... at least give us this option :(

@JohnnyKing94 Then override https://github.com/translate/pootle/blob/285a7002d68ae05365b9036117ea050260451d54/pootle/templates/contact_form/contact_form.txt and https://github.com/translate/pootle/blob/63c5a1c0530536027d785485e39bb510a08e9beb/pootle/apps/contact/views.py#L21-L29 with your preferred translations.

Ok thank you, much appreciated :)

We could probably move https://github.com/translate/pootle/blob/63c5a1c0530536027d785485e39bb510a08e9beb/pootle/apps/contact/views.py#L21-L29 to a template file to allow easier overriding without anyone having to patch the source files.

I agree.


Resolving patch:
diff --git a/pootle/apps/contact/views.py b/pootle/apps/contact/views.py
--- a/pootle/apps/contact/views.py
+++ b/pootle/apps/contact/views.py
@@ -8,6 +8,7 @@
 # AUTHORS file for copyright and authorship information.
 
 from django.core.urlresolvers import reverse
+from django.template.loader import render_to_string
 from django.views.generic import TemplateView
 
 from contact_form.views import ContactFormView as OriginalContactFormView
@@ -17,18 +18,6 @@
 from .forms import ContactForm, ReportForm
 
 
-SUBJECT_TEMPLATE = 'Unit #%d (%s)'
-BODY_TEMPLATE = '''
-Unit: %s
-
-Source: %s
-
-Current translation: %s
-
-Your question or comment:
-'''
-
-
 class ContactFormTemplateView(TemplateView):
     template_name = 'contact_form/contact_form.html'
 
@@ -93,15 +82,18 @@ def get_initial(self):
                                 unit.get_translate_url()
                             )
                         initial.update({
-                            'subject': SUBJECT_TEMPLATE % (
-                                unit.id,
-                                unit.store.translation_project.language.code
-                            ),
-                            'body': BODY_TEMPLATE % (
-                                unit_absolute_url,
-                                unit.source,
-                                unit.target
-                            ),
+                            'subject': render_to_string(
+                                'contact_form/report_form_subject.txt', {
+                                    'unit': unit,
+                                    'language': unit.store \
+                                                    .translation_project \
+                                                    .language.code,
+                            }),
+                            'body': render_to_string(
+                                'contact_form/report_form_body.txt', {
+                                    'unit': unit,
+                                    'unit_absolute_url': unit_absolute_url,
+                            }),
                             'report_email': unit.store.translation_project \
                                                       .project.report_email,
                         })


Test patch: