[or-cvs] r14540: Sebastian Hahn added some cute little flags to TorCheck. I'm (check/trunk/cgi-bin)
ioerror at seul.org
ioerror at seul.org
Sat May 3 09:11:43 UTC 2008
Author: ioerror
Date: 2008-05-03 05:11:42 -0400 (Sat, 03 May 2008)
New Revision: 14540
Modified:
check/trunk/cgi-bin/index.py
Log:
Sebastian Hahn added some cute little flags to TorCheck. I'm applying his patch.
Modified: check/trunk/cgi-bin/index.py
===================================================================
--- check/trunk/cgi-bin/index.py 2008-05-03 07:33:16 UTC (rev 14539)
+++ check/trunk/cgi-bin/index.py 2008-05-03 09:11:42 UTC (rev 14540)
@@ -72,6 +72,10 @@
# If we're here, we've had a positive exit answer
return 0
+def getLocales():
+ locale_descriptions = { 'en_US' : 'English', 'de' : 'Deutsch', 'es' : 'español','fa_IR' : 'fa_IR', 'ja': '(Nihogo)', 'pt_BR' : 'Português', 'pl' : 'polski', 'zh_CN' :'(Simplified Chinese)' }
+ return locale_descriptions
+
def parseLang(req):
user_supplied_lang = None
@@ -84,17 +88,16 @@
default_locale = "en_US"
locale = default_locale
- locales = ( default_locale, 'es', 'es_ES', 'de', 'fa_IR', 'ja', 'pt_BR', 'pl', 'zh_CN')
-
- # We'd really like these locales to be translated:
- # locales = ( default_locale, 'ar', 'de', 'es', 'es_ES', 'fa-IR', 'fr', 'nl', 'pt-PT', 'ru', 'zh-CN')
+ # We'd really like these additional locales to be translated:
+ # locales = ( 'ar', 'fr', 'nl', 'pt-PT' )
+
# This is to deal with Mozilla and Debian having different ideas about
# what it means to be a locale
if user_supplied_lang:
user_supplied_lang = user_supplied_lang.replace("-", "_")
- for item in locales:
+ for item in getLocales().keys():
if item == user_supplied_lang:
locale = item
@@ -114,11 +117,19 @@
# First lets construct the simple webpage:
req.write('<html>\n')
+ req.write('<head>\n')
+ req.write('<title>Are you using Tor?</title>\n')
+ req.write('<style>\n')
+ req.write('img,acronym {\n')
+ req.write(' border: 0;')
+ req.write(' text-decoration: none;')
+ req.write('}')
+ req.write('</style>')
+ req.write('</head>\n')
req.write('<body>\n')
parseLang(req)
- req.write('<title>Are you using Tor?</title>\n')
req.write('<center>\n')
if UsingTor == 0:
@@ -167,6 +178,16 @@
req.write('<br><br>')
req.write(_('This server does not log <i>any</i> information about visitors.'))
req.write('<br>\n<br>\n')
+ #We want to display little pretty images so users can choose their language
+ locales = getLocales()
+
+ for item in sorted(locales.keys()):
+ req.write('<a href="?lang=%s">' % item )
+ req.write('<acronym title="%s">' % locales[item] )
+ req.write('<img src="images/%s.png" ' % item )
+ req.write('alt="%s" width="24" height="16">' % item )
+ req.write('</acronym>')
+ req.write('</a> ')
req.write('</tt></p>')
req.write('</small>')
req.write('</center>\n')
More information about the tor-commits
mailing list