[tor-commits] [gettor/master] Clean up the whole i18n infrastructure. More clean & straightforward now.
kaner at torproject.org
kaner at torproject.org
Thu Feb 24 19:12:00 UTC 2011
commit d412a5fedfdf2e227ac88311e7dfa3691c0fd5ae
Author: Christian Fromme <kaner at strace.org>
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 at 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 at torproject.org>"
# 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 at hostname:~/opt/gettor$ python GetTor.py -b someone at evil.org
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 at appelbaum.net>,
-# Christian Fromme <kaner at strace.org>
-# 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 at torproject.org)Ø ÙØªØ®Ø¨Ø±ÙÙ
- باسÙ
ØØ²Ù
Ø© ÙØ§ØØ¯Ø© ÙÙØ· Ù٠أ٠Ù
ÙØ§Ù ضÙ
Ù Ø±Ø³Ø§ÙØ© Ø§ÙØ±Ø¯.
-
- Ø§ÙØØµÙ٠عÙ٠إصدارات Ù
ترجÙ
Ø© Ù
Ù ØªÙØ±
- ========================
-
- ÙØªØØµÙ عÙ٠إصدار ØªÙØ± Ù
ترجÙ
Ø¥ÙÙ ÙØºØªÙØ ÙØ±Ø¬Ù Ø£Ù ØªØØ¯Ø¯
- اÙÙØºØ© Ø§ÙØªÙ ØªØ±ÙØ¯ ضÙ
Ù Ø§ÙØ¹ÙÙØ§Ù Ø§ÙØ°Ù Ø³ØªØ±Ø³Ù Ø§ÙØ±Ø³Ø§ÙØ© Ø§ÙØ¥ÙÙØªØ±ÙÙÙØ© Ø¥ÙÙÙ:
-
- gettor+zh at torproject.org
-
- ÙØ°Ø§ اÙÙ
Ø«Ø§Ù ÙØ¹Ø·ÙÙ Ø§ÙØØ²Ù
Ø© اÙÙ
Ø·ÙÙØ¨Ø© Ù
ترجÙ
Ø©
- ÙÙØºØ© Ø§ÙØµÙÙÙØ©. تØÙÙ Ù
٠اÙÙØ§Ø¦Ù
Ø© Ø£Ø¯ÙØ§Ù ÙØªØ¬Ø¯ رÙ
ÙØ² اÙÙØºØ§Øª
- اÙÙ
دعÙÙ
Ø©.
-
- ÙØ§Ø¦Ù
Ø© اÙÙØºØ§Øª اÙÙ
دعÙÙ
Ø©:
- -------------------
-
- ÙØ§ ÙÙ ÙØ§Ø¦Ù
Ø© اÙÙØºØ§Øª اÙÙ
تÙÙØ±Ø©:
-
- gettor+ar at torproject.org: Ø§ÙØ¹Ø±Ø¨ÙØ©
- gettor+de at torproject.org: Ø§ÙØ£ÙÙ
اÙÙØ©
- gettor+en at torproject.org: Ø§ÙØ¥ÙÙÙÙØ²ÙØ©
- gettor+es at torproject.org: Ø§ÙØ¥Ø³Ø¨Ø§ÙÙØ©
- gettor+fa at torproject.org: اÙÙØ§Ø±Ø³ÙØ©
- gettor+fr at torproject.org: اÙÙØ±ÙØ³ÙØ©
- gettor+it at torproject.org: Ø§ÙØ¥ÙطاÙÙØ©
- gettor+nl at torproject.org: اÙÙÙÙÙØ¯ÙØ©
- gettor+pl at torproject.org: Ø§ÙØ¨ÙÙÙØ¯ÙØ©
- gettor+ru at torproject.org: Ø§ÙØ±ÙØ³ÙØ©
- gettor+zh at torproject.org: Ø§ÙØµÙÙÙØ©
-
- Ø¥Ù ÙÙ
تÙÙ
Ø¨Ø§Ø®ØªÙØ§Ø± ÙØºØ© ÙØ³ØªØØµÙ عÙÙ Ø§ÙØ¥ØµØ¯Ø§Ø±Ø© Ø§ÙØ¥ÙÙÙÙØ²ÙØ©.
-
- Ø§ÙØ¯Ø¹Ù
اÙÙÙÙ
- =======
-
- Ø¥Ù ÙØ§Ùت ÙØ¯ÙÙ Ø£ÙØ© Ø£Ø³Ø¦ÙØ© أ٠إذا ÙÙ
ÙØ¹Ù
Ù ÙØ°Ø§ Ø§ÙØÙ ÙÙ
ÙÙÙ Ø§ÙØ§ØªØµØ§Ù Ø¨ÙØ§Ø¦Ù
- بشر٠عÙ٠عÙÙØ§Ù Ø§ÙØ¯Ø¹Ù
اÙÙÙÙ Ø§ÙØªØ§ÙÙ: tor-assistants at torproject.org
-
- --
-
- Ø³ÙØ§Ù
! Ø±ÙØ¨Ø§Øª "GetTor" در خدÙ
ت Ø´Ù
است.
-
- ÚÙØ§ÙÚ٠ب٠Ù
٠بگÙÛÛØ¯ ک٠ب٠کداÙ
ÛÚ© از Ø¨Ø³ØªÙ ÙØ§Û Tor ÙÛØ§Ø² Ø¯Ø§Ø±ÛØ¯Ø آ٠را Ø¨Ø±Ø§Û Ø´Ù
ا
- Ø§Ø±Ø³Ø§Ù Ø®ÙØ§ÙÙ
کرد.
- ÙØ·Ùا ÛÚ©Û Ø§Ø² Ø¨Ø³ØªÙ ÙØ§Û را Ø²ÛØ± با ذکر ÙØ§Ù
Ø§ÙØªØ®Ø§Ø¨ Ú©ÙÛØ¯:
-
- tor-browser-bundle
- macosx-i386-bundle
- macosx-ppc-bundle
- linux-browser-bundle-i386
- linux-browser-bundle-x86_64
- source-bundle
-
- ÙØ·Ùا ب٠اÛÙ ÙØ§Ù
٠پاسخ داد٠( ب٠آدرس gettor at torproject.org ) ٠در ÙØ³Ù
ØªÛ Ø§Ø²
- Ù
ت٠اÛÙ
ÛÙ Ø®ÙØ¯ ÙØ§Ù
ÛÚ©Û Ø§Ø² Ø¨Ø³ØªÙ ÙØ§Û ÙÙ٠را ذکر Ú©ÙÛØ¯.
-
- تÙÛÙ ÙØ³Ø®Ù ترجÙ
٠شد٠TOR
- ===================================
-
- Ø¨Ø±Ø§Û Ø¯Ø±ÛØ§Ùت ÙØ³Ø®Ù Ø§Û Ø§Ø² TOR ترجÙ
٠شد٠ب٠زبا٠Ù
ØÙÛ Ø´Ù
Ø§Ø Ù
Û Ø¨Ø§ÛØ³ØªÛ زبا٠Ù
ÙØ±Ø¯
- ÙØ¸Ø± Ø®ÙØ¯ را در آدرس Ú¯ÛØ±Ùد٠اÛÙ
Û٠ذکر Ú©ÙÛØ¯. بعÙÙØ§Ù Ù
ثاÙ:
-
- gettor+zh at torproject.org
-
- در اÛÙ Ù
Ø«Ø§ÙØ ÙØ±Ø³ØªÙØ¯Ù Ø®ÙØ§ÙØ§Ù ÙØ³Ø®Ù ترجÙ
٠شد٠ب٠زبا٠ÚÛÙÛ Ù
Û Ø¨Ø§Ø´Ø¯. Ø¨Ø±Ø§Û Ø¢Ú¯Ø§ÙÛ
- از Ú©Ø¯ÙØ§Û Ù
Ø±Ø¨ÙØ· ب٠زباÙÙØ§Û ÙØ§Ø¨Ù Ù¾Ø´ØªÛØ¨Ø§ÙÛ ØªÙØ³Ø· Tor Ø ÙÙØ±Ø³Øª Ø²ÛØ± را Ù
Ø·Ø§ÙØ¹Ù Ú©ÙÛØ¯:
- ÙÙØ±Ø³Øª زباÙÙØ§Û Ù¾Ø´ØªÛØ§ÙÛ Ø´Ø¯Ù
- -------------------------
-
- gettor+ar at torproject.org: Arabic
- gettor+de at torproject.org: German
- gettor+en at torproject.org: English
- gettor+es at torproject.org: Spanish
- gettor+fa at torproject.org: Farsi (Iran)
- gettor+fr at torproject.org: French
- gettor+it at torproject.org: Italian
- gettor+nl at torproject.org: Dutch
- gettor+pl at torproject.org: Polish
- gettor+ru at torproject.org: Russian
- gettor+zh at torproject.org: Chinese
-
- ÚÙØ§ÙÚÙ ÙÛÚÛÚ© از زباÙÙØ§Û ÙÙ٠را Ø§ÙØªØ®Ø§Ø¨ ÙÚ©ÙÛØ¯Ø ÙØ³Ø®Ù اÙÚ¯ÙÛØ³Û Ø¨Ø±Ø§Û Ø´Ù
ا ارساÙ
- Ø®ÙØ§Ùد شد.
-
- Ù¾Ø´ØªÛØ¨Ø§ÙÛ
- =======
-
- ÚÙØ§ÙÚÙ Ø³ÙØ§ÙÛ Ø¯Ø§Ø±ÛØ¯ ÛØ§ Ø¨Ø±ÙØ§Ù
Ù Ø¯ÚØ§Ø± Ø§Ø´Ú©Ø§Ù Ø¨ÙØ¯Ù ٠کار ÙÙ
Û Ú©ÙØ¯ Ø Ø¨Ø§ ÙØ³Ù
ت
- Ù¾Ø´ØªÛØ¨Ø§ÙÛ Ø¨Ø§ آدرس Ø²ÛØ± تÙ
اس Ø¨Ú¯ÛØ±Ûد تا ÛÚ© Ø§ÙØ³Ø§Ù Ø¨Ù Ø³ÙØ§Ù Ø´Ù
ا پاسخ Ø¯ÙØ¯: tor-assistants at torproject.org
-
- --
-
- 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 at torproject.org), 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 at torproject.org
-
- 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 at torproject.org: Arabisk
- gettor+de at torproject.org: Tysk
- gettor+en at torproject.org: Engelsk
- gettor+es at torproject.org: Spansk
- gettor+fa at torproject.org: Farsi (Iran)
- gettor+fr at torproject.org: Fransk
- gettor+it at torproject.org: Italiensk
- gettor+nl at torproject.org: Nederlandsk
- gettor+pl at torproject.org: Polsk
- gettor+ru at torproject.org: Russisk
- gettor+zh at torproject.org: 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 at torproject.org
-
- --
-
- 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 at torproject.org), 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 at torproject.org
-
- 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 at torproject.org: Português
- gettor+ar at torproject.org: Arábico
- gettor+de at torproject.org: Alemão
- gettor+en at torproject.org: Inglês
- gettor+es at torproject.org: Espanhol
- gettor+fa at torproject.org: Farsi (Irão)
- gettor+fr at torproject.org: Francês
- gettor+it at torproject.org: Italiano
- gettor+nl at torproject.org: Holandês
- gettor+pl at torproject.org: Polaco
- gettor+ru at torproject.org: Russo
- gettor+zh at torproject.org: 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 at torproject.org
-
- --
-
- ÐдÑавÑÑвÑйÑе! ÐÑо "ÑÐ¾Ð±Ð¾Ñ GetTor".
-
- Я оÑоÑÐ»Ñ Ð²Ð°Ð¼ Ð¿Ð°ÐºÐµÑ Tor еÑли Ð²Ñ ÑкажеÑе коÑоÑÑй Ð²Ñ Ñ
оÑиÑе.
- ÐожалÑйÑÑа вÑбеÑиÑе один из пакеÑов:
-
- tor-browser-bundle
- macosx-i386-bundle
- macosx-ppc-bundle
- linux-browser-bundle-i386
- linux-browser-bundle-x86_64
- source-bundle
-
- ÐожалÑйÑÑа ÑвÑжиÑеÑÑ Ñ Ð½Ð°Ð¼Ð¸ по ÑÑой ÑлкÑÑонной поÑÑе
- (gettor at torproject.org), и ÑкажиÑе
- название одного из пакеÑов в лÑбом меÑÑе в "Ñеле" ваÑего пиÑÑма.
-
- ÐÐÐУЧÐÐÐÐ ÐÐÐÐÐÐÐÐÐ ÐÐÐÐÐЫХ ÐÐРСÐÐ TOR
- ===================================
-
- ЧÑÐ¾Ð±Ñ Ð¿Ð¾Ð»ÑÑиÑÑ Ð²ÐµÑÑÐ¸Ñ Tor пеÑеведеннÑÑ Ð½Ð° Ð²Ð°Ñ ÑзÑк,ÑкажиÑе
- пÑедпоÑиÑаемÑй ÑзÑк в адÑеÑной ÑÑÑоке кÑда Ð²Ñ Ð¾ÑоÑлали ÑлекÑÑоннÑÑ Ð¿Ð¾ÑÑÑ:
-
- gettor+zh at torproject.org
-
- ÐÑÑеÑказаннÑй пÑÐ¸Ð¼ÐµÑ Ð´Ð°ÑÑ Ð²Ð°Ð¼ запÑоÑеннÑй Ð¿Ð°ÐºÐµÑ Ð² локализиÑованной
- веÑÑии киÑайÑкого ÑзÑка. ÐÑовеÑÑÑе ниже ÑпиÑок кодов поддеÑживаемÑÑ
- ÑзÑков.
-
- СпиÑок поддеÑживаемÑÑ
Ñегионов
- -------------------------
-
- Ðиже Ñказан ÑпиÑок вÑеÑ
доÑÑÑпнÑÑ
ÑзÑков:
-
- gettor+ar at torproject.org: аÑабÑкий
- gettor+de at torproject.org: немеÑкий
- gettor+en at torproject.org: английÑкий
- gettor+es at torproject.org: иÑпанÑкий
- gettor+fa at torproject.org: ÑаÑÑи (ÐÑан)
- gettor+fr at torproject.org: ÑÑанÑÑзÑкий
- gettor+it at torproject.org: иÑалÑÑнÑкий
- gettor+nl at torproject.org: голландÑкий
- gettor+pl at torproject.org: полÑÑкий
- gettor+ru at torproject.org: ÑÑÑÑкий
- gettor+zh at torproject.org: киÑайÑкий
-
- ÐÑли Ð²Ñ Ð½Ðµ вÑбеÑиÑе ÑзÑк, Ð²Ñ Ð¿Ð¾Ð»ÑÑиÑе веÑÑÐ¸Ñ Ð½Ð° английÑком ÑзÑке.
-
- ÐÐÐÐÐÐ ÐÐÐ
- =======
-
- ÐÑли Ñ Ð²Ð°Ñ Ð²Ð¾Ð¿ÑоÑÑ Ð¸Ð»Ð¸ ÑÑо Ñо не ÑÑабоÑало, Ð²Ñ Ð¼Ð¾Ð¶ÐµÑе ÑвÑзаÑÑÑÑ
- Ñ Ð¶Ð¸Ð²Ñм пÑедÑÑавиÑелем по ÑÑÐ¾Ð¼Ñ ÑлекÑÑÐ¾Ð½Ð½Ð¾Ð¼Ñ Ð°Ð´ÑеÑÑ:tor-assistants at torproject.org
-
- --
-
- ä½ å¥½, è¿éæ¯"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 at torproject.org),
- å¹¶å¨ä¿¡çæ£æä¸åå¥½æ¨æéè¦çå¥ä»¶åç§°ï¼ä¸å
æ¬æ¬å·å
ç䏿ï¼ã
-
- è·åå
¶ä»è¯è¨çTorå¥ä»¶
- ===================================
-
- 卿¶ä»¶äººå°å䏿å®è¯è¨ä»£ç å¯ä»¥è·å¾æ¬å¯¹åºè¯è¨ççæ¬ï¼ä¾å¦ï¼
-
- gettor+zh at torproject.org
-
- æ¬ä¾ä¸ï¼æ¨å°å¾å°ä¸æççTorå¥ä»¶ï¼ä¸é¢æ¯ç®åæ¯æçè¯ç§ä»£ç ï¼
-
- æ¯æè¯è¨å表:
- -------------------------
-
- å
¨é¨å¯ç¨è¯è¨å表:
-
- gettor+ar at torproject.org: Arabic
- gettor+de at torproject.org: German
- gettor+en at torproject.org: English
- gettor+es at torproject.org: Spanish
- gettor+fa at torproject.org: Farsi (Iran)
- gettor+fr at torproject.org: French
- gettor+it at torproject.org: Italian
- gettor+nl at torproject.org: Dutch
- gettor+pl at torproject.org: Polish
- gettor+ru at torproject.org: Russian
- gettor+zh at torproject.org: 䏿
-
- å¦ææ¨æªæå®è¯è¨ä»£ç ï¼æ¨å°æ¶å°è±æçã
-
- æ¯æ
- =======
-
- 妿æ¨éå°å°é¾ææå¡åºç°é®é¢ï¼è¯·èç³»æä»¬ç
- ææ¯æ¯æé®ç®±: tor-assistants at torproject.org
-
- --
- """
-
-# 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 at torproject.org
-
- """)
-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 at torproject.org), 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 at torproject.org
-
- """
-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 at torproject.org: Arabic
- gettor+de at torproject.org: German
- gettor+en at torproject.org: English
- gettor+es at torproject.org: Spanish
- gettor+fa at torproject.org: Farsi (Iran)
- gettor+fr at torproject.org: French
- gettor+it at torproject.org: Italian
- gettor+nl at torproject.org: Dutch
- gettor+pl at torproject.org: Polish
- gettor+ru at torproject.org: Russian
- gettor+zh at torproject.org: 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 at torproject.org
-
- """)
-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 at mit.edu>"
-
- """
-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 at torproject.org
-
- """)
-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 at appelbaum.net>,
+# Christian Fromme <kaner at strace.org>
+# 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 at torproject.org)Ø ÙØªØ®Ø¨Ø±ÙÙ
+ باسÙ
ØØ²Ù
Ø© ÙØ§ØØ¯Ø© ÙÙØ· Ù٠أ٠Ù
ÙØ§Ù ضÙ
Ù Ø±Ø³Ø§ÙØ© Ø§ÙØ±Ø¯.
+
+ Ø§ÙØØµÙ٠عÙ٠إصدارات Ù
ترجÙ
Ø© Ù
Ù ØªÙØ±
+ ========================
+
+ ÙØªØØµÙ عÙ٠إصدار ØªÙØ± Ù
ترجÙ
Ø¥ÙÙ ÙØºØªÙØ ÙØ±Ø¬Ù Ø£Ù ØªØØ¯Ø¯
+ اÙÙØºØ© Ø§ÙØªÙ ØªØ±ÙØ¯ ضÙ
Ù Ø§ÙØ¹ÙÙØ§Ù Ø§ÙØ°Ù Ø³ØªØ±Ø³Ù Ø§ÙØ±Ø³Ø§ÙØ© Ø§ÙØ¥ÙÙØªØ±ÙÙÙØ© Ø¥ÙÙÙ:
+
+ gettor+zh at torproject.org
+
+ ÙØ°Ø§ اÙÙ
Ø«Ø§Ù ÙØ¹Ø·ÙÙ Ø§ÙØØ²Ù
Ø© اÙÙ
Ø·ÙÙØ¨Ø© Ù
ترجÙ
Ø©
+ ÙÙØºØ© Ø§ÙØµÙÙÙØ©. تØÙÙ Ù
٠اÙÙØ§Ø¦Ù
Ø© Ø£Ø¯ÙØ§Ù ÙØªØ¬Ø¯ رÙ
ÙØ² اÙÙØºØ§Øª
+ اÙÙ
دعÙÙ
Ø©.
+
+ ÙØ§Ø¦Ù
Ø© اÙÙØºØ§Øª اÙÙ
دعÙÙ
Ø©:
+ -------------------
+
+ ÙØ§ ÙÙ ÙØ§Ø¦Ù
Ø© اÙÙØºØ§Øª اÙÙ
تÙÙØ±Ø©:
+
+ gettor+ar at torproject.org: Ø§ÙØ¹Ø±Ø¨ÙØ©
+ gettor+de at torproject.org: Ø§ÙØ£ÙÙ
اÙÙØ©
+ gettor+en at torproject.org: Ø§ÙØ¥ÙÙÙÙØ²ÙØ©
+ gettor+es at torproject.org: Ø§ÙØ¥Ø³Ø¨Ø§ÙÙØ©
+ gettor+fa at torproject.org: اÙÙØ§Ø±Ø³ÙØ©
+ gettor+fr at torproject.org: اÙÙØ±ÙØ³ÙØ©
+ gettor+it at torproject.org: Ø§ÙØ¥ÙطاÙÙØ©
+ gettor+nl at torproject.org: اÙÙÙÙÙØ¯ÙØ©
+ gettor+pl at torproject.org: Ø§ÙØ¨ÙÙÙØ¯ÙØ©
+ gettor+ru at torproject.org: Ø§ÙØ±ÙØ³ÙØ©
+ gettor+zh at torproject.org: Ø§ÙØµÙÙÙØ©
+
+ Ø¥Ù ÙÙ
تÙÙ
Ø¨Ø§Ø®ØªÙØ§Ø± ÙØºØ© ÙØ³ØªØØµÙ عÙÙ Ø§ÙØ¥ØµØ¯Ø§Ø±Ø© Ø§ÙØ¥ÙÙÙÙØ²ÙØ©.
+
+ Ø§ÙØ¯Ø¹Ù
اÙÙÙÙ
+ =======
+
+ Ø¥Ù ÙØ§Ùت ÙØ¯ÙÙ Ø£ÙØ© Ø£Ø³Ø¦ÙØ© أ٠إذا ÙÙ
ÙØ¹Ù
Ù ÙØ°Ø§ Ø§ÙØÙ ÙÙ
ÙÙÙ Ø§ÙØ§ØªØµØ§Ù Ø¨ÙØ§Ø¦Ù
+ بشر٠عÙ٠عÙÙØ§Ù Ø§ÙØ¯Ø¹Ù
اÙÙÙÙ Ø§ÙØªØ§ÙÙ: tor-assistants at torproject.org
+
+ --
+
+ Ø³ÙØ§Ù
! Ø±ÙØ¨Ø§Øª "GetTor" در خدÙ
ت Ø´Ù
است.
+
+ ÚÙØ§ÙÚ٠ب٠Ù
٠بگÙÛÛØ¯ ک٠ب٠کداÙ
ÛÚ© از Ø¨Ø³ØªÙ ÙØ§Û Tor ÙÛØ§Ø² Ø¯Ø§Ø±ÛØ¯Ø آ٠را Ø¨Ø±Ø§Û Ø´Ù
ا
+ Ø§Ø±Ø³Ø§Ù Ø®ÙØ§ÙÙ
کرد.
+ ÙØ·Ùا ÛÚ©Û Ø§Ø² Ø¨Ø³ØªÙ ÙØ§Û را Ø²ÛØ± با ذکر ÙØ§Ù
Ø§ÙØªØ®Ø§Ø¨ Ú©ÙÛØ¯:
+
+ tor-browser-bundle
+ macosx-i386-bundle
+ macosx-ppc-bundle
+ linux-browser-bundle-i386
+ linux-browser-bundle-x86_64
+ source-bundle
+
+ ÙØ·Ùا ب٠اÛÙ ÙØ§Ù
٠پاسخ داد٠( ب٠آدرس gettor at torproject.org ) ٠در ÙØ³Ù
ØªÛ Ø§Ø²
+ Ù
ت٠اÛÙ
ÛÙ Ø®ÙØ¯ ÙØ§Ù
ÛÚ©Û Ø§Ø² Ø¨Ø³ØªÙ ÙØ§Û ÙÙ٠را ذکر Ú©ÙÛØ¯.
+
+ تÙÛÙ ÙØ³Ø®Ù ترجÙ
٠شد٠TOR
+ ===================================
+
+ Ø¨Ø±Ø§Û Ø¯Ø±ÛØ§Ùت ÙØ³Ø®Ù Ø§Û Ø§Ø² TOR ترجÙ
٠شد٠ب٠زبا٠Ù
ØÙÛ Ø´Ù
Ø§Ø Ù
Û Ø¨Ø§ÛØ³ØªÛ زبا٠Ù
ÙØ±Ø¯
+ ÙØ¸Ø± Ø®ÙØ¯ را در آدرس Ú¯ÛØ±Ùد٠اÛÙ
Û٠ذکر Ú©ÙÛØ¯. بعÙÙØ§Ù Ù
ثاÙ:
+
+ gettor+zh at torproject.org
+
+ در اÛÙ Ù
Ø«Ø§ÙØ ÙØ±Ø³ØªÙØ¯Ù Ø®ÙØ§ÙØ§Ù ÙØ³Ø®Ù ترجÙ
٠شد٠ب٠زبا٠ÚÛÙÛ Ù
Û Ø¨Ø§Ø´Ø¯. Ø¨Ø±Ø§Û Ø¢Ú¯Ø§ÙÛ
+ از Ú©Ø¯ÙØ§Û Ù
Ø±Ø¨ÙØ· ب٠زباÙÙØ§Û ÙØ§Ø¨Ù Ù¾Ø´ØªÛØ¨Ø§ÙÛ ØªÙØ³Ø· Tor Ø ÙÙØ±Ø³Øª Ø²ÛØ± را Ù
Ø·Ø§ÙØ¹Ù Ú©ÙÛØ¯:
+ ÙÙØ±Ø³Øª زباÙÙØ§Û Ù¾Ø´ØªÛØ§ÙÛ Ø´Ø¯Ù
+ -------------------------
+
+ gettor+ar at torproject.org: Arabic
+ gettor+de at torproject.org: German
+ gettor+en at torproject.org: English
+ gettor+es at torproject.org: Spanish
+ gettor+fa at torproject.org: Farsi (Iran)
+ gettor+fr at torproject.org: French
+ gettor+it at torproject.org: Italian
+ gettor+nl at torproject.org: Dutch
+ gettor+pl at torproject.org: Polish
+ gettor+ru at torproject.org: Russian
+ gettor+zh at torproject.org: Chinese
+
+ ÚÙØ§ÙÚÙ ÙÛÚÛÚ© از زباÙÙØ§Û ÙÙ٠را Ø§ÙØªØ®Ø§Ø¨ ÙÚ©ÙÛØ¯Ø ÙØ³Ø®Ù اÙÚ¯ÙÛØ³Û Ø¨Ø±Ø§Û Ø´Ù
ا ارساÙ
+ Ø®ÙØ§Ùد شد.
+
+ Ù¾Ø´ØªÛØ¨Ø§ÙÛ
+ =======
+
+ ÚÙØ§ÙÚÙ Ø³ÙØ§ÙÛ Ø¯Ø§Ø±ÛØ¯ ÛØ§ Ø¨Ø±ÙØ§Ù
Ù Ø¯ÚØ§Ø± Ø§Ø´Ú©Ø§Ù Ø¨ÙØ¯Ù ٠کار ÙÙ
Û Ú©ÙØ¯ Ø Ø¨Ø§ ÙØ³Ù
ت
+ Ù¾Ø´ØªÛØ¨Ø§ÙÛ Ø¨Ø§ آدرس Ø²ÛØ± تÙ
اس Ø¨Ú¯ÛØ±Ûد تا ÛÚ© Ø§ÙØ³Ø§Ù Ø¨Ù Ø³ÙØ§Ù Ø´Ù
ا پاسخ Ø¯ÙØ¯: tor-assistants at torproject.org
+
+ --
+
+ 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 at torproject.org), 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 at torproject.org
+
+ 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 at torproject.org: Arabisk
+ gettor+de at torproject.org: Tysk
+ gettor+en at torproject.org: Engelsk
+ gettor+es at torproject.org: Spansk
+ gettor+fa at torproject.org: Farsi (Iran)
+ gettor+fr at torproject.org: Fransk
+ gettor+it at torproject.org: Italiensk
+ gettor+nl at torproject.org: Nederlandsk
+ gettor+pl at torproject.org: Polsk
+ gettor+ru at torproject.org: Russisk
+ gettor+zh at torproject.org: 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 at torproject.org
+
+ --
+
+ 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 at torproject.org), 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 at torproject.org
+
+ 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 at torproject.org: Português
+ gettor+ar at torproject.org: Arábico
+ gettor+de at torproject.org: Alemão
+ gettor+en at torproject.org: Inglês
+ gettor+es at torproject.org: Espanhol
+ gettor+fa at torproject.org: Farsi (Irão)
+ gettor+fr at torproject.org: Francês
+ gettor+it at torproject.org: Italiano
+ gettor+nl at torproject.org: Holandês
+ gettor+pl at torproject.org: Polaco
+ gettor+ru at torproject.org: Russo
+ gettor+zh at torproject.org: 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 at torproject.org
+
+ --
+
+ ÐдÑавÑÑвÑйÑе! ÐÑо "ÑÐ¾Ð±Ð¾Ñ GetTor".
+
+ Я оÑоÑÐ»Ñ Ð²Ð°Ð¼ Ð¿Ð°ÐºÐµÑ Tor еÑли Ð²Ñ ÑкажеÑе коÑоÑÑй Ð²Ñ Ñ
оÑиÑе.
+ ÐожалÑйÑÑа вÑбеÑиÑе один из пакеÑов:
+
+ tor-browser-bundle
+ macosx-i386-bundle
+ macosx-ppc-bundle
+ linux-browser-bundle-i386
+ linux-browser-bundle-x86_64
+ source-bundle
+
+ ÐожалÑйÑÑа ÑвÑжиÑеÑÑ Ñ Ð½Ð°Ð¼Ð¸ по ÑÑой ÑлкÑÑонной поÑÑе
+ (gettor at torproject.org), и ÑкажиÑе
+ название одного из пакеÑов в лÑбом меÑÑе в "Ñеле" ваÑего пиÑÑма.
+
+ ÐÐÐУЧÐÐÐÐ ÐÐÐÐÐÐÐÐÐ ÐÐÐÐÐЫХ ÐÐРСÐÐ TOR
+ ===================================
+
+ ЧÑÐ¾Ð±Ñ Ð¿Ð¾Ð»ÑÑиÑÑ Ð²ÐµÑÑÐ¸Ñ Tor пеÑеведеннÑÑ Ð½Ð° Ð²Ð°Ñ ÑзÑк,ÑкажиÑе
+ пÑедпоÑиÑаемÑй ÑзÑк в адÑеÑной ÑÑÑоке кÑда Ð²Ñ Ð¾ÑоÑлали ÑлекÑÑоннÑÑ Ð¿Ð¾ÑÑÑ:
+
+ gettor+zh at torproject.org
+
+ ÐÑÑеÑказаннÑй пÑÐ¸Ð¼ÐµÑ Ð´Ð°ÑÑ Ð²Ð°Ð¼ запÑоÑеннÑй Ð¿Ð°ÐºÐµÑ Ð² локализиÑованной
+ веÑÑии киÑайÑкого ÑзÑка. ÐÑовеÑÑÑе ниже ÑпиÑок кодов поддеÑживаемÑÑ
+ ÑзÑков.
+
+ СпиÑок поддеÑживаемÑÑ
Ñегионов
+ -------------------------
+
+ Ðиже Ñказан ÑпиÑок вÑеÑ
доÑÑÑпнÑÑ
ÑзÑков:
+
+ gettor+ar at torproject.org: аÑабÑкий
+ gettor+de at torproject.org: немеÑкий
+ gettor+en at torproject.org: английÑкий
+ gettor+es at torproject.org: иÑпанÑкий
+ gettor+fa at torproject.org: ÑаÑÑи (ÐÑан)
+ gettor+fr at torproject.org: ÑÑанÑÑзÑкий
+ gettor+it at torproject.org: иÑалÑÑнÑкий
+ gettor+nl at torproject.org: голландÑкий
+ gettor+pl at torproject.org: полÑÑкий
+ gettor+ru at torproject.org: ÑÑÑÑкий
+ gettor+zh at torproject.org: киÑайÑкий
+
+ ÐÑли Ð²Ñ Ð½Ðµ вÑбеÑиÑе ÑзÑк, Ð²Ñ Ð¿Ð¾Ð»ÑÑиÑе веÑÑÐ¸Ñ Ð½Ð° английÑком ÑзÑке.
+
+ ÐÐÐÐÐÐ ÐÐÐ
+ =======
+
+ ÐÑли Ñ Ð²Ð°Ñ Ð²Ð¾Ð¿ÑоÑÑ Ð¸Ð»Ð¸ ÑÑо Ñо не ÑÑабоÑало, Ð²Ñ Ð¼Ð¾Ð¶ÐµÑе ÑвÑзаÑÑÑÑ
+ Ñ Ð¶Ð¸Ð²Ñм пÑедÑÑавиÑелем по ÑÑÐ¾Ð¼Ñ ÑлекÑÑÐ¾Ð½Ð½Ð¾Ð¼Ñ Ð°Ð´ÑеÑÑ:tor-assistants at torproject.org
+
+ --
+
+ ä½ å¥½, è¿éæ¯"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 at torproject.org),
+ å¹¶å¨ä¿¡çæ£æä¸åå¥½æ¨æéè¦çå¥ä»¶åç§°ï¼ä¸å
æ¬æ¬å·å
ç䏿ï¼ã
+
+ è·åå
¶ä»è¯è¨çTorå¥ä»¶
+ ===================================
+
+ 卿¶ä»¶äººå°å䏿å®è¯è¨ä»£ç å¯ä»¥è·å¾æ¬å¯¹åºè¯è¨ççæ¬ï¼ä¾å¦ï¼
+
+ gettor+zh at torproject.org
+
+ æ¬ä¾ä¸ï¼æ¨å°å¾å°ä¸æççTorå¥ä»¶ï¼ä¸é¢æ¯ç®åæ¯æçè¯ç§ä»£ç ï¼
+
+ æ¯æè¯è¨å表:
+ -------------------------
+
+ å
¨é¨å¯ç¨è¯è¨å表:
+
+ gettor+ar at torproject.org: Arabic
+ gettor+de at torproject.org: German
+ gettor+en at torproject.org: English
+ gettor+es at torproject.org: Spanish
+ gettor+fa at torproject.org: Farsi (Iran)
+ gettor+fr at torproject.org: French
+ gettor+it at torproject.org: Italian
+ gettor+nl at torproject.org: Dutch
+ gettor+pl at torproject.org: Polish
+ gettor+ru at torproject.org: Russian
+ gettor+zh at torproject.org: 䏿
+
+ å¦ææ¨æªæå®è¯è¨ä»£ç ï¼æ¨å°æ¶å°è±æçã
+
+ æ¯æ
+ =======
+
+ 妿æ¨éå°å°é¾ææå¡åºç°é®é¢ï¼è¯·èç³»æä»¬ç
+ ææ¯æ¯æé®ç®±: tor-assistants at torproject.org
+
+ --
+ """
+
+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 at torproject.org"""),
+ # 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 at torproject.org), 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 at torproject.org: Arabic
+ gettor+de at torproject.org: German
+ gettor+en at torproject.org: English
+ gettor+es at torproject.org: Spanish
+ gettor+fa at torproject.org: Farsi (Iran)
+ gettor+fr at torproject.org: French
+ gettor+it at torproject.org: Italian
+ gettor+nl at torproject.org: Dutch
+ gettor+pl at torproject.org: Polish
+ gettor+ru at torproject.org: Russian
+ gettor+zh at torproject.org: 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 at torproject.org"""),
+ # 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 at torproject.org" + "\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 at torproject.org" + "\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 at mit.edu>'" \
+ + "\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.
More information about the tor-commits
mailing list