[gnome-keysign: 1/3] util: email in english alongside the translation
- From: Ludovico de Nittis <denittis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keysign: 1/3] util: email in english alongside the translation
- Date: Wed, 14 Nov 2018 18:08:24 +0000 (UTC)
commit d38e15d92a68086791d147cf2039d54c6313e08c
Author: RyuzakiKK <aasonykk gmail com>
Date: Tue Nov 13 18:00:05 2018 +0100
util: email in english alongside the translation
keysign/util.py | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/keysign/util.py b/keysign/util.py
index d7641ed..b38a8ea 100755
--- a/keysign/util.py
+++ b/keysign/util.py
@@ -203,8 +203,22 @@ def send_email(to, subject=None, body=None, files=None):
log.error("An error occurred trying to compose the email")
-SUBJECT = _('Your signed key $fingerprint')
-BODY = _('''Hi $uid,
+SUBJECT = 'Your signed key $fingerprint'
+BODY = '''Hi $uid,
+
+
+I have just signed your key
+
+ $fingerprint
+
+
+Thanks for letting me sign your key!
+
+--
+GNOME Keysign
+'''
+DIVIDER = '\n--------\nTranslated version below\n--------\n'
+BODY_TRANSLATED = _('''Hi $uid,
I have just signed your key
@@ -268,8 +282,13 @@ def sign_keydata_and_send(keydata, error_cb=None):
# resources. Calling tmpfile.close would get the file deleted.
tmpfile.file.close()
+ body = BODY
+ # If the primary language is not English we append the translation
+ if BODY != BODY_TRANSLATED:
+ body += DIVIDER + BODY_TRANSLATED
+
subject = Template(SUBJECT).safe_substitute(ctx)
- body = Template(BODY).safe_substitute(ctx)
+ body = Template(body).safe_substitute(ctx)
send_email(uid.email, subject, body, [filename])
yield tmpfile
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]