[tor-commits] [gettor/master] Fixing differences between language codes and locales

hiro at torproject.org hiro at torproject.org
Wed May 22 17:44:22 UTC 2019


commit 1089ebf1cd3af9ab83bd3fa64cca981b53a7b2c0
Author: hiro <hiro at torproject.org>
Date:   Wed May 22 19:44:19 2019 +0200

    Fixing differences between language codes and locales
---
 gettor/services/email/sendmail.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/gettor/services/email/sendmail.py b/gettor/services/email/sendmail.py
index 28d9b2d..52b50f5 100644
--- a/gettor/services/email/sendmail.py
+++ b/gettor/services/email/sendmail.py
@@ -157,30 +157,34 @@ class Sendmail(object):
 
                 for request in link_requests:
                     id = request[0]
-                    date = request[4]
+                    date = request[5]
                     platform = request[2]
                     language = request[3]
 
                     if not language:
                         language = 'en'
 
+                    locales = { 'en': 'en-US',
+                                'es': 'es-ES',
+                                'pt': 'pt-BR'}
                     strings.load_strings(language)
+                    locale = locales[language]
 
                     log.info("Getting links for {}.".format(platform))
                     links = yield self.conn.get_links(
-                        platform=platform, language=language, status="ACTIVE"
+                        platform=platform, language=locale, status="ACTIVE"
                     )
 
                     # build message
                     link_msg = None
                     for link in links:
-                        provider = link[4]
-                        version = link[3]
-                        arch = link[2]
+                        provider = link[5]
+                        version = link[4]
+                        arch = link[3]
                         url = link[0]
 
-                        link_str = "Tor Browser {} for {}-{} ({}): {}".format(
-                            version, platform, arch, provider, url
+                        link_str = "Tor Browser {} for {}-{}-{} ({}): {}".format(
+                            version, platform, locale, arch, provider, url
                         )
 
                         if link_msg:



More information about the tor-commits mailing list