Commit da2718a1 authored by Christian Fromme's avatar Christian Fromme
Browse files

Adopted changes according to Nickm's review at https://trac.torproject.org/projects/tor/ticket/1613

Also, let users request languages by URL via /?lang=foo *and* /foo (Thanks, arma)
parent d006b87e
......@@ -4,12 +4,18 @@ To set up:
- Install Twisted-Web, Twisted-Mail, PyOpenSSL, and all their dependencies.
- To run unit tests, "python setup.py test"
- python setup.py install --prefix=$HOME
- To generate translation files, run "python setup.py trans" and then run
"python setup.py install_data" to install them
- Edit bridgedb.conf; put it somewhere good.
- Make sure that the input files referred to in bridgedb.conf exist.
- You can make a self-signed certificate with
openssl req -x509 -new -nodes > cert
- Set up PYTHONPATH to include "~/lib/python2.4/site-packages/".
To re-generate the i18n template (in case translation strings have changed
in BridgeDB):
- Run "xgettext lib/bridgedb/I18n.py -dbridgedb -oi18n/templates/bridgedb.pot"
To run:
- Run "python -m TorBridgeDB bridgedb.conf"
......
......@@ -139,5 +139,3 @@ EMAIL_INCLUDE_FINGERPRINTS=False
# to these groups in a proportion of
# HTTPS_SHARE : EMAIL_SHARE : RESERVED_SHARE
RESERVED_SHARE=2
CONFIGURED_LOCALES = [ "en", "de" ]
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# Christian Fromme <kaner@strace.org>, 2010
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-08-14 13:28+0200\n"
"POT-Creation-Date: 2010-09-29 14:16+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: lib/bridgedb/I18n.py:7
msgid ""
"\n"
" Here are your bridge relays:\n"
" "
msgstr ""
"\n"
" Hier sind deine Bridge Relays:\n"
" "
#: lib/bridgedb/I18n.py:11
msgid ""
"\n"
" Bridge relays (or \"bridges\" for short) are Tor relays that aren't "
"listed\n"
" in the main directory. Since there is no complete public list of them,\n"
" even if your ISP is filtering connections to all the known Tor relays,\n"
" they probably won't be able to block all the bridges.\n"
" "
msgstr ""
"\n"
" Sogenannte \"Bridge Relays\" (oder kurz \"Bridges\" ) sind Tor Relays, die"
" nicht in den oeffentlich publizierten Relay-Listen auftauchen."
" Dadurch, dass die Bridges der Oeffentlichkeit nicht bekannt ist, "
" sind ISPs nicht dazu in der Lage, alle Tor Relays zu filtern."
" "
#: lib/bridgedb/I18n.py:18
msgid ""
"\n"
" To use the above lines, go to Vidalia's Network settings page, and "
"click\n"
" \"My ISP blocks connections to the Tor network\". Then add each bridge\n"
" address one at a time.\n"
" "
msgstr ""
"\n"
" Um die oben genannten Zeilen zu nutzen, sollten Sie in Vidalia's "
" Network Settings gehen und den Menuepunkt \"Mein ISP blockt Verbindungen "
" zum Tor Netzwerk\" anklicken. Anschliessend koennen sie die Bridge-Adressen"
" hinzufuegen."
" "
#: lib/bridgedb/I18n.py:24
msgid ""
"\n"
" Configuring more than one bridge address will make your Tor connection\n"
" more stable, in case some of the bridges become unreachable.\n"
" "
msgstr ""
"\n"
" Mehr als eine Brigde-Adresse zu verwenden fuehrt zu einer stabileren\n"
" Verbindung. Es kann immer sein, dass mal eine Bridge kurzzeitig nicht "
" erreichbar ist.\n"
" "
#: lib/bridgedb/I18n.py:21
msgid "Here are your bridge relays: "
msgstr "Hier sind Ihre Bridge Relays: "
#: lib/bridgedb/I18n.py:29
#: lib/bridgedb/I18n.py:23
msgid ""
"\n"
" Another way to find public bridge addresses is to send mail to\n"
" bridges@torproject.org with the line \"get bridges\" by itself in the "
"body\n"
" of the mail. However, so we can make it harder for an attacker to learn\n"
" lots of bridge addresses, you must send this request from a gmail or\n"
" yahoo account.\n"
" "
msgstr ""
"\n"
" Eine weitere Moeglichkeit Bridge-Adressen zu finden ist, eine Email\n"
" an bridges@torproject.org mit der Zeile \"get bridges\" zu Schreiben.\n"
" Diesen Reqeuest muessen Sie allerdings von einem GMail oder Yahoo-Account"
" schicken.\n"
" "
#: lib/bridgedb/I18n.py:48
msgid ""
"\n"
"[This is an automated message; please do not reply.]\n"
msgstr ""
"\n"
"[Diese Mail wurde elektronisch erstellt; Bitte nicht antworten.]\n"
#: lib/bridgedb/I18n.py:52
msgid ""
"\n"
"Here are your bridge relays:\n"
msgstr ""
"\n"
"Hier sind Ihre Bridge Relays:\n"
#: lib/bridgedb/I18n.py:56
msgid ""
"\n"
"Bridge relays (or \"bridges\" for short) are Tor relays that aren't listed\n"
"in the main directory. Since there is no complete public list of them,\n"
"even if your ISP is filtering connections to all the known Tor relays,\n"
"they probably won't be able to block all the bridges.\n"
"they probably won't be able to block all the bridges."
msgstr ""
"\n"
" Sogenannte \"Bridge Relays\" (oder kurz \"Bridges\" ) sind Tor Relays, die"
" nicht in den oeffentlich publizierten Relay-Listen auftauchen."
" Dadurch, dass die Bridges der Oeffentlichkeit nicht bekannt ist, "
" sind ISPs nicht dazu in der Lage, alle Tor Relays zu filtern.\n"
"Sogenannte \"Bridge Relays\" (oder kurz \"Bridges\" ) sind Tor Relays, die\n"
"nicht in den oeffentlich publizierten Relay-Listen auftauchen. Daurch, dass\n"
"die Bridges der Oeffentlichkeit nicht bekannt ist, sind ISPs nicht dazu in\n"
"der Lage, alle Tor Relays zu filtern."
#: lib/bridgedb/I18n.py:63
#: lib/bridgedb/I18n.py:28
msgid ""
"\n"
"To use the above lines, go to Vidalia's Network settings page, and click\n"
"\"My ISP blocks connections to the Tor network\". Then add each bridge\n"
"address one at a time.\n"
"address one at a time."
msgstr ""
"\n"
" Um die oben genannten Zeilen zu nutzen, sollten Sie in Vidalia's "
" Network Settings gehen und den Menuepunkt \"Mein ISP blockt Verbindungen "
" zum Tor Netzwerk\" anklicken. Anschliessend koennen sie die Bridge-Adressen"
" hinzufuegen.\n"
"Um die oben genannten Zeilen zu nutzen, sollten Sie in Vidalia's \"Network\n"
"Settings\" gehen und den Menuepunkt \"Mein ISP blockt Verbindungen zum Tor\n"
"Netzwerk\" anklicken. Anschliessend koennen sie die Bridge-Adressen\n"
"hinzufuegen."
#: lib/bridgedb/I18n.py:69
#: lib/bridgedb/I18n.py:32
msgid ""
"\n"
"Configuring more than one bridge address will make your Tor connection\n"
"more stable, in case some of the bridges become unreachable.\n"
"more stable, in case some of the bridges become unreachable."
msgstr ""
"Mehr als eine Brigde-Adresse zu verwenden fuehrt zu einer stabileren\n"
"Verbindung. Es kann immer sein, dass mal eine Bridge kurzzeitig nicht\n"
"erreichbar ist."
#: lib/bridgedb/I18n.py:35
msgid ""
"Another way to find public bridge addresses is to send mail to\n"
"bridges@torproject.org with the line \"get bridges\" by itself in the body\n"
"of the mail. However, so we can make it harder for an attacker to learn\n"
"lots of bridge addresses, you must send this request from a gmail or\n"
"yahoo account."
msgstr ""
"\n"
" Mehr als eine Brigde-Adresse zu verwenden fuehrt zu einer stabileren\n"
" Verbindung. Es kann immer sein, dass mal eine Bridge kurzzeitig nicht "
" erreichbar ist.\n"
"Eine weitere Moeglichkeit Bridge-Adressen zu finden ist, eine Email\n"
"an bridges@torproject.org mit der Zeile \"get bridges\" zu Schreiben.\n"
"Diesen Reqeuest muessen Sie allerdings von einem GMail oder Yahoo-Account"
"schicken."
#: lib/bridgedb/I18n.py:41
msgid "[This is an automated message; please do not reply.]"
msgstr "[Diese Mail wurde elektronisch erstellt; Bitte nicht antworten.]"
#: lib/bridgedb/I18n.py:74
#: lib/bridgedb/I18n.py:43
msgid ""
"\n"
"Another way to find public bridge addresses is to visit\n"
"https://bridges.torproject.org/. The answers you get from that page\n"
"will change every few days, so check back periodically if you need more\n"
"bridge addresses.\n"
"bridge addresses."
msgstr ""
"\n"
"Ein anderer Weg, neue Bridge-Adressen zu finden, ist folgende Web-Adresse zu"
" besuchen:\n"
"Eine andere Moeglichkeit neue Bridge-Adressen zu finden besteht darin,\n"
"folgende Web-Adresse zu besuchen:\n"
"https://bridges.torproject.org/. Sie koennen diese Adresse alle paar Tage\n"
"besuchen, um neue Bridge-Adressen zu erhalten.\n"
"besuchen, um neue Bridge-Adressen zu erhalten."
#: lib/bridgedb/I18n.py:89
#: lib/bridgedb/I18n.py:48
msgid "(no bridges currently available)"
msgstr "(Zur Zeit sind keine Bridges verfuegbar)"
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# Christian Fromme <kaner@strace.org>, 2010
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-08-14 13:28+0200\n"
"POT-Creation-Date: 2010-09-29 14:25+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: lib/bridgedb/I18n.py:7
msgid ""
"\n"
" Here are your bridge relays:\n"
" "
msgstr ""
#: lib/bridgedb/I18n.py:11
msgid ""
"\n"
" Bridge relays (or \"bridges\" for short) are Tor relays that aren't "
"listed\n"
" in the main directory. Since there is no complete public list of them,\n"
" even if your ISP is filtering connections to all the known Tor relays,\n"
" they probably won't be able to block all the bridges.\n"
" "
msgstr ""
#: lib/bridgedb/I18n.py:18
msgid ""
"\n"
" To use the above lines, go to Vidalia's Network settings page, and "
"click\n"
" \"My ISP blocks connections to the Tor network\". Then add each bridge\n"
" address one at a time.\n"
" "
msgstr ""
#: lib/bridgedb/I18n.py:24
msgid ""
"\n"
" Configuring more than one bridge address will make your Tor connection\n"
" more stable, in case some of the bridges become unreachable.\n"
" "
msgstr ""
#: lib/bridgedb/I18n.py:29
msgid ""
"\n"
" Another way to find public bridge addresses is to send mail to\n"
" bridges@torproject.org with the line \"get bridges\" by itself in the "
"body\n"
" of the mail. However, so we can make it harder for an attacker to learn\n"
" lots of bridge addresses, you must send this request from a gmail or\n"
" yahoo account.\n"
" "
#: lib/bridgedb/I18n.py:21
msgid "Here are your bridge relays: "
msgstr ""
#: lib/bridgedb/I18n.py:48
msgid ""
"\n"
"[This is an automated message; please do not reply.]\n"
msgstr ""
#: lib/bridgedb/I18n.py:52
msgid ""
"\n"
"Here are your bridge relays:\n"
msgstr ""
#: lib/bridgedb/I18n.py:56
#: lib/bridgedb/I18n.py:23
msgid ""
"\n"
"Bridge relays (or \"bridges\" for short) are Tor relays that aren't listed\n"
"in the main directory. Since there is no complete public list of them,\n"
"even if your ISP is filtering connections to all the known Tor relays,\n"
"they probably won't be able to block all the bridges.\n"
"they probably won't be able to block all the bridges."
msgstr ""
#: lib/bridgedb/I18n.py:63
#: lib/bridgedb/I18n.py:28
msgid ""
"\n"
"To use the above lines, go to Vidalia's Network settings page, and click\n"
"\"My ISP blocks connections to the Tor network\". Then add each bridge\n"
"address one at a time.\n"
"address one at a time."
msgstr ""
#: lib/bridgedb/I18n.py:69
#: lib/bridgedb/I18n.py:32
msgid ""
"\n"
"Configuring more than one bridge address will make your Tor connection\n"
"more stable, in case some of the bridges become unreachable.\n"
"more stable, in case some of the bridges become unreachable."
msgstr ""
#: lib/bridgedb/I18n.py:74
#: lib/bridgedb/I18n.py:35
msgid ""
"Another way to find public bridge addresses is to send mail to\n"
"bridges@torproject.org with the line \"get bridges\" by itself in the body\n"
"of the mail. However, so we can make it harder for an attacker to learn\n"
"lots of bridge addresses, you must send this request from a gmail or\n"
"yahoo account."
msgstr ""
#: lib/bridgedb/I18n.py:41
msgid "[This is an automated message; please do not reply.]"
msgstr ""
#: lib/bridgedb/I18n.py:43
msgid ""
"\n"
"Another way to find public bridge addresses is to visit\n"
"https://bridges.torproject.org/. The answers you get from that page\n"
"will change every few days, so check back periodically if you need more\n"
"bridge addresses.\n"
"bridge addresses."
msgstr ""
#: lib/bridgedb/I18n.py:89
#: lib/bridgedb/I18n.py:48
msgid "(no bridges currently available)"
msgstr ""
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# Christian Fromme <kaner@strace.org>, 2010
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-08-14 13:28+0200\n"
"POT-Creation-Date: 2010-09-29 14:25+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: lib/bridgedb/Strings.py:7
msgid ""
"\n"
" Here are your bridge relays:\n"
" "
msgstr ""
#: lib/bridgedb/Strings.py:11
msgid ""
"\n"
" Bridge relays (or \"bridges\" for short) are Tor relays that aren't "
"listed\n"
" in the main directory. Since there is no complete public list of them,\n"
" even if your ISP is filtering connections to all the known Tor relays,\n"
" they probably won't be able to block all the bridges.\n"
" "
msgstr ""
#: lib/bridgedb/Strings.py:18
msgid ""
"\n"
" To use the above lines, go to Vidalia's Network settings page, and "
"click\n"
" \"My ISP blocks connections to the Tor network\". Then add each bridge\n"
" address one at a time.\n"
" "
msgstr ""
#: lib/bridgedb/Strings.py:24
msgid ""
"\n"
" Configuring more than one bridge address will make your Tor connection\n"
" more stable, in case some of the bridges become unreachable.\n"
" "
msgstr ""
#: lib/bridgedb/Strings.py:29
msgid ""
"\n"
" Another way to find public bridge addresses is to send mail to\n"
" bridges@torproject.org with the line \"get bridges\" by itself in the "
"body\n"
" of the mail. However, so we can make it harder for an attacker to learn\n"
" lots of bridge addresses, you must send this request from a gmail or\n"
" yahoo account.\n"
" "
msgstr ""
#: lib/bridgedb/Strings.py:48
msgid ""
"\n"
"[This is an automated message; please do not reply.]\n"
msgstr ""
#: lib/bridgedb/Strings.py:52
msgid ""
"\n"
"Here are your bridge relays:\n"
#: lib/bridgedb/I18n.py:21
msgid "Here are your bridge relays: "
msgstr ""
#: lib/bridgedb/Strings.py:56
#: lib/bridgedb/I18n.py:23
msgid ""
"\n"
"Bridge relays (or \"bridges\" for short) are Tor relays that aren't listed\n"
"in the main directory. Since there is no complete public list of them,\n"
"even if your ISP is filtering connections to all the known Tor relays,\n"
"they probably won't be able to block all the bridges.\n"
"they probably won't be able to block all the bridges."
msgstr ""
#: lib/bridgedb/Strings.py:63
#: lib/bridgedb/I18n.py:28
msgid ""
"\n"
"To use the above lines, go to Vidalia's Network settings page, and click\n"
"\"My ISP blocks connections to the Tor network\". Then add each bridge\n"
"address one at a time.\n"
"address one at a time."
msgstr ""
#: lib/bridgedb/Strings.py:69
#: lib/bridgedb/I18n.py:32
msgid ""
"\n"
"Configuring more than one bridge address will make your Tor connection\n"
"more stable, in case some of the bridges become unreachable.\n"
"more stable, in case some of the bridges become unreachable."
msgstr ""
#: lib/bridgedb/I18n.py:35
msgid ""
"Another way to find public bridge addresses is to send mail to\n"
"bridges@torproject.org with the line \"get bridges\" by itself in the body\n"
"of the mail. However, so we can make it harder for an attacker to learn\n"
"lots of bridge addresses, you must send this request from a gmail or\n"
"yahoo account."
msgstr ""
#: lib/bridgedb/I18n.py:41
msgid "[This is an automated message; please do not reply.]"
msgstr ""
#: lib/bridgedb/Strings.py:74
#: lib/bridgedb/I18n.py:43
msgid ""
"\n"
"Another way to find public bridge addresses is to visit\n"
"https://bridges.torproject.org/. The answers you get from that page\n"
"will change every few days, so check back periodically if you need more\n"
"bridge addresses.\n"
"bridge addresses."
msgstr ""
#: lib/bridgedb/Strings.py:89
#: lib/bridgedb/I18n.py:48
msgid "(no bridges currently available)"
msgstr ""
......@@ -2,13 +2,11 @@
import gettext
languages = {}
def setupLanguages(cfg):
"""Set up all languages we support
def getLang(lang):
"""Return the Translation instance for a given language. If no Translation
instance is found, return the one for 'en'
"""
for lang in cfg.CONFIGURED_LOCALES:
languages[lang] = gettext.translation("bridgedb", languages=[lang])
return gettext.translation("bridgedb", languages=[lang], fallback="en")
def _(text):
"""This is necessary because strings are translated when they're imported.
......@@ -19,57 +17,33 @@ def _(text):
# All text that needs translation goes here
BRIDGEDB_TEXT = [
_("""
Here are your bridge relays:
"""),
_("""
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.
"""),
_("""
To use the above lines, go to Vidalia's Network settings page, and click
"My ISP blocks connections to the Tor network". Then add each bridge
address one at a time.
"""),
_("""
Configuring more than one bridge address will make your Tor connection
more stable, in case some of the bridges become unreachable.
"""),
_("""
Another way to find public bridge addresses is to send mail to
bridges@torproject.org with the line "get bridges" by itself in the body
of the mail. However, so we can make it harder for an attacker to learn
lots of bridge addresses, you must send this request from a gmail or
yahoo account.
"""),
_("""
[This is an automated message; please do not reply.]
"""),
_("""
Here are your bridge relays:
"""),
_("""
Bridge relays (or "bridges" for short) are Tor relays that aren't listed
# BRIDGEDB_TEXT[0]
_("""Here are your bridge relays: """),
# BRIDGEDB_TEXT[1]
_("""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.
"""),
_("""
To use the above lines, go to Vidalia's Network settings page, and click
they probably won't be able to block all the bridges."""),
# BRIDGEDB_TEXT[2]
_("""To use the above lines, go to Vidalia's Network settings page, and click
"My ISP blocks connections to the Tor network". Then add each bridge
address one at a time.
"""),
_("""
Configuring more than one bridge address will make your Tor connection
more stable, in case some of the bridges become unreachable.
"""),
_("""
Another way to find public bridge addresses is to visit
address one at a time."""),
# BRIDGEDB_TEXT[3]
_("""Configuring more than one bridge address will make your Tor connection
more stable, in case some of the bridges become unreachable."""),
# BRIDGEDB_TEXT[4]
_("""Another way to find public bridge addresses is to send mail to
bridges@torproject.org with the line "get bridges" by itself in the body
of the mail. However, so we can make it harder for an attacker to learn
lots of bridge addresses, you must send this request from a gmail or
yahoo account."""),
# BRIDGEDB_TEXT[5]
_("""[This is an automated message; please do not reply.]"""),
# BRIDGEDB_TEXT[6]
_("""Another way to find public bridge addresses is to visit
https://bridges.torproject.org/. The answers you get from that page
will change every few days, so check back periodically if you need more
bridge addresses.
"""),
_("(no bridges currently available)")
bridge addresses."""),
# BRIDGEDB_TEXT[7]
_("""(no bridges currently available)""")
]
......@@ -19,7 +19,6 @@ import bridgedb.Dist as Dist
import bridgedb.Time as Time
import bridgedb.Server as Server
import bridgedb.Storage
import bridgedb.I18n as I18n
class Conf:
"""A configuration object. Holds unvalidated attributes.
......@@ -90,8 +89,6 @@ CONFIG = Conf(
EMAIL_INCLUDE_FINGERPRINTS = False,
RESERVED_SHARE=2,
CONFIGURED_LOCALES = [ "en", "de" ]
)
def configureLogging(cfg):
......@@ -228,9 +225,6 @@ def startup(cfg):
cfg.DB_FILE)
bridgedb.Storage.setGlobalDB(db)
# Setup languages
I18n.setupLanguages(cfg)
# Get a proxy list.
proxyList = ProxyCategory()
proxyList.replaceProxyList(loadProxyList(cfg))
......
......@@ -12,6 +12,7 @@ import rfc822
import time
import logging
import gettext
import re