[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [gettor/master] Clean up the whole i18n infrastructure. More clean & straightforward now.
commit d412a5fedfdf2e227ac88311e7dfa3691c0fd5ae
Author: Christian Fromme <kaner@xxxxxxxxxx>
Date: Tue Feb 22 16:02:01 2011 +0100
Clean up the whole i18n infrastructure. More clean & straightforward now.
---
README | 90 ++++---
lib/gettor/constants.py | 703 -----------------------------------------------
lib/gettor/i18n.py | 546 ++++++++++++++++++++++++++++++++++++
lib/gettor/requests.py | 4 +-
lib/gettor/responses.py | 117 +++++++--
5 files changed, 689 insertions(+), 771 deletions(-)
diff --git a/README b/README
index 0f335c7..1988a61 100644
--- a/README
+++ b/README
@@ -68,7 +68,7 @@ Finally, you need to setup email forwarding to the GetTor bot like so:
gettor@hostname:~$ echo "|python /home/g/opt/gettor/GetTor.py" > ~/.forward
-Now GetTor.py is installed, prepared and ready to serve files. Send it email!
+Now GetTor is installed, prepared and ready to serve files. Send it email!
TRANSLATION FILES
-----------------
@@ -95,20 +95,20 @@ and should look similar to this:
MAIL_FROM = "GetTor <gettor@xxxxxxxxxxxxxx>"
# Where it is all based at. Subdirs for GetTor start from here.
- BASEDIR = "/tmp"
+ BASEDIR = "/home/gettor/gettor"
# Should we send a `Your package will arrive soon, be patient' mail?
DELAY_ALERT = True
# Basename of the GetTor log files. Will be expandet to
# $LOGFILE-YYYY-MM-DD.log
- LOGFILE = "/tmp/gettorlog"
+ LOGFILE = "gettor_log"
# The file containing the hashed command password
PASSFILE = "gettor.pass"
# Where do we dump erronous emails?
- DUMPFILE = "./gettor.dump"
+ DUMPFILE = "gettor.dump"
# Do we send every mail type to every user only once before we blacklist
# them for it?
@@ -138,38 +138,6 @@ and should look similar to this:
("tor-browser-.*_en-US.exe$", "tor-browser-.*_en-US_split"), }
-WHAT'S DKIM / WHY DKIM?
------------------------
-
-People who send mail to gettor need to either use a mail provider that
-signs outgoing mail with DKIM, or have their email address or domain
-added to the whitelist.
-
-"DomainKeys Identified Mail", aka DKIM, is a mechanism that lets the mail
-provider prove that the mail is really coming from the domain and sender
-it claims to be from.
-
-Currently GMail and Yahoo both support DKIM, along with other more
-esoteric domains like paypal, AOL, earthlink, linkedin, etc. You can
-check if your mail provider uses DKIM by examining the headers of emails
-you send. If there's a "DomainKey-Signature:" header, then you're in
-good shape.
-
-If we didn't check the DKIM signature, people could abuse gettor into
-mailbombing innocent email addresses -- one short email resulting in a
-15MB attachment sent to an address of their choice is quite an attack
-multiplier.
-
-There are a few other alternative options (for example, Microsoft uses its
-own proprietary design called 'Sender ID'), but since GMail is already
-very common for users in blocked countries, we figured DKIM was a good
-starting point.
-
-And last, be aware that the set of domains that technically support
-DKIM is probably not exactly the same set that we should recommend for
-our users, due to other properties of each mail provider like their
-privacy policies.
-
VALIDATION OF REQUESTED FILES
-----------------------------
@@ -198,9 +166,10 @@ to hammer innocent inboxes with huge amounts of tor packages.
First of all, there is a DKIM checker (see "WHAT'S DKIM / WHY DKIM" above) that
prevents GetTor from answering useless spam emails. On top of that, there are
some hard-coded checks being performed on the sender address. Only mails coming
-from yahoo.com.cn, yahoo.com and gmail.com are allowed. However, DKIM checking
-and hard-coded domain checks are currently disabled in GetTor. Mails from all
-addresses are being passed to GetTor processing.
+from yahoo.com and gmail.com are allowed. However, DKIM checking and hard-coded
+domain checks are currently disabled in GetTor. Mails from all addresses are
+being passed to GetTor processing. But note that besides GMail and Yahoo, only
+vry few mail providers allow attachments of the size that GetTor will send out.
On top of that, there is a blacklisting mechanism. It works as follows: Each
unique email address is allowed to mail GetTor the same type of mail once each
@@ -220,13 +189,13 @@ directories. In reality, that looks as follows:
0154d8584c0afa6290e21098e7ab4cc635b7d50a
02a33e16feece8671f1274de62de32068a67cf20
-In addition to this automatic whitelisting, there is the possibility to add
-blacklist entries by hand as follows:
+In addition to this automatic blacklisting mechanism, there is the possibility
+to add blacklist entries by hand as follows:
gettor@hostname:~/opt/gettor$ python GetTor.py -b someone@xxxxxxxx
Email addresses that are added this way, go to the general/ directory in the
-blacklist directory.
+blacklist directory and will therefore be blocked from using GetTor in any way.
Besides the blacklisting mechanism, there is a whitelisting mechanism. It works
analogous to the manual blacklisting mechanism:
@@ -235,3 +204,40 @@ analogous to the manual blacklisting mechanism:
Whitelisting wins over blacklisting. If a user if blacklisted for X, but also
whitelisted, he will be allowed to do X.
+
+WHAT'S DKIM / WHY DKIM?
+-----------------------
+
+NOTE THAT THIS SECTION IS CURRENTLY OUTDATED, BECAUSE GETTOR DOESN'T DO DKIM
+CHECK ITSELF ANYMORE. IT RELIES ON THAT BEING DONE SOMEWHERE ELSE BEFORE THE
+EMAIL ARRIVES AT GETTOR.
+
+People who send mail to gettor need to either use a mail provider that
+signs outgoing mail with DKIM, or have their email address or domain
+added to the whitelist.
+
+"DomainKeys Identified Mail", aka DKIM, is a mechanism that lets the mail
+provider prove that the mail is really coming from the domain and sender
+it claims to be from.
+
+Currently GMail and Yahoo both support DKIM, along with other more
+esoteric domains like paypal, AOL, earthlink, linkedin, etc. You can
+check if your mail provider uses DKIM by examining the headers of emails
+you send. If there's a "DomainKey-Signature:" header, then you're in
+good shape.
+
+If we didn't check the DKIM signature, people could abuse gettor into
+mailbombing innocent email addresses -- one short email resulting in a
+15MB attachment sent to an address of their choice is quite an attack
+multiplier.
+
+There are a few other alternative options (for example, Microsoft uses its
+own proprietary design called 'Sender ID'), but since GMail is already
+very common for users in blocked countries, we figured DKIM was a good
+starting point.
+
+And last, be aware that the set of domains that technically support
+DKIM is probably not exactly the same set that we should recommend for
+our users, due to other properties of each mail provider like their
+privacy policies.
+
diff --git a/lib/gettor/constants.py b/lib/gettor/constants.py
deleted file mode 100644
index 179137a..0000000
--- a/lib/gettor/constants.py
+++ /dev/null
@@ -1,703 +0,0 @@
-# Copyright (c) 2008 - 2011, Jacob Appelbaum <jacob@xxxxxxxxxxxxx>,
-# Christian Fromme <kaner@xxxxxxxxxx>
-# This is Free Software. See LICENSE for license information.
-
-# Giant multi language help message. Add more translations as they become ready
-multilangpackagehelpmsg = """
- Hello, This is the "GetTor" robot.
-
- I will mail you a Tor package, if you tell me which one you want.
- Please select one of the following package names:
-
- tor-browser-bundle
- macosx-i386-bundle
- macosx-ppc-bundle
- linux-browser-bundle-i386
- linux-browser-bundle-x86_64
- source-bundle
-
- Please reply to this mail (to gettor), and tell me
- a single package name anywhere in the body of your email.
-
- OBTAINING LOCALIZED VERSIONS OF TOR
- ===================================
-
- To get a version of Tor translated into your language, specify the
- language you want in the address you send the mail to:
-
- gettor+zh
-
- This example will give you the requested package in a localized
- version for Chinese. Check below for a list of supported language
- codes.
-
- List of supported locales:
- -------------------------
-
- Here is a list of all available languages:
-
- gettor+ar: Arabic
- gettor+de: German
- gettor+en: English
- gettor+es: Spanish
- gettor+fa: Farsi (Iran)
- gettor+fr: French
- gettor+it: Italian
- gettor+nl: Dutch
- gettor+pl: Polish
- gettor+ru: Russian
- gettor+zh: Chinese
-
- If you select no language, you will receive the English version.
-
- SUPPORT
- =======
-
- If you have any questions or it doesn't work, you can contact a
- human at this support email address: tor-assistants
-
- --
-
- Ù?رØباØ? Ø£Ù?ا رÙ?بÙ?ت \"اØصÙ? عÙ?Ù? تÙ?ر\".
-
- سأرسÙ? Ù?Ù? ØزÙ?Ø© براÙ?ج تÙ?رØ? إذا أخبرتÙ?Ù? Ø£Ù?Ù?ا ترÙ?د.
- رجاء اختر Ø¥ØدÙ? أسÙ?اء اÙ?ØزÙ? اÙ?تاÙ?Ù?Ø©:
-
- tor-browser-bundle
- macosx-i386-bundle
- macosx-ppc-bundle
- linux-browser-bundle-i386
- linux-browser-bundle-x86_64
- source-bundle
-
- Ù?رجÙ? Ø£Ù? ترد عÙ?Ù? Ù?Ø°Ù? اÙ?رساÙ?Ø© (Ø¥Ù?Ù? gettor@xxxxxxxxxxxxxx)Ø? Ù?تخبرÙ?Ù?
- باسÙ? ØزÙ?Ø© Ù?اØدة Ù?Ù?Ø· Ù?Ù? Ø£Ù? Ù?Ù?اÙ? ضÙ?Ù? رساÙ?Ø© اÙ?رد.
-
- اÙ?ØصÙ?Ù? عÙ?Ù? إصدارات Ù?ترجÙ?Ø© Ù?Ù? تÙ?ر
- ========================
-
- Ù?تØصÙ? عÙ?Ù? إصدار تÙ?ر Ù?ترجÙ? Ø¥Ù?Ù? Ù?غتÙ?Ø? Ù?رجÙ? Ø£Ù? تØدد
- اÙ?Ù?غة اÙ?تÙ? ترÙ?د ضÙ?Ù? اÙ?عÙ?Ù?اÙ? اÙ?Ø°Ù? سترسÙ? اÙ?رساÙ?Ø© اÙ?Ø¥Ù?Ù?ترÙ?Ù?Ù?Ø© Ø¥Ù?Ù?Ù?:
-
- gettor+zh@xxxxxxxxxxxxxx
-
- Ù?ذا اÙ?Ù?ثاÙ? Ù?عطÙ?Ù? اÙ?ØزÙ?Ø© اÙ?Ù?Ø·Ù?Ù?بة Ù?ترجÙ?Ø©
- Ù?Ù?غة اÙ?صÙ?Ù?Ù?Ø©. تØÙ?Ù? Ù?Ù? اÙ?Ù?ائÙ?Ø© أدÙ?اÙ? Ù?تجد رÙ?Ù?ز اÙ?Ù?غات
- اÙ?Ù?دعÙ?Ù?Ø©.
-
- Ù?ائÙ?Ø© اÙ?Ù?غات اÙ?Ù?دعÙ?Ù?Ø©:
- -------------------
-
- Ù?ا Ù?Ù? Ù?ائÙ?Ø© اÙ?Ù?غات اÙ?Ù?تÙ?Ù?رة:
-
- gettor+ar@xxxxxxxxxxxxxx: اÙ?عربÙ?Ø©
- gettor+de@xxxxxxxxxxxxxx: اÙ?Ø£Ù?Ù?اÙ?Ù?Ø©
- gettor+en@xxxxxxxxxxxxxx: اÙ?Ø¥Ù?Ù?Ù?Ù?زÙ?Ø©
- gettor+es@xxxxxxxxxxxxxx: اÙ?إسباÙ?Ù?Ø©
- gettor+fa@xxxxxxxxxxxxxx: اÙ?Ù?ارسÙ?Ø©
- gettor+fr@xxxxxxxxxxxxxx: اÙ?Ù?رÙ?سÙ?Ø©
- gettor+it@xxxxxxxxxxxxxx: اÙ?Ø¥Ù?طاÙ?Ù?Ø©
- gettor+nl@xxxxxxxxxxxxxx: اÙ?Ù?Ù?Ù?Ù?دÙ?Ø©
- gettor+pl@xxxxxxxxxxxxxx: اÙ?بÙ?Ù?Ù?دÙ?Ø©
- gettor+ru@xxxxxxxxxxxxxx: اÙ?رÙ?سÙ?Ø©
- gettor+zh@xxxxxxxxxxxxxx: اÙ?صÙ?Ù?Ù?Ø©
-
- Ø¥Ù? Ù?Ù? تÙ?Ù? باختÙ?ار Ù?غة Ù?ستØصÙ? عÙ?Ù? اÙ?إصدارة اÙ?Ø¥Ù?Ù?Ù?Ù?زÙ?Ø©.
-
- اÙ?دعÙ? اÙ?Ù?Ù?Ù?
- =======
-
- Ø¥Ù? Ù?اÙ?ت Ù?دÙ?Ù? Ø£Ù?Ø© أسئÙ?Ø© Ø£Ù? إذا Ù?Ù? Ù?عÙ?Ù? Ù?ذا اÙ?ØÙ? Ù?Ù?Ù?Ù?Ù? اÙ?اتصاÙ? بÙ?ائÙ?
- بشرÙ? عÙ?Ù? عÙ?Ù?اÙ? اÙ?دعÙ? اÙ?Ù?Ù?Ù? اÙ?تاÙ?Ù?: tor-assistants@xxxxxxxxxxxxxx
-
- --
-
- سÙ?اÙ?! رÙ?بات "GetTor" در خدÙ?ت Ø´Ù?است.
-
- Ú?Ù?اÙ?Ú?Ù? بÙ? Ù?Ù? بگÙ?Û?Û?د Ú©Ù? بÙ? کداÙ?Û?Ú© از بستÙ? Ù?اÛ? Tor Ù?Û?از دارÛ?دØ? Ø¢Ù? را براÛ? Ø´Ù?ا
- ارساÙ? Ø®Ù?اÙ?Ù? کرد.
- Ù?Ø·Ù?ا Û?Ú©Û? از بستÙ? Ù?اÛ? را زÛ?ر با ذکر Ù?اÙ? اÙ?تخاب Ú©Ù?Û?د:
-
- tor-browser-bundle
- macosx-i386-bundle
- macosx-ppc-bundle
- linux-browser-bundle-i386
- linux-browser-bundle-x86_64
- source-bundle
-
- Ù?Ø·Ù?ا بÙ? اÛ?Ù? Ù?اÙ?Ù? پاسخ دادÙ? ( بÙ? آدرس gettor@xxxxxxxxxxxxxx ) Ù? در Ù?سÙ?تÛ? از
- Ù?تÙ? اÛ?Ù?Û?Ù? Ø®Ù?د Ù?اÙ? Û?Ú©Û? از بستÙ? Ù?اÛ? Ù?Ù?Ù? را ذکر Ú©Ù?Û?د.
-
- تÙ?Û?Ù? Ù?سخÙ? ترجÙ?Ù? شدÙ? TOR
- ===================================
-
- براÛ? درÛ?اÙ?ت Ù?سخÙ? اÛ? از TOR ترجÙ?Ù? شدÙ? بÙ? زباÙ? Ù?ØÙ?Û? Ø´Ù?اØ? Ù?Û? باÛ?ستÛ? زباÙ? Ù?Ù?رد
- Ù?ظر Ø®Ù?د را در آدرس Ú¯Û?رÙ?دÙ? اÛ?Ù?Û?Ù? ذکر Ú©Ù?Û?د. بعÙ?Ù?اÙ? Ù?ثاÙ?:
-
- gettor+zh@xxxxxxxxxxxxxx
-
- در اÛ?Ù? Ù?ثاÙ?Ø? Ù?رستÙ?دÙ? Ø®Ù?اÙ?اÙ? Ù?سخÙ? ترجÙ?Ù? شدÙ? بÙ? زباÙ? Ú?Û?Ù?Û? Ù?Û? باشد. براÛ? آگاÙ?Û?
- از کدÙ?اÛ? Ù?ربÙ?Ø· بÙ? زباÙ?Ù?اÛ? Ù?ابÙ? پشتÛ?باÙ?Û? تÙ?سط Tor Ø? Ù?Ù?رست زÛ?ر را Ù?طاÙ?عÙ? Ú©Ù?Û?د:
- Ù?Ù?رست زباÙ?Ù?اÛ? پشتÛ?اÙ?Û? شدÙ?
- -------------------------
-
- gettor+ar@xxxxxxxxxxxxxx: Arabic
- gettor+de@xxxxxxxxxxxxxx: German
- gettor+en@xxxxxxxxxxxxxx: English
- gettor+es@xxxxxxxxxxxxxx: Spanish
- gettor+fa@xxxxxxxxxxxxxx: Farsi (Iran)
- gettor+fr@xxxxxxxxxxxxxx: French
- gettor+it@xxxxxxxxxxxxxx: Italian
- gettor+nl@xxxxxxxxxxxxxx: Dutch
- gettor+pl@xxxxxxxxxxxxxx: Polish
- gettor+ru@xxxxxxxxxxxxxx: Russian
- gettor+zh@xxxxxxxxxxxxxx: Chinese
-
- Ú?Ù?اÙ?Ú?Ù? Ù?Û?Ú?Û?Ú© از زباÙ?Ù?اÛ? Ù?Ù?Ù? را اÙ?تخاب Ù?Ú©Ù?Û?دØ? Ù?سخÙ? اÙ?Ú¯Ù?Û?سÛ? براÛ? Ø´Ù?ا ارساÙ?
- Ø®Ù?اÙ?د شد.
-
- پشتÛ?باÙ?Û?
- =======
-
- Ú?Ù?اÙ?Ú?Ù? سÙ?اÙ?Û? دارÛ?د Û?ا برÙ?اÙ?Ù? دÚ?ار اشکاÙ? بÙ?دÙ? Ù? کار Ù?Ù?Û? Ú©Ù?د Ø? با Ù?سÙ?ت
- پشتÛ?باÙ?Û? با آدرس زÛ?ر تÙ?اس بگÛ?رÛ?د تا Û?Ú© اÙ?ساÙ? بÙ? سÙ?اÙ? Ø´Ù?ا پاسخ دÙ?د: tor-assistants@xxxxxxxxxxxxxx
-
- --
-
- Hei, dette er "GetTor"-roboten
-
- Jeg kommer til å sende deg en Tor-pakke, hvis du forteller meg hvilken du
- vil ha.
- Vennligst velg en av følgende pakkenavn:
-
- tor-browser-bundle
- macosx-i386-bundle
- macosx-ppc-bundle
- linux-browser-bundle-i386
- linux-browser-bundle-x86_64
- source-bundle
-
- Vennligst svar til denne eposten (til gettor@xxxxxxxxxxxxxx), og nevn
- kun et enkelt pakkenavn i tekstområdet til eposten din.
-
- SKAFFE LOKALISERTE VERSJONER AV TOR
- ===================================
-
- For å skaffe en versjon av Tor som har blitt oversatt til ditt språk,
- spesifiser språket du vil i epostadressen du sender eposten til:
-
- gettor+zh@xxxxxxxxxxxxxx
-
- Dette eksempelet vil gi deg en forespurt pakke som er en oversatt
- versjon for kinesisk. Se listen nedenfor for hvilke språk det er støtte for.
-
- Liste av støttede språk:
- -------------------------
-
- Her er en liste av språkene som er tilgjengelig:
-
- gettor+ar@xxxxxxxxxxxxxx: Arabisk
- gettor+de@xxxxxxxxxxxxxx: Tysk
- gettor+en@xxxxxxxxxxxxxx: Engelsk
- gettor+es@xxxxxxxxxxxxxx: Spansk
- gettor+fa@xxxxxxxxxxxxxx: Farsi (Iran)
- gettor+fr@xxxxxxxxxxxxxx: Fransk
- gettor+it@xxxxxxxxxxxxxx: Italiensk
- gettor+nl@xxxxxxxxxxxxxx: Nederlandsk
- gettor+pl@xxxxxxxxxxxxxx: Polsk
- gettor+ru@xxxxxxxxxxxxxx: Russisk
- gettor+zh@xxxxxxxxxxxxxx: Kinesisk
-
- Hvis du ikke spesifiserer noen språk vil du motta standard Engelsk
- versjon
-
- STÃ?TTE
- =======
-
- Hvis du har noen spørsmål eller det ikke virker, kan du kontakte et
- menneske på denne support-eposten: tor-assistants@xxxxxxxxxxxxxx
-
- --
-
- Olá! Este é o robot "GetTor".
-
- Eu envio-lhe um pacote Tor, bastando para isso dizer qual o que quer.
- Escolha um dos seguintes pacotes:
-
- tor-browser-bundle
- macosx-i386-bundle
- macosx-ppc-bundle
- linux-browser-bundle-i386
- linux-browser-bundle-x86_64
- source-bundle
-
- Por favor responda a esta email (para gettor@xxxxxxxxxxxxxx), e diga qual o
- pacote que deseja, colocando o seu nome no corpo do seu email.
-
- OBTER VERSÃ?ES TRADUZIDAS DO TOR
- ===================================
-
- Para lhe ser enviado uma versão traduzida do Tor, especifique a lÃngua no
- destinatário do seu email:
-
- gettor+zh@xxxxxxxxxxxxxx
-
- Este exemplo vai enviar o pacote traduzido para Chinês Simplificado. Veja a
- lista de endereços de email existentes que pode utilizar:
-
- Lista de endereços de email suportados:
- -------------------------
-
- gettor+pt@xxxxxxxxxxxxxx: Português
- gettor+ar@xxxxxxxxxxxxxx: Arábico
- gettor+de@xxxxxxxxxxxxxx: Alemão
- gettor+en@xxxxxxxxxxxxxx: Inglês
- gettor+es@xxxxxxxxxxxxxx: Espanhol
- gettor+fa@xxxxxxxxxxxxxx: Farsi (Irão)
- gettor+fr@xxxxxxxxxxxxxx: Francês
- gettor+it@xxxxxxxxxxxxxx: Italiano
- gettor+nl@xxxxxxxxxxxxxx: Holandês
- gettor+pl@xxxxxxxxxxxxxx: Polaco
- gettor+ru@xxxxxxxxxxxxxx: Russo
- gettor+zh@xxxxxxxxxxxxxx: Chinês
-
- Se não escolher nenhuma lÃngua, receberá o Tor em Inglês.
-
- SUPORTE
- =======
-
- Se tiver alguma dúvida, pode contactar um humano através do seguinte
- endereço: tor-assistants@xxxxxxxxxxxxxx
-
- --
-
- Ð?дÑ?авÑ?Ñ?вÑ?йÑ?е! ÐÑ?о "Ñ?обоÑ? GetTor".
-
- Я оÑ?оÑ?лÑ? вам пакеÑ? Tor еÑ?ли вÑ? Ñ?кажеÑ?е коÑ?оÑ?Ñ?й вÑ? Ñ?оÑ?иÑ?е.
- Ð?ожалÑ?йÑ?Ñ?а вÑ?беÑ?иÑ?е один из пакеÑ?ов:
-
- tor-browser-bundle
- macosx-i386-bundle
- macosx-ppc-bundle
- linux-browser-bundle-i386
- linux-browser-bundle-x86_64
- source-bundle
-
- Ð?ожалÑ?йÑ?Ñ?а Ñ?вÑ?жиÑ?еÑ?Ñ? Ñ? нами по Ñ?Ñ?ой Ñ?лкÑ?Ñ?онной поÑ?Ñ?е
- (gettor@xxxxxxxxxxxxxx), и Ñ?кажиÑ?е
- название одного из пакеÑ?ов в лÑ?бом меÑ?Ñ?е в "Ñ?еле" ваÑ?его пиÑ?Ñ?ма.
-
- Ð?Ð?Ð?УЧÐ?Ð?Ð?Ð? Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð Ð?Ð?Ð?Ð?Ð?ЫХ Ð?Ð?РСÐ?Ð? TOR
- ===================================
-
- ЧÑ?обÑ? полÑ?Ñ?иÑ?Ñ? веÑ?Ñ?иÑ? Tor пеÑ?еведеннÑ?Ñ? на ваÑ? Ñ?зÑ?к,Ñ?кажиÑ?е
- пÑ?едпоÑ?иÑ?аемÑ?й Ñ?зÑ?к в адÑ?еÑ?ной Ñ?Ñ?Ñ?оке кÑ?да вÑ? оÑ?оÑ?лали Ñ?лекÑ?Ñ?оннÑ?Ñ? поÑ?Ñ?Ñ?:
-
- gettor+zh@xxxxxxxxxxxxxx
-
- Ð?Ñ?Ñ?еÑ?казаннÑ?й пÑ?имеÑ? даÑ?Ñ? вам запÑ?оÑ?еннÑ?й пакеÑ? в локализиÑ?ованной
- веÑ?Ñ?ии киÑ?айÑ?кого Ñ?зÑ?ка. Ð?Ñ?овеÑ?Ñ?Ñ?е ниже Ñ?пиÑ?ок кодов поддеÑ?живаемÑ?Ñ?
- Ñ?зÑ?ков.
-
- СпиÑ?ок поддеÑ?живаемÑ?Ñ? Ñ?егионов
- -------------------------
-
- Ð?иже Ñ?казан Ñ?пиÑ?ок вÑ?еÑ? доÑ?Ñ?Ñ?пнÑ?Ñ? Ñ?зÑ?ков:
-
- gettor+ar@xxxxxxxxxxxxxx: аÑ?абÑ?кий
- gettor+de@xxxxxxxxxxxxxx: немеÑ?кий
- gettor+en@xxxxxxxxxxxxxx: английÑ?кий
- gettor+es@xxxxxxxxxxxxxx: иÑ?панÑ?кий
- gettor+fa@xxxxxxxxxxxxxx: Ñ?аÑ?Ñ?и (Ð?Ñ?ан)
- gettor+fr@xxxxxxxxxxxxxx: Ñ?Ñ?анÑ?Ñ?зÑ?кий
- gettor+it@xxxxxxxxxxxxxx: иÑ?алÑ?Ñ?нÑ?кий
- gettor+nl@xxxxxxxxxxxxxx: голландÑ?кий
- gettor+pl@xxxxxxxxxxxxxx: полÑ?Ñ?кий
- gettor+ru@xxxxxxxxxxxxxx: Ñ?Ñ?Ñ?Ñ?кий
- gettor+zh@xxxxxxxxxxxxxx: киÑ?айÑ?кий
-
- Ð?Ñ?ли вÑ? не вÑ?беÑ?иÑ?е Ñ?зÑ?к, вÑ? полÑ?Ñ?иÑ?е веÑ?Ñ?иÑ? на английÑ?ком Ñ?зÑ?ке.
-
- Ð?Ð?Ð?Ð?Ð?Ð Ð?Ð?Ð?
- =======
-
- Ð?Ñ?ли Ñ? ваÑ? вопÑ?оÑ?Ñ? или Ñ?Ñ?о Ñ?о не Ñ?Ñ?абоÑ?ало, вÑ? можеÑ?е Ñ?вÑ?заÑ?Ñ?Ñ?Ñ?
- Ñ? живÑ?м пÑ?едÑ?Ñ?авиÑ?елем по Ñ?Ñ?омÑ? Ñ?лекÑ?Ñ?онномÑ? адÑ?еÑ?Ñ?:tor-assistants@xxxxxxxxxxxxxx
-
- --
-
- ä½ å¥½, è¿?é??æ?¯"GetTor"è?ªå?¨å??å¤?ã??
-
- æ?¨ä»?è¿?é??å?¯ä»¥å¾?å?°Torå¥?件, 请å??è¯?æ??æ?¨é??è¦?ç??å¥?件ç§?ç±».
- 请é??æ?©å¥?件å??称:
-
- tor-browser-bundle
- (Tor+Firefox���)
- macosx-i386-bundle
- (Tor for MacOS)
- macosx-ppc-bundle
- (Tor for MacOS on PowerPC )
- linux-browser-bundle-i386
- linux-browser-bundle-x86_64
- (Tor for Linux)
- source-bundle
- (æº?ç ?å??)
-
- 请ç?´æ?¥å??å¤?æ?¬é?®ä»¶(gettor@xxxxxxxxxxxxxx),
- 并å?¨ä¿¡ç??æ£æ??ä¸å??好æ?¨æ??é??è¦?ç??å¥?件å??称ï¼?ä¸?å??æ?¬æ?¬å?·å??ç??ä¸æ??ï¼?ã??
-
- è?·å??å?¶ä»?è¯è¨?ç??Torå¥?件
- ===================================
-
- å?¨æ?¶ä»¶äººå?°å??ä¸æ??å®?è¯è¨?代ç ?å?¯ä»¥è?·å¾?æ?¬å¯¹åº?è¯è¨?ç??ç??æ?¬ï¼?ä¾?å¦?ï¼?
-
- gettor+zh@xxxxxxxxxxxxxx
-
- æ?¬ä¾?ä¸ï¼?æ?¨å°?å¾?å?°ä¸æ??ç??ç??Torå¥?件ï¼?ä¸?é?¢æ?¯ç?®å??æ?¯æ??ç??è¯ç§?代ç ?ï¼?
-
- æ?¯æ??è¯è¨?å??表:
- -------------------------
-
- å?¨é?¨å?¯ç?¨è¯è¨?å??表:
-
- gettor+ar@xxxxxxxxxxxxxx: Arabic
- gettor+de@xxxxxxxxxxxxxx: German
- gettor+en@xxxxxxxxxxxxxx: English
- gettor+es@xxxxxxxxxxxxxx: Spanish
- gettor+fa@xxxxxxxxxxxxxx: Farsi (Iran)
- gettor+fr@xxxxxxxxxxxxxx: French
- gettor+it@xxxxxxxxxxxxxx: Italian
- gettor+nl@xxxxxxxxxxxxxx: Dutch
- gettor+pl@xxxxxxxxxxxxxx: Polish
- gettor+ru@xxxxxxxxxxxxxx: Russian
- gettor+zh@xxxxxxxxxxxxxx: ä¸æ??
-
- å¦?æ??æ?¨æ?ªæ??å®?è¯è¨?代ç ?ï¼?æ?¨å°?æ?¶å?°è?±æ??ç??ã??
-
- æ?¯æ??
- =======
-
- å¦?æ??æ?¨é??å?°å?°é?¾æ??æ??å?¡å?ºç?°é?®é¢?ï¼?请è??ç³»æ??们ç??
- æ??æ?¯æ?¯æ??é?®ç®±: tor-assistants@xxxxxxxxxxxxxx
-
- --
- """
-
-# Short string to build mails follow
-hello_gettor = _("""
- Hello, This is the "GetTor" robot.
-
- Thank you for your request.
-
- """)
-help_dkim_1 = _("""
- Unfortunately, we won't answer you at this address. You should make
- an account with GMAIL.COM or YAHOO.CN and send the mail from
- one of those.
-
- """)
-help_dkim_2 = _("""
- We only process requests from email services that support "DKIM",
- which is an email feature that lets us verify that the address in the
- "From" line is actually the one who sent the mail.
-
- """)
-help_dkim_3 = _("""
- (We apologize if you didn't ask for this mail. Since your email is from
- a service that doesn't use DKIM, we're sending a short explanation,
- and then we'll ignore this email address for the next day or so.)
-
- """)
-help_dkim_4 = _("""
- Please note that currently, we can't process HTML emails or base 64
- mails. You will need to send plain text.
-
- """)
-
-help_dkim_5 = _("""
- If you have any questions or it doesn't work, you can contact a
- human at this support email address: tor-assistants@xxxxxxxxxxxxxx
-
- """)
-choose_package_1 = _("""
- I will mail you a Tor package, if you tell me which one you want.
- Please select one of the following package names:
-
- """)
-avail_packs = """
- tor-browser-bundle
- macosx-i386-bundle
- macosx-ppc-bundle
- linux-browser-bundle-i386
- linux-browser-bundle-x86_64
- source-bundle
-
- """
-choose_package_2 = _("""
- Please reply to this mail (to gettor@xxxxxxxxxxxxxx), and tell me
- a single package name anywhere in the body of your email.
-
- """)
-obtain_localized_head = _("""
- OBTAINING LOCALIZED VERSIONS OF TOR
- """)
-obtain_localized_underline = """
- ===================================
-
- """
-obtain_localized_1 = _("""
- To get a version of Tor translated into your language, specify the
- language you want in the address you send the mail to:
-
- """)
-obtain_localized_2 = """
- gettor+zh@xxxxxxxxxxxxxx
-
- """
-obtain_localized_3 = _("""
- This example will give you the requested package in a localized
- version for Chinese. Check below for a list of supported language
- codes.
-
- """)
-list_of_langs_head = _("""
- List of supported locales:
- """)
-list_of_langs_underline = """
- -------------------------
-
- """
-list_of_langs_1 = _("""
- Here is a list of all available languages:
-
- """)
-list_of_langs_2 = _("""
- gettor+ar@xxxxxxxxxxxxxx: Arabic
- gettor+de@xxxxxxxxxxxxxx: German
- gettor+en@xxxxxxxxxxxxxx: English
- gettor+es@xxxxxxxxxxxxxx: Spanish
- gettor+fa@xxxxxxxxxxxxxx: Farsi (Iran)
- gettor+fr@xxxxxxxxxxxxxx: French
- gettor+it@xxxxxxxxxxxxxx: Italian
- gettor+nl@xxxxxxxxxxxxxx: Dutch
- gettor+pl@xxxxxxxxxxxxxx: Polish
- gettor+ru@xxxxxxxxxxxxxx: Russian
- gettor+zh@xxxxxxxxxxxxxx: Chinese
-
- """)
-list_of_langs_3 = _("""
- If you select no language, you will receive the English version.
-
- """)
-
-split_help_head = _("""
- SMALLER SIZED PACKAGES
- """)
-split_help_underline = """
- ======================
- """
-split_help_1 = _("""
- If your bandwith is low or your provider doesn't allow you to
- receive large attachments in your email, there is a feature of
- GetTor you can use to make it send you a number of small packages
- instead of one big one.
-
- """)
-split_help_2 = _("""
- Simply include the keyword 'split' somewhere in your email like so:
- """)
-split_help_3 = """
-
- tor-browser-bundle
- split
-
- """
-split_help_4 = _("""
- Sending this text in an email to GetTor will cause it to send you
- the Tor Browser Bundle in a number of 1,4MB attachments.
-
- """)
-split_help_5 = _("""
- After having received all parts, you need to re-assemble them to
- one package again. This is done as follows:
-
- """)
-split_help_6 = _("""
- 1.) Save all received attachments into one folder on your disk.
-
- """)
-split_help_7 = _("""
- 2.) Unzip all files ending in ".z". If you saved all attachments to
- a fresh folder before, simply unzip all files in that folder.
-
- """)
-split_help_8 = _("""
- 3.) Rename the file ending in ".ex_RENAME" to end in ".exe" and
- also rename the file ending in ".ex_RENAME.asc" to end in
- ".exe.asc"
-
- """)
-split_help_9 = _("""
- 4.) Verify all files as described in the mail you received with
- each package. (gpg --verify)
-
- """)
-split_help_10 = _("""
- 5.) Now use a program that can unrar multivolume RAR archives. On
- Windows, this usually is WinRAR. If you don't have that
- installed on you computer yet, get it here:
-
- """)
-split_help_11 = """
- http://www.win-rar.com/download.html
-
- """
-split_help_12 = _("""
- To unpack your Tor package, simply doubleclick the ".exe" file.
-
- """)
-split_help_13 = _("""
- 6.) After unpacking is finished, you should find a newly created
- ".exe" file in your destination folder. Simply doubleclick
- that and Tor Browser Bundle should start within a few seconds.
-
- """)
-split_help_14 = _("""
- 7.) That's it. You're done. Thanks for using Tor and have fun!
-
- """)
-support = _("""
- SUPPORT
- """)
-support_underline = """
- =======
- """
-support_email = _("""
- If you have any questions or it doesn't work, you can contact a
- human at this support email address: tor-assistants@xxxxxxxxxxxxxx
-
- """)
-package_mail_1 = _("""
- Here's your requested software as a zip file. Please unzip the
- package and verify the signature.
-
- """)
-package_mail_2 = _("""
- Hint: If your computer has GnuPG installed, use the gpg
- commandline tool as follows after unpacking the zip file:
-
- """)
-package_mail_3 = _("""
- gpg --verify <packagename>.asc <packagename>
-
- """)
-package_mail_4 = _("""
- The output should look somewhat like this:
-
- """)
-package_mail_5 = """
- gpg: Good signature from "Roger Dingledine <arma@xxxxxxx>"
-
- """
-package_mail_6 = _("""
- If you're not familiar with commandline tools, try looking for
- a graphical user interface for GnuPG on this website:
-
- """)
-package_mail_7 = """
- http://www.gnupg.org/related_software/frontends.html
-
- """
-package_mail_8 = _("""
- If your Internet connection blocks access to the Tor network, you
- may need a bridge relay. Bridge relays (or "bridges" for short)
- are Tor relays that aren't listed in the main directory. Since there
- is no complete public list of them, even if your ISP is filtering
- connections to all the known Tor relays, they probably won't be able
- to block all the bridges.
-
- """)
-package_mail_9 = _("""
- You can acquire a bridge by sending an email that contains "get bridges"
- in the body of the email to the following email address:
- bridges@xxxxxxxxxxxxxx
-
- """)
-package_mail_10 = _("""
- It is also possible to fetch bridges with a web browser at the following
- url: https://bridges.torproject.org/
-
- """)
-split_package_1 = _("""
- IMPORTANT NOTE:
- Since this is part of a split-file request, you need to wait for
- all split files to be received by you before you can save them all
- into the same directory and unpack them by double-clicking the
- first file.
-
- """)
-split_package_2 = _("""
- Packages might come out of order! Please make sure you received
- all packages before you attempt to unpack them!
-
- """)
-delay_alert_1 = _("""
- Thank you for your request. It was successfully understood. Your request is
- currently being processed. Your package should arrive within the next ten
- minutes.
-
- """)
-delay_alert_2 = _("""
- If it doesn't arrive, the package might be too big for your mail provider.
- Try resending the mail from a gmail.com or yahoo.cn account. Also,
- try asking for tor-browser-bundle rather than tor-im-browser-bundle,
- since it's smaller.
-
- """)
-error_mail = _("""
- Unfortunately we are currently experiencing problems and we can't fulfill
- your request right now. Please be patient as we try to resolve this issue.
-
- """)
-
-# Build the actual mail texts
-packagehelpmsg = hello_gettor + choose_package_1 + avail_packs + choose_package_2 + \
- obtain_localized_head + obtain_localized_underline + \
- obtain_localized_1 + obtain_localized_2 + obtain_localized_3 + \
- list_of_langs_head + list_of_langs_underline + \
- list_of_langs_1 + list_of_langs_2 + list_of_langs_3 + \
- split_help_head + split_help_underline + \
- split_help_1 + split_help_2 + split_help_3 + split_help_4 + \
- split_help_5 + split_help_6 + split_help_7 + split_help_8 + \
- split_help_9 + split_help_10 + split_help_11 + split_help_12 + \
- split_help_13 + split_help_14 + \
- support + support_underline + support_email
-
-helpmsg = hello_gettor + \
- help_dkim_1 + help_dkim_2 + help_dkim_3 + help_dkim_4 + help_dkim_5 + \
- support_email
-
-
-packagemsg = hello_gettor + \
- package_mail_1 + package_mail_2 + package_mail_3 + package_mail_4 + \
- package_mail_5 + package_mail_6 + package_mail_7 + package_mail_8 + \
- package_mail_9 + package_mail_10 + \
- support_email
-
-
-splitpackagemsg = hello_gettor + \
- split_package_1 + split_package_2 + \
- package_mail_1 + package_mail_2 + package_mail_3 + package_mail_4 + \
- package_mail_5 + package_mail_6 + package_mail_7 + package_mail_8 + \
- package_mail_9 + package_mail_10 + \
- support_email
-
-
-delayalertmsg = hello_gettor + \
- delay_alert_1 + delay_alert_2 + \
- support_email
-
-mailfailmsg = hello_gettor + \
- support_email
-
-
diff --git a/lib/gettor/i18n.py b/lib/gettor/i18n.py
new file mode 100644
index 0000000..92a2165
--- /dev/null
+++ b/lib/gettor/i18n.py
@@ -0,0 +1,546 @@
+# Copyright (c) 2008 - 2011, Jacob Appelbaum <jacob@xxxxxxxxxxxxx>,
+# Christian Fromme <kaner@xxxxxxxxxx>
+# This is Free Software. See LICENSE for license information.
+
+import os
+import gettext
+
+def getLang(lang, localedir=os.path.expanduser("~") + "/gettor/i18n"):
+ """Return the Translation instance for a given language. If no Translation
+ instance is found, return the one for 'en'
+ """
+ return gettext.translation("gettor", localedir=localedir,
+ languages=[lang], fallback="en")
+
+def _(text):
+ """This is necessary because strings are translated when they're imported.
+ Otherwise this would make it impossible to switch languages more than
+ once
+ """
+ return text
+
+# Giant multi language help message. Add more translations as they become ready
+MULTILANGHELP = """
+ Hello, This is the "GetTor" robot.
+
+ I will mail you a Tor package, if you tell me which one you want.
+ Please select one of the following package names:
+
+ tor-browser-bundle
+ macosx-i386-bundle
+ macosx-ppc-bundle
+ linux-browser-bundle-i386
+ linux-browser-bundle-x86_64
+ source-bundle
+
+ Please reply to this mail (to gettor), and tell me
+ a single package name anywhere in the body of your email.
+
+ OBTAINING LOCALIZED VERSIONS OF TOR
+ ===================================
+
+ To get a version of Tor translated into your language, specify the
+ language you want in the address you send the mail to:
+
+ gettor+zh
+
+ This example will give you the requested package in a localized
+ version for Chinese. Check below for a list of supported language
+ codes.
+
+ List of supported locales:
+ -------------------------
+
+ Here is a list of all available languages:
+
+ gettor+ar: Arabic
+ gettor+de: German
+ gettor+en: English
+ gettor+es: Spanish
+ gettor+fa: Farsi (Iran)
+ gettor+fr: French
+ gettor+it: Italian
+ gettor+nl: Dutch
+ gettor+pl: Polish
+ gettor+ru: Russian
+ gettor+zh: Chinese
+
+ If you select no language, you will receive the English version.
+
+ SUPPORT
+ =======
+
+ If you have any questions or it doesn't work, you can contact a
+ human at this support email address: tor-assistants
+
+ --
+
+ Ù?رØباØ? Ø£Ù?ا رÙ?بÙ?ت \"اØصÙ? عÙ?Ù? تÙ?ر\".
+
+ سأرسÙ? Ù?Ù? ØزÙ?Ø© براÙ?ج تÙ?رØ? إذا أخبرتÙ?Ù? Ø£Ù?Ù?ا ترÙ?د.
+ رجاء اختر Ø¥ØدÙ? أسÙ?اء اÙ?ØزÙ? اÙ?تاÙ?Ù?Ø©:
+
+ tor-browser-bundle
+ macosx-i386-bundle
+ macosx-ppc-bundle
+ linux-browser-bundle-i386
+ linux-browser-bundle-x86_64
+ source-bundle
+
+ Ù?رجÙ? Ø£Ù? ترد عÙ?Ù? Ù?Ø°Ù? اÙ?رساÙ?Ø© (Ø¥Ù?Ù? gettor@xxxxxxxxxxxxxx)Ø? Ù?تخبرÙ?Ù?
+ باسÙ? ØزÙ?Ø© Ù?اØدة Ù?Ù?Ø· Ù?Ù? Ø£Ù? Ù?Ù?اÙ? ضÙ?Ù? رساÙ?Ø© اÙ?رد.
+
+ اÙ?ØصÙ?Ù? عÙ?Ù? إصدارات Ù?ترجÙ?Ø© Ù?Ù? تÙ?ر
+ ========================
+
+ Ù?تØصÙ? عÙ?Ù? إصدار تÙ?ر Ù?ترجÙ? Ø¥Ù?Ù? Ù?غتÙ?Ø? Ù?رجÙ? Ø£Ù? تØدد
+ اÙ?Ù?غة اÙ?تÙ? ترÙ?د ضÙ?Ù? اÙ?عÙ?Ù?اÙ? اÙ?Ø°Ù? سترسÙ? اÙ?رساÙ?Ø© اÙ?Ø¥Ù?Ù?ترÙ?Ù?Ù?Ø© Ø¥Ù?Ù?Ù?:
+
+ gettor+zh@xxxxxxxxxxxxxx
+
+ Ù?ذا اÙ?Ù?ثاÙ? Ù?عطÙ?Ù? اÙ?ØزÙ?Ø© اÙ?Ù?Ø·Ù?Ù?بة Ù?ترجÙ?Ø©
+ Ù?Ù?غة اÙ?صÙ?Ù?Ù?Ø©. تØÙ?Ù? Ù?Ù? اÙ?Ù?ائÙ?Ø© أدÙ?اÙ? Ù?تجد رÙ?Ù?ز اÙ?Ù?غات
+ اÙ?Ù?دعÙ?Ù?Ø©.
+
+ Ù?ائÙ?Ø© اÙ?Ù?غات اÙ?Ù?دعÙ?Ù?Ø©:
+ -------------------
+
+ Ù?ا Ù?Ù? Ù?ائÙ?Ø© اÙ?Ù?غات اÙ?Ù?تÙ?Ù?رة:
+
+ gettor+ar@xxxxxxxxxxxxxx: اÙ?عربÙ?Ø©
+ gettor+de@xxxxxxxxxxxxxx: اÙ?Ø£Ù?Ù?اÙ?Ù?Ø©
+ gettor+en@xxxxxxxxxxxxxx: اÙ?Ø¥Ù?Ù?Ù?Ù?زÙ?Ø©
+ gettor+es@xxxxxxxxxxxxxx: اÙ?إسباÙ?Ù?Ø©
+ gettor+fa@xxxxxxxxxxxxxx: اÙ?Ù?ارسÙ?Ø©
+ gettor+fr@xxxxxxxxxxxxxx: اÙ?Ù?رÙ?سÙ?Ø©
+ gettor+it@xxxxxxxxxxxxxx: اÙ?Ø¥Ù?طاÙ?Ù?Ø©
+ gettor+nl@xxxxxxxxxxxxxx: اÙ?Ù?Ù?Ù?Ù?دÙ?Ø©
+ gettor+pl@xxxxxxxxxxxxxx: اÙ?بÙ?Ù?Ù?دÙ?Ø©
+ gettor+ru@xxxxxxxxxxxxxx: اÙ?رÙ?سÙ?Ø©
+ gettor+zh@xxxxxxxxxxxxxx: اÙ?صÙ?Ù?Ù?Ø©
+
+ Ø¥Ù? Ù?Ù? تÙ?Ù? باختÙ?ار Ù?غة Ù?ستØصÙ? عÙ?Ù? اÙ?إصدارة اÙ?Ø¥Ù?Ù?Ù?Ù?زÙ?Ø©.
+
+ اÙ?دعÙ? اÙ?Ù?Ù?Ù?
+ =======
+
+ Ø¥Ù? Ù?اÙ?ت Ù?دÙ?Ù? Ø£Ù?Ø© أسئÙ?Ø© Ø£Ù? إذا Ù?Ù? Ù?عÙ?Ù? Ù?ذا اÙ?ØÙ? Ù?Ù?Ù?Ù?Ù? اÙ?اتصاÙ? بÙ?ائÙ?
+ بشرÙ? عÙ?Ù? عÙ?Ù?اÙ? اÙ?دعÙ? اÙ?Ù?Ù?Ù? اÙ?تاÙ?Ù?: tor-assistants@xxxxxxxxxxxxxx
+
+ --
+
+ سÙ?اÙ?! رÙ?بات "GetTor" در خدÙ?ت Ø´Ù?است.
+
+ Ú?Ù?اÙ?Ú?Ù? بÙ? Ù?Ù? بگÙ?Û?Û?د Ú©Ù? بÙ? کداÙ?Û?Ú© از بستÙ? Ù?اÛ? Tor Ù?Û?از دارÛ?دØ? Ø¢Ù? را براÛ? Ø´Ù?ا
+ ارساÙ? Ø®Ù?اÙ?Ù? کرد.
+ Ù?Ø·Ù?ا Û?Ú©Û? از بستÙ? Ù?اÛ? را زÛ?ر با ذکر Ù?اÙ? اÙ?تخاب Ú©Ù?Û?د:
+
+ tor-browser-bundle
+ macosx-i386-bundle
+ macosx-ppc-bundle
+ linux-browser-bundle-i386
+ linux-browser-bundle-x86_64
+ source-bundle
+
+ Ù?Ø·Ù?ا بÙ? اÛ?Ù? Ù?اÙ?Ù? پاسخ دادÙ? ( بÙ? آدرس gettor@xxxxxxxxxxxxxx ) Ù? در Ù?سÙ?تÛ? از
+ Ù?تÙ? اÛ?Ù?Û?Ù? Ø®Ù?د Ù?اÙ? Û?Ú©Û? از بستÙ? Ù?اÛ? Ù?Ù?Ù? را ذکر Ú©Ù?Û?د.
+
+ تÙ?Û?Ù? Ù?سخÙ? ترجÙ?Ù? شدÙ? TOR
+ ===================================
+
+ براÛ? درÛ?اÙ?ت Ù?سخÙ? اÛ? از TOR ترجÙ?Ù? شدÙ? بÙ? زباÙ? Ù?ØÙ?Û? Ø´Ù?اØ? Ù?Û? باÛ?ستÛ? زباÙ? Ù?Ù?رد
+ Ù?ظر Ø®Ù?د را در آدرس Ú¯Û?رÙ?دÙ? اÛ?Ù?Û?Ù? ذکر Ú©Ù?Û?د. بعÙ?Ù?اÙ? Ù?ثاÙ?:
+
+ gettor+zh@xxxxxxxxxxxxxx
+
+ در اÛ?Ù? Ù?ثاÙ?Ø? Ù?رستÙ?دÙ? Ø®Ù?اÙ?اÙ? Ù?سخÙ? ترجÙ?Ù? شدÙ? بÙ? زباÙ? Ú?Û?Ù?Û? Ù?Û? باشد. براÛ? آگاÙ?Û?
+ از کدÙ?اÛ? Ù?ربÙ?Ø· بÙ? زباÙ?Ù?اÛ? Ù?ابÙ? پشتÛ?باÙ?Û? تÙ?سط Tor Ø? Ù?Ù?رست زÛ?ر را Ù?طاÙ?عÙ? Ú©Ù?Û?د:
+ Ù?Ù?رست زباÙ?Ù?اÛ? پشتÛ?اÙ?Û? شدÙ?
+ -------------------------
+
+ gettor+ar@xxxxxxxxxxxxxx: Arabic
+ gettor+de@xxxxxxxxxxxxxx: German
+ gettor+en@xxxxxxxxxxxxxx: English
+ gettor+es@xxxxxxxxxxxxxx: Spanish
+ gettor+fa@xxxxxxxxxxxxxx: Farsi (Iran)
+ gettor+fr@xxxxxxxxxxxxxx: French
+ gettor+it@xxxxxxxxxxxxxx: Italian
+ gettor+nl@xxxxxxxxxxxxxx: Dutch
+ gettor+pl@xxxxxxxxxxxxxx: Polish
+ gettor+ru@xxxxxxxxxxxxxx: Russian
+ gettor+zh@xxxxxxxxxxxxxx: Chinese
+
+ Ú?Ù?اÙ?Ú?Ù? Ù?Û?Ú?Û?Ú© از زباÙ?Ù?اÛ? Ù?Ù?Ù? را اÙ?تخاب Ù?Ú©Ù?Û?دØ? Ù?سخÙ? اÙ?Ú¯Ù?Û?سÛ? براÛ? Ø´Ù?ا ارساÙ?
+ Ø®Ù?اÙ?د شد.
+
+ پشتÛ?باÙ?Û?
+ =======
+
+ Ú?Ù?اÙ?Ú?Ù? سÙ?اÙ?Û? دارÛ?د Û?ا برÙ?اÙ?Ù? دÚ?ار اشکاÙ? بÙ?دÙ? Ù? کار Ù?Ù?Û? Ú©Ù?د Ø? با Ù?سÙ?ت
+ پشتÛ?باÙ?Û? با آدرس زÛ?ر تÙ?اس بگÛ?رÛ?د تا Û?Ú© اÙ?ساÙ? بÙ? سÙ?اÙ? Ø´Ù?ا پاسخ دÙ?د: tor-assistants@xxxxxxxxxxxxxx
+
+ --
+
+ Hei, dette er "GetTor"-roboten
+
+ Jeg kommer til å sende deg en Tor-pakke, hvis du forteller meg hvilken du
+ vil ha.
+ Vennligst velg en av følgende pakkenavn:
+
+ tor-browser-bundle
+ macosx-i386-bundle
+ macosx-ppc-bundle
+ linux-browser-bundle-i386
+ linux-browser-bundle-x86_64
+ source-bundle
+
+ Vennligst svar til denne eposten (til gettor@xxxxxxxxxxxxxx), og nevn
+ kun et enkelt pakkenavn i tekstområdet til eposten din.
+
+ SKAFFE LOKALISERTE VERSJONER AV TOR
+ ===================================
+
+ For å skaffe en versjon av Tor som har blitt oversatt til ditt språk,
+ spesifiser språket du vil i epostadressen du sender eposten til:
+
+ gettor+zh@xxxxxxxxxxxxxx
+
+ Dette eksempelet vil gi deg en forespurt pakke som er en oversatt
+ versjon for kinesisk. Se listen nedenfor for hvilke språk det er støtte for.
+
+ Liste av støttede språk:
+ -------------------------
+
+ Her er en liste av språkene som er tilgjengelig:
+
+ gettor+ar@xxxxxxxxxxxxxx: Arabisk
+ gettor+de@xxxxxxxxxxxxxx: Tysk
+ gettor+en@xxxxxxxxxxxxxx: Engelsk
+ gettor+es@xxxxxxxxxxxxxx: Spansk
+ gettor+fa@xxxxxxxxxxxxxx: Farsi (Iran)
+ gettor+fr@xxxxxxxxxxxxxx: Fransk
+ gettor+it@xxxxxxxxxxxxxx: Italiensk
+ gettor+nl@xxxxxxxxxxxxxx: Nederlandsk
+ gettor+pl@xxxxxxxxxxxxxx: Polsk
+ gettor+ru@xxxxxxxxxxxxxx: Russisk
+ gettor+zh@xxxxxxxxxxxxxx: Kinesisk
+
+ Hvis du ikke spesifiserer noen språk vil du motta standard Engelsk
+ versjon
+
+ STÃ?TTE
+ =======
+
+ Hvis du har noen spørsmål eller det ikke virker, kan du kontakte et
+ menneske på denne support-eposten: tor-assistants@xxxxxxxxxxxxxx
+
+ --
+
+ Olá! Este é o robot "GetTor".
+
+ Eu envio-lhe um pacote Tor, bastando para isso dizer qual o que quer.
+ Escolha um dos seguintes pacotes:
+
+ tor-browser-bundle
+ macosx-i386-bundle
+ macosx-ppc-bundle
+ linux-browser-bundle-i386
+ linux-browser-bundle-x86_64
+ source-bundle
+
+ Por favor responda a esta email (para gettor@xxxxxxxxxxxxxx), e diga qual o
+ pacote que deseja, colocando o seu nome no corpo do seu email.
+
+ OBTER VERSÃ?ES TRADUZIDAS DO TOR
+ ===================================
+
+ Para lhe ser enviado uma versão traduzida do Tor, especifique a lÃngua no
+ destinatário do seu email:
+
+ gettor+zh@xxxxxxxxxxxxxx
+
+ Este exemplo vai enviar o pacote traduzido para Chinês Simplificado. Veja a
+ lista de endereços de email existentes que pode utilizar:
+
+ Lista de endereços de email suportados:
+ -------------------------
+
+ gettor+pt@xxxxxxxxxxxxxx: Português
+ gettor+ar@xxxxxxxxxxxxxx: Arábico
+ gettor+de@xxxxxxxxxxxxxx: Alemão
+ gettor+en@xxxxxxxxxxxxxx: Inglês
+ gettor+es@xxxxxxxxxxxxxx: Espanhol
+ gettor+fa@xxxxxxxxxxxxxx: Farsi (Irão)
+ gettor+fr@xxxxxxxxxxxxxx: Francês
+ gettor+it@xxxxxxxxxxxxxx: Italiano
+ gettor+nl@xxxxxxxxxxxxxx: Holandês
+ gettor+pl@xxxxxxxxxxxxxx: Polaco
+ gettor+ru@xxxxxxxxxxxxxx: Russo
+ gettor+zh@xxxxxxxxxxxxxx: Chinês
+
+ Se não escolher nenhuma lÃngua, receberá o Tor em Inglês.
+
+ SUPORTE
+ =======
+
+ Se tiver alguma dúvida, pode contactar um humano através do seguinte
+ endereço: tor-assistants@xxxxxxxxxxxxxx
+
+ --
+
+ Ð?дÑ?авÑ?Ñ?вÑ?йÑ?е! ÐÑ?о "Ñ?обоÑ? GetTor".
+
+ Я оÑ?оÑ?лÑ? вам пакеÑ? Tor еÑ?ли вÑ? Ñ?кажеÑ?е коÑ?оÑ?Ñ?й вÑ? Ñ?оÑ?иÑ?е.
+ Ð?ожалÑ?йÑ?Ñ?а вÑ?беÑ?иÑ?е один из пакеÑ?ов:
+
+ tor-browser-bundle
+ macosx-i386-bundle
+ macosx-ppc-bundle
+ linux-browser-bundle-i386
+ linux-browser-bundle-x86_64
+ source-bundle
+
+ Ð?ожалÑ?йÑ?Ñ?а Ñ?вÑ?жиÑ?еÑ?Ñ? Ñ? нами по Ñ?Ñ?ой Ñ?лкÑ?Ñ?онной поÑ?Ñ?е
+ (gettor@xxxxxxxxxxxxxx), и Ñ?кажиÑ?е
+ название одного из пакеÑ?ов в лÑ?бом меÑ?Ñ?е в "Ñ?еле" ваÑ?его пиÑ?Ñ?ма.
+
+ Ð?Ð?Ð?УЧÐ?Ð?Ð?Ð? Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð Ð?Ð?Ð?Ð?Ð?ЫХ Ð?Ð?РСÐ?Ð? TOR
+ ===================================
+
+ ЧÑ?обÑ? полÑ?Ñ?иÑ?Ñ? веÑ?Ñ?иÑ? Tor пеÑ?еведеннÑ?Ñ? на ваÑ? Ñ?зÑ?к,Ñ?кажиÑ?е
+ пÑ?едпоÑ?иÑ?аемÑ?й Ñ?зÑ?к в адÑ?еÑ?ной Ñ?Ñ?Ñ?оке кÑ?да вÑ? оÑ?оÑ?лали Ñ?лекÑ?Ñ?оннÑ?Ñ? поÑ?Ñ?Ñ?:
+
+ gettor+zh@xxxxxxxxxxxxxx
+
+ Ð?Ñ?Ñ?еÑ?казаннÑ?й пÑ?имеÑ? даÑ?Ñ? вам запÑ?оÑ?еннÑ?й пакеÑ? в локализиÑ?ованной
+ веÑ?Ñ?ии киÑ?айÑ?кого Ñ?зÑ?ка. Ð?Ñ?овеÑ?Ñ?Ñ?е ниже Ñ?пиÑ?ок кодов поддеÑ?живаемÑ?Ñ?
+ Ñ?зÑ?ков.
+
+ СпиÑ?ок поддеÑ?живаемÑ?Ñ? Ñ?егионов
+ -------------------------
+
+ Ð?иже Ñ?казан Ñ?пиÑ?ок вÑ?еÑ? доÑ?Ñ?Ñ?пнÑ?Ñ? Ñ?зÑ?ков:
+
+ gettor+ar@xxxxxxxxxxxxxx: аÑ?абÑ?кий
+ gettor+de@xxxxxxxxxxxxxx: немеÑ?кий
+ gettor+en@xxxxxxxxxxxxxx: английÑ?кий
+ gettor+es@xxxxxxxxxxxxxx: иÑ?панÑ?кий
+ gettor+fa@xxxxxxxxxxxxxx: Ñ?аÑ?Ñ?и (Ð?Ñ?ан)
+ gettor+fr@xxxxxxxxxxxxxx: Ñ?Ñ?анÑ?Ñ?зÑ?кий
+ gettor+it@xxxxxxxxxxxxxx: иÑ?алÑ?Ñ?нÑ?кий
+ gettor+nl@xxxxxxxxxxxxxx: голландÑ?кий
+ gettor+pl@xxxxxxxxxxxxxx: полÑ?Ñ?кий
+ gettor+ru@xxxxxxxxxxxxxx: Ñ?Ñ?Ñ?Ñ?кий
+ gettor+zh@xxxxxxxxxxxxxx: киÑ?айÑ?кий
+
+ Ð?Ñ?ли вÑ? не вÑ?беÑ?иÑ?е Ñ?зÑ?к, вÑ? полÑ?Ñ?иÑ?е веÑ?Ñ?иÑ? на английÑ?ком Ñ?зÑ?ке.
+
+ Ð?Ð?Ð?Ð?Ð?Ð Ð?Ð?Ð?
+ =======
+
+ Ð?Ñ?ли Ñ? ваÑ? вопÑ?оÑ?Ñ? или Ñ?Ñ?о Ñ?о не Ñ?Ñ?абоÑ?ало, вÑ? можеÑ?е Ñ?вÑ?заÑ?Ñ?Ñ?Ñ?
+ Ñ? живÑ?м пÑ?едÑ?Ñ?авиÑ?елем по Ñ?Ñ?омÑ? Ñ?лекÑ?Ñ?онномÑ? адÑ?еÑ?Ñ?:tor-assistants@xxxxxxxxxxxxxx
+
+ --
+
+ ä½ å¥½, è¿?é??æ?¯"GetTor"è?ªå?¨å??å¤?ã??
+
+ æ?¨ä»?è¿?é??å?¯ä»¥å¾?å?°Torå¥?件, 请å??è¯?æ??æ?¨é??è¦?ç??å¥?件ç§?ç±».
+ 请é??æ?©å¥?件å??称:
+
+ tor-browser-bundle
+ (Tor+Firefox���)
+ macosx-i386-bundle
+ (Tor for MacOS)
+ macosx-ppc-bundle
+ (Tor for MacOS on PowerPC )
+ linux-browser-bundle-i386
+ linux-browser-bundle-x86_64
+ (Tor for Linux)
+ source-bundle
+ (æº?ç ?å??)
+
+ 请ç?´æ?¥å??å¤?æ?¬é?®ä»¶(gettor@xxxxxxxxxxxxxx),
+ 并å?¨ä¿¡ç??æ£æ??ä¸å??好æ?¨æ??é??è¦?ç??å¥?件å??称ï¼?ä¸?å??æ?¬æ?¬å?·å??ç??ä¸æ??ï¼?ã??
+
+ è?·å??å?¶ä»?è¯è¨?ç??Torå¥?件
+ ===================================
+
+ å?¨æ?¶ä»¶äººå?°å??ä¸æ??å®?è¯è¨?代ç ?å?¯ä»¥è?·å¾?æ?¬å¯¹åº?è¯è¨?ç??ç??æ?¬ï¼?ä¾?å¦?ï¼?
+
+ gettor+zh@xxxxxxxxxxxxxx
+
+ æ?¬ä¾?ä¸ï¼?æ?¨å°?å¾?å?°ä¸æ??ç??ç??Torå¥?件ï¼?ä¸?é?¢æ?¯ç?®å??æ?¯æ??ç??è¯ç§?代ç ?ï¼?
+
+ æ?¯æ??è¯è¨?å??表:
+ -------------------------
+
+ å?¨é?¨å?¯ç?¨è¯è¨?å??表:
+
+ gettor+ar@xxxxxxxxxxxxxx: Arabic
+ gettor+de@xxxxxxxxxxxxxx: German
+ gettor+en@xxxxxxxxxxxxxx: English
+ gettor+es@xxxxxxxxxxxxxx: Spanish
+ gettor+fa@xxxxxxxxxxxxxx: Farsi (Iran)
+ gettor+fr@xxxxxxxxxxxxxx: French
+ gettor+it@xxxxxxxxxxxxxx: Italian
+ gettor+nl@xxxxxxxxxxxxxx: Dutch
+ gettor+pl@xxxxxxxxxxxxxx: Polish
+ gettor+ru@xxxxxxxxxxxxxx: Russian
+ gettor+zh@xxxxxxxxxxxxxx: ä¸æ??
+
+ å¦?æ??æ?¨æ?ªæ??å®?è¯è¨?代ç ?ï¼?æ?¨å°?æ?¶å?°è?±æ??ç??ã??
+
+ æ?¯æ??
+ =======
+
+ å¦?æ??æ?¨é??å?°å?°é?¾æ??æ??å?¡å?ºç?°é?®é¢?ï¼?请è??ç³»æ??们ç??
+ æ??æ?¯æ?¯æ??é?®ç®±: tor-assistants@xxxxxxxxxxxxxx
+
+ --
+ """
+
+GETTOR_TEXT = [
+ # GETTOR_TEXT[0]
+_("""Hello, This is the "GetTor" robot.
+
+Thank you for your request."""),
+ # GETTOR_TEXT[1]
+_(""" Unfortunately, we won't answer you at this address. You should make
+an account with GMAIL.COM or YAHOO.CN and send the mail from
+one of those."""),
+ # GETTOR_TEXT[2]
+_("""We only process requests from email services that support "DKIM",
+which is an email feature that lets us verify that the address in the
+"From" line is actually the one who sent the mail."""),
+ # GETTOR_TEXT[3]
+_("""(We apologize if you didn't ask for this mail. Since your email is from
+a service that doesn't use DKIM, we're sending a short explanation,
+and then we'll ignore this email address for the next day or so.)"""),
+ # GETTOR_TEXT[4]
+_("""Please note that currently, we can't process HTML emails or base 64
+mails. You will need to send plain text."""),
+ # GETTOR_TEXT[5]
+_("""If you have any questions or it doesn't work, you can contact a
+human at this support email address: tor-assistants@xxxxxxxxxxxxxx"""),
+ # GETTOR_TEXT[6]
+_("""I will mail you a Tor package, if you tell me which one you want.
+Please select one of the following package names:"""),
+ # GETTOR_TEXT[7]
+_("""Please reply to this mail (to gettor@xxxxxxxxxxxxxx), and tell me
+a single package name anywhere in the body of your email."""),
+ # GETTOR_TEXT[8]
+_(""" OBTAINING LOCALIZED VERSIONS OF TOR
+==================================="""),
+ # GETTOR_TEXT[9]
+_("""To get a version of Tor translated into your language, specify the
+language you want in the address you send the mail to:"""),
+ # GETTOR_TEXT[10]
+_("""This example will give you the requested package in a localized
+version for Chinese. Check below for a list of supported language
+codes. """),
+ # GETTOR_TEXT[11]
+_(""" List of supported locales:
+-------------------------"""),
+ # GETTOR_TEXT[12]
+_("""Here is a list of all available languages:"""),
+ # GETTOR_TEXT[13]
+_(""" gettor+ar@xxxxxxxxxxxxxx: Arabic
+ gettor+de@xxxxxxxxxxxxxx: German
+ gettor+en@xxxxxxxxxxxxxx: English
+ gettor+es@xxxxxxxxxxxxxx: Spanish
+ gettor+fa@xxxxxxxxxxxxxx: Farsi (Iran)
+ gettor+fr@xxxxxxxxxxxxxx: French
+ gettor+it@xxxxxxxxxxxxxx: Italian
+ gettor+nl@xxxxxxxxxxxxxx: Dutch
+ gettor+pl@xxxxxxxxxxxxxx: Polish
+ gettor+ru@xxxxxxxxxxxxxx: Russian
+ gettor+zh@xxxxxxxxxxxxxx: Chinese"""),
+ # GETTOR_TEXT[14]
+_("""If you select no language, you will receive the English version."""),
+ # GETTOR_TEXT[15]
+_("""SMALLER SIZED PACKAGES
+======================"""),
+ # GETTOR_TEXT[16]
+_("""If your bandwith is low or your provider doesn't allow you to
+receive large attachments in your email, there is a feature of
+GetTor you can use to make it send you a number of small packages
+instead of one big one."""),
+ # GETTOR_TEXT[17]
+_("""Simply include the keyword 'split' somewhere in your email like so:"""),
+ # GETTOR_TEXT[18]
+_("""Sending this text in an email to GetTor will cause it to send you
+the Tor Browser Bundle in a number of 1,4MB attachments."""),
+ # GETTOR_TEXT[19]
+_("""After having received all parts, you need to re-assemble them to
+one package again. This is done as follows:"""),
+ # GETTOR_TEXT[20]
+_("""1.) Save all received attachments into one folder on your disk."""),
+ # GETTOR_TEXT[21]
+_("""2.) Unzip all files ending in ".z". If you saved all attachments to
+a fresh folder before, simply unzip all files in that folder."""),
+ # GETTOR_TEXT[22]
+_("""3.) Verify all files as described in the mail you received with
+each package. (gpg --verify)"""),
+ # GETTOR_TEXT[23]
+_("""4.) Now use a program that can unrar multivolume RAR archives. On
+Windows, this usually is WinRAR. If you don't have that
+installed on you computer yet, get it here:"""),
+ # GETTOR_TEXT[24]
+_("""To unpack your Tor package, simply doubleclick the ".exe" file."""),
+ # GETTOR_TEXT[25]
+_("""5.) After unpacking is finished, you should find a newly created
+".exe" file in your destination folder. Simply doubleclick
+that and Tor Browser Bundle should start within a few seconds."""),
+ # GETTOR_TEXT[26]
+_("""6.) That's it. You're done. Thanks for using Tor and have fun!"""),
+ # GETTOR_TEXT[27]
+_("""SUPPORT
+======="""),
+ # GETTOR_TEXT[28]
+_("""If you have any questions or it doesn't work, you can contact a
+human at this support email address: tor-assistants@xxxxxxxxxxxxxx"""),
+ # GETTOR_TEXT[29]
+_(""" Here's your requested software as a zip file. Please unzip the
+package and verify the signature."""),
+ # GETTOR_TEXT[30]
+_("""Hint: If your computer has GnuPG installed, use the gpg
+commandline tool as follows after unpacking the zip file:"""),
+ # GETTOR_TEXT[31]
+_("""The output should look somewhat like this:"""),
+ # GETTOR_TEXT[32]
+_("""If you're not familiar with commandline tools, try looking for
+a graphical user interface for GnuPG on this website:"""),
+ # GETTOR_TEXT[33]
+_("""If your Internet connection blocks access to the Tor network, you
+may need a bridge relay. Bridge relays (or "bridges" for short)
+are Tor relays that aren't listed in the main directory. Since there
+is no complete public list of them, even if your ISP is filtering
+connections to all the known Tor relays, they probably won't be able
+to block all the bridges."""),
+ # GETTOR_TEXT[34]
+_("""You can acquire a bridge by sending an email that contains "get bridges"
+in the body of the email to the following email address:"""),
+ # GETTOR_TEXT[35]
+_("""It is also possible to fetch bridges with a web browser at the following
+url: https://bridges.torproject.org/"""),
+ # GETTOR_TEXT[36]
+_("""IMPORTANT NOTE:
+Since this is part of a split-file request, you need to wait for
+all split files to be received by you before you can save them all
+into the same directory and unpack them by double-clicking the
+first file."""),
+ # GETTOR_TEXT[37]
+_("""Packages mighit come out of order! Please make sure you received
+all packages before you attempt to unpack them!"""),
+ # GETTOR_TEXT[38]
+_("""Thank you for your request.
+It was successfully understood. Your request is currently being processed.
+Your package should arrive within the next ten minutes."""),
+ # GETTOR_TEXT[39]
+_("""If it doesn't arrive, the package might be too big for your mail provider.
+Try resending the mail from a GMAIL.COM or YAHOO.COM account."""),
+ # GETTOR_TEXT[40]
+_("""Unfortunately we are currently experiencing problems and we can't fulfill
+your request right now. Please be patient as we try to resolve this issue.""")
+]
diff --git a/lib/gettor/requests.py b/lib/gettor/requests.py
index bcf461f..a61ac14 100644
--- a/lib/gettor/requests.py
+++ b/lib/gettor/requests.py
@@ -23,7 +23,6 @@ class requestMail:
self.request['user'] = self.parsedMessage["Return-Path"]
self.request['ouraddr'] = self.getRealTo(self.parsedMessage["to"])
self.request['locale'] = self.getLocaleInTo(self.request['ouraddr'])
- self.request['plus'] = False # Was this a gettor+lang@ request?
self.request['package'] = None
self.request['split'] = False
self.request['forward'] = None
@@ -52,7 +51,7 @@ class requestMail:
if match:
locale = match.group(3)
logging.debug("User requested language %s" % locale)
- return locale
+ return self.checkAndGetLocale(locale)
else:
logging.debug("Not a 'plus' address")
return self.config.DEFAULT_LOCALE
@@ -147,7 +146,6 @@ class requestMail:
"""
for (lang, aliases) in self.config.SUPP_LANGS.items():
if lang == locale:
- logging.debug("User requested lang %s" % lang)
return locale
if aliases is not None:
if locale in aliases:
diff --git a/lib/gettor/responses.py b/lib/gettor/responses.py
index f0f11b7..248c0ac 100644
--- a/lib/gettor/responses.py
+++ b/lib/gettor/responses.py
@@ -15,8 +15,88 @@ from email.mime.base import MIMEBase
from email.mime.text import MIMEText
import gettor.blacklist
+import gettor.i18n as i18n
-trans = None
+def getPackageHelpMsg(t):
+ return t.gettext(i18n.GETTOR_TEXT[0]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[6]) + "\n\n" \
+ + """ tor-browser-bundle
+ macosx-i386-bundle
+ macosx-ppc-bundle
+ linux-browser-bundle-i386
+ linux-browser-bundle-x86_64
+ source-bundle""" + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[7]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[8]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[9]) + "\n\n" \
+ + " gettor+zh_CN@xxxxxxxxxxxxxx" + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[10]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[11]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[12]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[13]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[14]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[15]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[16]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[17]) + "\n\n" \
+ + " tor-browser-bundle" + "\n" \
+ + " split" + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[18]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[19]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[20]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[21]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[22]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[23]) + "\n\n" \
+ + " http://www.win-rar.com/download.html" + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[23]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[24]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[25]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[26]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[27]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[28]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[33]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[34]) + "\n\n" \
+ + " bridges@xxxxxxxxxxxxxx" + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[34]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[35]) + "\n"
+
+def getPackageMsg(t):
+ return t.gettext(i18n.GETTOR_TEXT[0]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[29]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[30]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[31]) + "\n\n" \
+ + " gpg: Good signature from 'Roger Dingledine <arma@xxxxxxx>'" \
+ + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[32]) + "\n\n" \
+ + " http://www.gnupg.org/related_software/frontends.html" \
+ + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[33]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[34]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[35]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[27]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[28]) + "\n"
+
+def getSplitPackageMsg(t):
+ return t.gettext(i18n.GETTOR_TEXT[0]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[36]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[37]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[19]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[20]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[21]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[22]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[23]) + "\n\n" \
+ + " http://www.win-rar.com/download.html" + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[24]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[25]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[26]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[27]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[28]) + "\n"
+
+def getDelayAlertMsg(t):
+ return t.gettext(i18n.GETTOR_TEXT[0]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[38]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[39]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[27]) + "\n\n" \
+ + t.gettext(i18n.GETTOR_TEXT[28]) + "\n"
class Response:
def __init__(self, config, reqInfo):
@@ -29,28 +109,15 @@ class Response:
# Dump info
logging.info(str(self.reqInfo))
- # Initialize the reply language usage
- try:
- localeDir = os.path.join(self.config.BASEDIR, "i18n")
- t = gettext.translation("gettor", localeDir, [reqInfo['locale']])
- t.install()
- # OMG TEH HACK!! Constants need to be imported *after* we've
- # initialized the locale/gettext subsystem
- import gettor.constants
- except IOError:
- logging.error("Translation fail. Trying running with -r.")
- raise
+ # Initialize locale subsystem
+ gettext.install("gettor", unicode=True)
+ self.t = i18n.getLang(self.reqInfo['locale'])
# Init black & whitelists
wlStateDir = os.path.join(self.config.BASEDIR, "wl")
blStateDir = os.path.join(self.config.BASEDIR, "bl")
self.wList = gettor.blacklist.BWList(wlStateDir)
self.bList = gettor.blacklist.BWList(blStateDir)
- # Check blacklist section 'general' list & Drop if necessary
- # XXX: This should learn wildcards
- bListed = self.bList.lookupListEntry(self.reqInfo['user'], "general")
- assert bListed is not True, \
- "Mail from blacklisted user %s" % self.reqInfo['user']
def sendReply(self):
"""All routing decisions take place here. Sending of mails takes place
@@ -89,6 +156,10 @@ class Response:
if self.wList.lookupListEntry(self.reqInfo['user'], "general"):
logging.info("Whitelisted user " + self.reqInfo['user'])
return False
+ # Now check general and specific blacklists, in that order
+ if self.bList.lookupListEntry(self.reqInfo['user'], "general"):
+ logging.info("Blacklisted user " + self.reqInfo['user'])
+ return True
# Create a unique dir name for the requested routine
self.bList.createSublist(fname)
if self.bList.lookupListEntry(self.reqInfo['user'], fname):
@@ -110,7 +181,7 @@ class Response:
return False
logging.info("Sending out %s to %s." % (pack, to))
f = os.path.join(self.config.BASEDIR, "packages", pack + ".z")
- txt = gettor.constants.packagemsg
+ txt = getPackageMsg(self.t)
msg = self.makeMsg(txt, to, fileName=f)
try:
status = self.sendEmail(to, msg)
@@ -130,7 +201,7 @@ class Response:
to = self.reqInfo['user']
logging.info("Sending out %s to %s." % (pack, fwd))
f = os.path.join(self.config.BASEDIR, "packages", pack + ".z")
- text = gettor.constants.packagemsg
+ text = getPackageMsg(self.t)
msg = self.makeMsg(text, fwd, fileName=f)
try:
status = self.sendEmail(fwd, msg)
@@ -172,7 +243,7 @@ class Response:
path = os.path.join(splitDir, filename)
num = num + 1
sub = "[GetTor] Split package [%02d / %02d] " % (num, nFiles)
- txt = gettor.constants.splitpackagemsg
+ txt = getSplitPackageMsg(self.t)
msg = self.makeMsg(txt, sub, self.reqInfo['user'], fileName=path)
try:
status = self.sendEmail(self.reqInfo['user'], msg)
@@ -193,7 +264,7 @@ class Response:
# Don't send anything
return False
logging.info("Sending delay alert to %s" % self.reqInfo['user'])
- return self.sendTextEmail(gettor.constants.delayalertmsg)
+ return self.sendTextEmail(getDelayAlertMsg(self.t))
def sendHelp(self):
"""Send a help mail. This happens when a user sent us a request we
@@ -203,7 +274,7 @@ class Response:
# Don't send anything
return False
logging.info("Sending out help message to %s" % self.reqInfo['user'])
- return self.sendTextEmail(gettor.constants.helpmsg)
+ return self.sendTextEmail(getPackageHelpMsg(self.t))
def sendPackageHelp(self):
"""Send a helpful message to the user interacting with us about
@@ -213,7 +284,7 @@ class Response:
# Don't send anything
return False
logging.info("Sending package help to %s" % self.reqInfo['user'])
- return self.sendTextEmail(gettor.constants.multilangpackagehelpmsg)
+ return self.sendTextEmail(i18n.MULTILANGHELP)
def sendTextEmail(self, text):
"""Generic text message sending routine.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits