[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r21009: {projects} First part of the implementation of sending out localized ve (in projects/gettor: . lib/gettor)



Author: kaner
Date: 2009-11-22 16:24:05 -0500 (Sun, 22 Nov 2009)
New Revision: 21009

Modified:
   projects/gettor/GetTor.py
   projects/gettor/README.locale-spec-draft
   projects/gettor/lib/gettor/constants.py
   projects/gettor/lib/gettor/packages.py
   projects/gettor/lib/gettor/responses.py
Log:
First part of the implementation of sending out localized versions of some of our packages


Modified: projects/gettor/GetTor.py
===================================================================
--- projects/gettor/GetTor.py	2009-11-22 03:56:31 UTC (rev 21008)
+++ projects/gettor/GetTor.py	2009-11-22 21:24:05 UTC (rev 21009)
@@ -23,8 +23,10 @@
 
 log = gettor.gtlog.getLogger()
 
-def processFail(conf, rawMessage, sendTo):
+def processFail(conf, rawMessage, sendTo, e):
     """This routine gets called when something went wrong with the processing"""
+    log.error("Here is the exception I saw: %s" % sys.exc_info()[0])
+    log.error("Detail: %s" %e)
     # Keep a copy of the failed email for later reference
     log.info("We'll keep a record of this mail.")
     gettor.utils.dumpMessage(conf, rawMessage)
@@ -56,9 +58,7 @@
         log.info("Signature is %s" % sig)
     except Exception, e:
         log.error("Parsing the request failed.")
-        log.error("Here is the exception I saw: %s" % sys.exc_info()[0])
-        log.error("Detail: %s" % e) 
-        processFail(conf, rawMessage, replyTo)
+        processFail(conf, rawMessage, replyTo, e)
         return False
 
     # Ok, information aquired. Initiate reply sequence
@@ -72,9 +72,7 @@
         return True
     except Exception, e:
         log.error("Sending the reply failed.")
-        log.error("Here is the exception I saw: %s" % sys.exc_info()[0])
-        log.error("Detail: %s" %e)
-        processFail(conf, rawMessage, replyTo)
+        processFail(conf, rawMessage, replyTo, e)
         raise
         return False
 

Modified: projects/gettor/README.locale-spec-draft
===================================================================
--- projects/gettor/README.locale-spec-draft	2009-11-22 03:56:31 UTC (rev 21008)
+++ projects/gettor/README.locale-spec-draft	2009-11-22 21:24:05 UTC (rev 21009)
@@ -7,15 +7,6 @@
 languages. It is currently a draft and will be reformatted, rewritten and
 changed until further notice.
 
-LOCALES FOR OPERATORS
----------------------
-
-Operators should be able to configure GetTor by setting their locale in their
-local configuration file. This allows the GetTor operator to use a localized
-version of GetTor for their language. All error messages, log messages and so
-forth should be localized. This is of course dependent on a proper translation.
-This generally outside of the scope of this document.
-
 LOCALES FOR END USERS
 ---------------------
 

Modified: projects/gettor/lib/gettor/constants.py
===================================================================
--- projects/gettor/lib/gettor/constants.py	2009-11-22 03:56:31 UTC (rev 21008)
+++ projects/gettor/lib/gettor/constants.py	2009-11-22 21:24:05 UTC (rev 21009)
@@ -51,9 +51,44 @@
     Please reply to this mail (to gettor@xxxxxxxxxxxxxx), and tell me
     a single package name anywhere in the body of your email.
 
-    Please note that currently we can't process HTML emails or base64
-    emails. You will need to send plain text.
+    Please note that GetTor can send out localized versions of Tor.
+    In your mail to us, please add a line containing "Lang:" followed by
+    the language abbreviation like so:
 
+    Lang: language
+
+    For example if you want the tor-browser-bundle for in chinese, write
+    us an email with the following text:
+
+    ---
+    tor-browser-bundle
+    Lang: zh-CN
+    ---
+
+    Or, if you want the tor-browser-bundle in farsi, write us an email
+    with the following text:
+
+    ---
+    tor-browser-bundle
+    Lang: fa-IR
+    ---
+
+    Here is a list of all available languages:
+
+    ar:     Arabic
+    de:     German
+    en-US:  English
+    es-ES:  Spanish
+    fa-IR:  Farsi (Iran)
+    fr:     French
+    it:     Italian
+    nl:     Dutch
+    pl:     Polish
+    ru:     Russian
+    zh-CN:  Chinese
+
+    If you select no language, you will receive the english version.
+
     If you have any questions or it doesn't work, you can contact a
     human at this support email address: tor-assistants@xxxxxxxxxxxxxx
 

Modified: projects/gettor/lib/gettor/packages.py
===================================================================
--- projects/gettor/lib/gettor/packages.py	2009-11-22 03:56:31 UTC (rev 21008)
+++ projects/gettor/lib/gettor/packages.py	2009-11-22 21:24:05 UTC (rev 21009)
@@ -25,12 +25,34 @@
 
 class Packages:
     #                "bundle name": ("single file regex", "split file regex")
-    packageRegex = { "windows-bundle": ("vidalia-bundle-.*.exe$", "vidalia-bundle-.*_split"),
-                     "panther-bundle": ("vidalia-bundle-.*-ppc.dmg$", "vidalia-bundle-.*-ppc_split"),
-                     "macosx-universal-bundle": ("vidalia-bundle-.*-universal.dmg$", "vidalia-bundle-.*-universal_split"),
+    packageRegex = { "tor-browser-bundle_en-US": ("tor-browser-.*_en-US.exe$", "tor-browser-.*_en-US_split"),
+                     "tor-im-browser-bundle_en-US": ("tor-im-browser-.*_en-US.exe$", "tor-im-browser-.*_en-US_split"),
+                     "tor-browser-bundle_de": ("tor-browser-.*_de.exe$", "tor-browser-.*_de_split"),
+                     "tor-im-browser-bundle_de": ("tor-im-browser-.*_de.exe$", "tor-im-browser-.*_de_split"),
+                     "tor-browser-bundle_ar": ("tor-browser-.*_ar.exe$", "tor-browser-.*_ar_split"),
+                     "tor-im-browser-bundle_ar": ("tor-im-browser-.*_ar.exe$", "tor-im-browser-.*_ar_split"),
+                     "tor-browser-bundle_es-ES": ("tor-browser-.*_es-ES.exe$", "tor-browser-.*_es-ES_split"),
+                     "tor-im-browser-bundle_es-ES": ("tor-im-browser-.*_es-ES.exe$", "tor-im-browser-.*_es-ES_split"),
+                     "tor-browser-bundle_fa-IR": ("tor-browser-.*_fa-IR.exe$", "tor-browser-.*_fa-IR_split"),
+                     "tor-im-browser-bundle_fa-IR": ("tor-im-browser-.*_fa-IR.exe$", "tor-im-browser-.*_fa-IR_split"),
+                     "tor-browser-bundle_fr": ("tor-browser-.*_fr.exe$", "tor-browser-.*_fr_split"),
+                     "tor-im-browser-bundle_fr": ("tor-im-browser-.*_fr.exe$", "tor-im-browser-.*_fr_split"),
+                     "tor-browser-bundle_it": ("tor-browser-.*_it.exe$", "tor-browser-.*_it_split"),
+                     "tor-im-browser-bundle_it": ("tor-im-browser-.*_it.exe$", "tor-im-browser-.*_it_split"),
+                     "tor-browser-bundle_nl": ("tor-browser-.*_nl.exe$", "tor-browser-.*_nl_split"),
+                     "tor-im-browser-bundle_nl": ("tor-im-browser-.*_nl.exe$", "tor-im-browser-.*_nl_split"),
+                     "tor-browser-bundle_pl": ("tor-browser-.*_pl.exe$", "tor-browser-.*_pl_split"),
+                     "tor-im-browser-bundle_pl": ("tor-im-browser-.*_pl.exe$", "tor-im-browser-.*_pl_split"),
+                     "tor-browser-bundle_pt": ("tor-browser-.*_pt.exe$", "tor-browser-.*_pt_split"),
+                     "tor-im-browser-bundle_pt": ("tor-im-browser-.*_pt.exe$", "tor-im-browser-.*_pt_split"),
+                     "tor-browser-bundle_ru": ("tor-browser-.*_ru.exe$", "tor-browser-.*_ru_split"),
+                     "tor-im-browser-bundle_ru": ("tor-im-browser-.*_ru.exe$", "tor-im-browser-.*_ru_split"),
+                     "tor-browser-bundle_zh-CN": ("tor-browser-.*_zh-CN.exe$", "tor-browser-.*_zh-CN_split"),
+                     "tor-im-browser-bundle_zh-CN": ("tor-im-browser-.*_zh-CN.exe$", "tor-im-browser-.*_zh-CN_split"),
                      "source-bundle": ("tor-.*.tar.gz$", "Now to something completely different"),
-                     "tor-browser-bundle": ("tor-browser-.*_en-US.exe$", "tor-browser-.*_en-US_split"),
-                     "tor-im-browser-bundle": ("tor-im-browser-.*_en-US.exe$", "tor-im-browser-.*_en-US_split"),
+                     #"windows-bundle": ("vidalia-bundle-.*.exe$", "vidalia-bundle-.*_split"),
+                     #"panther-bundle": ("vidalia-bundle-.*-ppc.dmg$", "vidalia-bundle-.*-ppc_split"),
+                     #"macosx-universal-bundle": ("vidalia-bundle-.*-universal.dmg$", "vidalia-bundle-.*-universal_split"),
                      # Mike won't sign Torbutton; He doesn't get gettor support
                      #"torbutton": "torbutton-current.xpi$",
                    }
@@ -91,7 +113,7 @@
                         if splitfile.endswith(".asc"):
                             continue
                         if re.compile(".*split.part.*").match(splitfile):
-                            ascfile = splitdir + "/" + splitfile + ".asc"
+                            ascfile = splitdir + "/signatures/" + splitfile + ".asc"
                             file = splitdir + "/" + splitfile
                             zipFileName = packSplitDir + "/" + splitfile + ".z"
                             if os.access(ascfile, os.R_OK) and os.access(file, os.R_OK):
@@ -124,11 +146,16 @@
     def syncWithMirror(self, mirror, silent):
         rsync = ["rsync"]
         rsync.append("-a")
-        # Don't download dotdirs
-        rsync.append("--exclude='.*'")
+        # Exclude stuff we don't need
+        rsync.append("--exclude=*current*")
+        rsync.append("--exclude=*osx*")
+        rsync.append("--exclude=*rpm*")
+        rsync.append("--exclude=*privoxy*")
+        rsync.append("--exclude=*alpha*")
         if not silent:
             rsync.append("--progress")
-        rsync.append("rsync://%s/tor/dist/current/" % mirror)
+        rsync.append("rsync://%s/tor/dist/" % mirror)
+        rsync.append("rsync://%s/tor/torbrowser/dist/" % mirror)
         rsync.append(self.distDir)
         process = subprocess.Popen(rsync)
         process.wait()
@@ -139,8 +166,11 @@
         """
         rsync = ["rsync"]
         rsync.append("-a")
-        # Don't download dotdirs
-        rsync.append("--exclude='.*'")
+        rsync.append("--exclude=*current*")
+        rsync.append("--exclude=*osx*")
+        rsync.append("--exclude=*rpm*")
+        rsync.append("--exclude=*privoxy*")
+        rsync.append("--exclude=*alpha*")
         if not silent:
             rsync.append("--progress")
         rsync.append("rsync://%s/tor/dist/current/" % mirror)

Modified: projects/gettor/lib/gettor/responses.py
===================================================================
--- projects/gettor/lib/gettor/responses.py	2009-11-22 03:56:31 UTC (rev 21008)
+++ projects/gettor/lib/gettor/responses.py	2009-11-22 21:24:05 UTC (rev 21009)
@@ -40,7 +40,14 @@
         self.srcEmail = "GetTor <gettor@xxxxxxxxxxxxxx>"
         self.replyTo = replyto
         assert self.replyTo is not None, "Empty replyto address."
+        # Default lang to en_US
+        if lang is None:
+            lang = "en-US"
         self.mailLang = lang
+        # XXX If someone wants one of the localizable packages, add language 
+        # suffix
+        if package == "tor-browser-bundle" or package == "tor-im-browser-bundle":
+            package = package + "_" + lang
         self.package = package
         self.splitsend = split
         self.signature = signature