moved several english strings into strings.json for translation

This commit is contained in:
Micah Lee 2014-08-20 14:45:24 -07:00
parent 6617063143
commit 4284476902
3 changed files with 22 additions and 14 deletions

View File

@ -169,7 +169,7 @@ def download(slug_candidate):
# download is finished, close the server
global stay_open
if not stay_open:
print "Closing automatically because download finished"
print translated("closing_automatically")
if shutdown_func is None:
raise RuntimeError('Not running with the Werkzeug Server')
shutdown_func()
@ -273,13 +273,13 @@ def tails_root():
# if running in Tails and as root, do only the things that require root
if get_platform() == 'Tails' and is_root():
parser = argparse.ArgumentParser()
parser.add_argument('port', nargs=1, help='Tails only: port for opening firewall, starting hidden service')
parser.add_argument('port', nargs=1, help=translated("help_tails_port"))
args = parser.parse_args()
try:
port = int(args.port[0])
except ValueError:
sys.stderr.write('Invalid value, port must be an integer\n')
sys.stderr.write('{0}\n'.format(translated("error_tails_invalid_port")))
sys.exit(-1)
# open hole in firewall
@ -308,10 +308,10 @@ def main():
# parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('--local-only', action='store_true', dest='local_only', help='Do not attempt to use tor: for development only')
parser.add_argument('--stay-open', action='store_true', dest='stay_open', help='Keep hidden service running after download has finished')
parser.add_argument('--debug', action='store_true', dest='debug', help='Log errors to disk')
parser.add_argument('filename', nargs=1, help='File to share')
parser.add_argument('--local-only', action='store_true', dest='local_only', help=translated("help_local_only"))
parser.add_argument('--stay-open', action='store_true', dest='stay_open', help=translated("help_stay_open"))
parser.add_argument('--debug', action='store_true', dest='debug', help=translated("help_debug"))
parser.add_argument('filename', nargs=1, help=translated("help_filename"))
args = parser.parse_args()
filename = os.path.abspath(args.filename[0])
@ -343,7 +343,7 @@ def main():
if root_p.poll() == -1:
sys.exit(root_p.stderr.read())
else:
sys.exit('Unknown error with Tails root process')
sys.exit(translated("error_tails_unknown_root"))
else:
# if not tails, start hidden service normally
if not local_only:

View File

@ -16,7 +16,15 @@
"close_on_finish": "Close automatically",
"close_countdown": "Closing in {0} seconds...",
"choose_file": "Choose a file to share",
"copy_url": "Copy URL"
"copy_url": "Copy URL",
"closing_automatically": "Closing automatically because download finished",
"error_tails_invalid_port": "Invalid value, port must be an integer",
"error_tails_unknown_root": "Unknown error with Tails root process",
"help_tails_port": "Tails only: port for opening firewall, starting hidden service",
"help_local_only": "Do not attempt to use tor: for development only",
"help_stay_open": "Keep hidden service running after download has finished",
"help_debug": "Log errors to disk",
"help_filename": "File to share"
}, "no": {
"calculating_sha1": "Kalkulerer SHA1 sjekksum.",
"connecting_ctrlport": "Kobler til Tors kontroll-port for å sette opp en gjemt tjeneste på port {0}.",

View File

@ -315,10 +315,10 @@ def main():
# parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('--local-only', action='store_true', dest='local_only', help='Do not attempt to use tor: for development only')
parser.add_argument('--stay-open', action='store_true', dest='stay_open', help='Keep hidden service running after download has finished')
parser.add_argument('--debug', action='store_true', dest='debug', help='Log errors to disk')
parser.add_argument('filename', nargs='?', help='File to share')
parser.add_argument('--local-only', action='store_true', dest='local_only', help=translated("help_local_only"))
parser.add_argument('--stay-open', action='store_true', dest='stay_open', help=translated("help_stay_open"))
parser.add_argument('--debug', action='store_true', dest='debug', help=translated("help_debug"))
parser.add_argument('filename', nargs='?', help=translated("help_filename"))
args = parser.parse_args()
filename = args.filename
@ -352,7 +352,7 @@ def main():
alert(root_p.stderr.read())
return
else:
alert('Unknown error with Tails root process')
alert(translated("error_tails_unknown_root"))
return
else:
# if not tails, start hidden service normally