We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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 ;)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pootle/apps/contact/views.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # Copyright (C) Pootle contributors.
5 #
6 # This file is a part of the Pootle project. It is distributed under the GPL3
7 # or later license. See the LICENSE file for a copy of the license and the
8 # AUTHORS file for copyright and authorship information.
9 
10 from django.core.urlresolvers import reverse
11 from django.views.generic import TemplateView
12 
13 from contact_form.views import ContactFormView as OriginalContactFormView
14 
15 from pootle.core.views import AjaxResponseMixin
16 
17 from .forms import ContactForm, ReportForm
18 
19 
20 SUBJECT_TEMPLATE = 'Unit #%d (%s)'
21 BODY_TEMPLATE = '''
22 Unit: %s
23 
24 Source: %s
25 
26 Current translation: %s
27 
28 Your question or comment:
29 '''
30 
31 
32 class ContactFormTemplateView(TemplateView):
33     template_name = 'contact_form/contact_form.html'
34 
35 
36 class ContactFormView(AjaxResponseMixin, OriginalContactFormView):
37     form_class = ContactForm
38     template_name = 'contact_form/xhr_contact_form.html'
39 
40     def get_context_data(self, **kwargs):
41         ctx = super(ContactFormView, self).get_context_data(**kwargs)
42         # Provide the form action URL to use in the template that renders the
43         # contact dialog.
44         ctx.update({
45             'contact_form_url': reverse('pootle-contact-xhr'),
46         })
47         return ctx
48 
49     def get_initial(self):
50         initial = super(ContactFormView, self).get_initial()
51 
52         user = self.request.user
53         if user.is_authenticated():
54             initial.update({
55                 'name': user.full_name,
56                 'email': user.email,
57             })
58 
59         return initial
60 
61     def get_success_url(self):
62         # XXX: This is unused. We don't need a `/contact/sent/` URL, but
63         # the parent :cls:`ContactView` enforces us to set some value here
64         return reverse('pootle-contact')
65 
66 
67 class ReportFormView(ContactFormView):
68     form_class = ReportForm
69 
70     def get_context_data(self, **kwargs):
71         ctx = super(ReportFormView, self).get_context_data(**kwargs)
72         # Provide the form action URL to use in the template that renders the
73         # contact dialog.
74         ctx.update({
75             'contact_form_url': reverse('pootle-contact-report-error'),
76         })
77         return ctx
78 
79     def get_initial(self):
80         initial = super(ReportFormView, self).get_initial()
81 
82         report = self.request.GET.get('report', False)
83         if report:
84             try:
85                 from pootle_store.models import Unit
86                 uid = int(report)
87                 try:
88                     unit = Unit.objects.select_related(
89                         'store__translation_project__project',
90                     ).get(id=uid)
91                     if unit.is_accessible_by(self.request.user):
92                         unit_absolute_url = self.request.build_absolute_uri(
93                                 unit.get_translate_url()
94                             )
95                         initial.update({
96                             'subject': SUBJECT_TEMPLATE % (
97                                 unit.id,
98                                 unit.store.translation_project.language.code
99                             ),
100                             'body': BODY_TEMPLATE % (
101                                 unit_absolute_url,
102                                 unit.source,
103                                 unit.target
104                             ),
105                             'report_email': unit.store.translation_project \
106                                                       .project.report_email,
107                         })
108                 except Unit.DoesNotExist:
109                     pass
110             except ValueError:
111                 pass
112 
113         return initial
114
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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 @@
                                 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,
                         })

{"golden_diff": "diff --git a/pootle/apps/contact/views.py b/pootle/apps/contact/views.py\n--- a/pootle/apps/contact/views.py\n+++ b/pootle/apps/contact/views.py\n@@ -8,6 +8,7 @@\n # AUTHORS file for copyright and authorship information.\n \n from django.core.urlresolvers import reverse\n+from django.template.loader import render_to_string\n from django.views.generic import TemplateView\n \n from contact_form.views import ContactFormView as OriginalContactFormView\n@@ -17,18 +18,6 @@\n from .forms import ContactForm, ReportForm\n \n \n-SUBJECT_TEMPLATE = 'Unit #%d (%s)'\n-BODY_TEMPLATE = '''\n-Unit: %s\n-\n-Source: %s\n-\n-Current translation: %s\n-\n-Your question or comment:\n-'''\n-\n-\n class ContactFormTemplateView(TemplateView):\n     template_name = 'contact_form/contact_form.html'\n \n@@ -93,15 +82,18 @@\n                                 unit.get_translate_url()\n                             )\n                         initial.update({\n-                            'subject': SUBJECT_TEMPLATE % (\n-                                unit.id,\n-                                unit.store.translation_project.language.code\n-                            ),\n-                            'body': BODY_TEMPLATE % (\n-                                unit_absolute_url,\n-                                unit.source,\n-                                unit.target\n-                            ),\n+                            'subject': render_to_string(\n+                                'contact_form/report_form_subject.txt', {\n+                                    'unit': unit,\n+                                    'language': unit.store \\\n+                                                    .translation_project \\\n+                                                    .language.code,\n+                            }),\n+                            'body': render_to_string(\n+                                'contact_form/report_form_body.txt', {\n+                                    'unit': unit,\n+                                    'unit_absolute_url': unit_absolute_url,\n+                            }),\n                             'report_email': unit.store.translation_project \\\n                                                       .project.report_email,\n                         })\n", "issue": "Translation of the Report Email\nI 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))`\n\n```\nUsername: (username)\nCurrent URL: (url)\nIP address: (ip_address)\nUser-Agent: (user_agent)\n\nUnit: (url_string)\n\nSource: (source_string)\n\nCurrent translation: \n\nYour question or comment:\n```\n\nThx in advance ;)\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nfrom django.core.urlresolvers import reverse\nfrom django.views.generic import TemplateView\n\nfrom contact_form.views import ContactFormView as OriginalContactFormView\n\nfrom pootle.core.views import AjaxResponseMixin\n\nfrom .forms import ContactForm, ReportForm\n\n\nSUBJECT_TEMPLATE = 'Unit #%d (%s)'\nBODY_TEMPLATE = '''\nUnit: %s\n\nSource: %s\n\nCurrent translation: %s\n\nYour question or comment:\n'''\n\n\nclass ContactFormTemplateView(TemplateView):\n    template_name = 'contact_form/contact_form.html'\n\n\nclass ContactFormView(AjaxResponseMixin, OriginalContactFormView):\n    form_class = ContactForm\n    template_name = 'contact_form/xhr_contact_form.html'\n\n    def get_context_data(self, **kwargs):\n        ctx = super(ContactFormView, self).get_context_data(**kwargs)\n        # Provide the form action URL to use in the template that renders the\n        # contact dialog.\n        ctx.update({\n            'contact_form_url': reverse('pootle-contact-xhr'),\n        })\n        return ctx\n\n    def get_initial(self):\n        initial = super(ContactFormView, self).get_initial()\n\n        user = self.request.user\n        if user.is_authenticated():\n            initial.update({\n                'name': user.full_name,\n                'email': user.email,\n            })\n\n        return initial\n\n    def get_success_url(self):\n        # XXX: This is unused. We don't need a `/contact/sent/` URL, but\n        # the parent :cls:`ContactView` enforces us to set some value here\n        return reverse('pootle-contact')\n\n\nclass ReportFormView(ContactFormView):\n    form_class = ReportForm\n\n    def get_context_data(self, **kwargs):\n        ctx = super(ReportFormView, self).get_context_data(**kwargs)\n        # Provide the form action URL to use in the template that renders the\n        # contact dialog.\n        ctx.update({\n            'contact_form_url': reverse('pootle-contact-report-error'),\n        })\n        return ctx\n\n    def get_initial(self):\n        initial = super(ReportFormView, self).get_initial()\n\n        report = self.request.GET.get('report', False)\n        if report:\n            try:\n                from pootle_store.models import Unit\n                uid = int(report)\n                try:\n                    unit = Unit.objects.select_related(\n                        'store__translation_project__project',\n                    ).get(id=uid)\n                    if unit.is_accessible_by(self.request.user):\n                        unit_absolute_url = self.request.build_absolute_uri(\n                                unit.get_translate_url()\n                            )\n                        initial.update({\n                            'subject': SUBJECT_TEMPLATE % (\n                                unit.id,\n                                unit.store.translation_project.language.code\n                            ),\n                            'body': BODY_TEMPLATE % (\n                                unit_absolute_url,\n                                unit.source,\n                                unit.target\n                            ),\n                            'report_email': unit.store.translation_project \\\n                                                      .project.report_email,\n                        })\n                except Unit.DoesNotExist:\n                    pass\n            except ValueError:\n                pass\n\n        return initial\n", "path": "pootle/apps/contact/views.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nfrom django.core.urlresolvers import reverse\nfrom django.template.loader import render_to_string\nfrom django.views.generic import TemplateView\n\nfrom contact_form.views import ContactFormView as OriginalContactFormView\n\nfrom pootle.core.views import AjaxResponseMixin\n\nfrom .forms import ContactForm, ReportForm\n\n\nclass ContactFormTemplateView(TemplateView):\n    template_name = 'contact_form/contact_form.html'\n\n\nclass ContactFormView(AjaxResponseMixin, OriginalContactFormView):\n    form_class = ContactForm\n    template_name = 'contact_form/xhr_contact_form.html'\n\n    def get_context_data(self, **kwargs):\n        ctx = super(ContactFormView, self).get_context_data(**kwargs)\n        # Provide the form action URL to use in the template that renders the\n        # contact dialog.\n        ctx.update({\n            'contact_form_url': reverse('pootle-contact-xhr'),\n        })\n        return ctx\n\n    def get_initial(self):\n        initial = super(ContactFormView, self).get_initial()\n\n        user = self.request.user\n        if user.is_authenticated():\n            initial.update({\n                'name': user.full_name,\n                'email': user.email,\n            })\n\n        return initial\n\n    def get_success_url(self):\n        # XXX: This is unused. We don't need a `/contact/sent/` URL, but\n        # the parent :cls:`ContactView` enforces us to set some value here\n        return reverse('pootle-contact')\n\n\nclass ReportFormView(ContactFormView):\n    form_class = ReportForm\n\n    def get_context_data(self, **kwargs):\n        ctx = super(ReportFormView, self).get_context_data(**kwargs)\n        # Provide the form action URL to use in the template that renders the\n        # contact dialog.\n        ctx.update({\n            'contact_form_url': reverse('pootle-contact-report-error'),\n        })\n        return ctx\n\n    def get_initial(self):\n        initial = super(ReportFormView, self).get_initial()\n\n        report = self.request.GET.get('report', False)\n        if report:\n            try:\n                from pootle_store.models import Unit\n                uid = int(report)\n                try:\n                    unit = Unit.objects.select_related(\n                        'store__translation_project__project',\n                    ).get(id=uid)\n                    if unit.is_accessible_by(self.request.user):\n                        unit_absolute_url = self.request.build_absolute_uri(\n                                unit.get_translate_url()\n                            )\n                        initial.update({\n                            'subject': render_to_string(\n                                'contact_form/report_form_subject.txt', {\n                                    'unit': unit,\n                                    'language': unit.store \\\n                                                    .translation_project \\\n                                                    .language.code,\n                            }),\n                            'body': render_to_string(\n                                'contact_form/report_form_body.txt', {\n                                    'unit': unit,\n                                    'unit_absolute_url': unit_absolute_url,\n                            }),\n                            'report_email': unit.store.translation_project \\\n                                                      .project.report_email,\n                        })\n                except Unit.DoesNotExist:\n                    pass\n            except ValueError:\n                pass\n\n        return initial\n", "path": "pootle/apps/contact/views.py"}]}