From dbf4af02ac0f73a8fcea39216e20830bf68a4134 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 4 Sep 2016 20:09:18 -0700 Subject: [PATCH] Pass helpers into strings.load_strings instead of importing it, so fix issue with cx_Freeze in Windows --- onionshare/onionshare.py | 2 +- onionshare/strings.py | 5 +---- onionshare_gui/onionshare_gui.py | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py index f9c07868..b1b402e1 100644 --- a/onionshare/onionshare.py +++ b/onionshare/onionshare.py @@ -102,7 +102,7 @@ def main(cwd=None): The main() function implements all of the logic that the command-line version of onionshare uses. """ - strings.load_strings() + strings.load_strings(helpers) print(strings._('version_string').format(helpers.get_version())) # onionshare CLI in OSX needs to change current working directory (#132) diff --git a/onionshare/strings.py b/onionshare/strings.py index 116f115c..94739efb 100644 --- a/onionshare/strings.py +++ b/onionshare/strings.py @@ -19,12 +19,9 @@ along with this program. If not, see . """ import json, locale, os -from . import helpers - strings = {} - -def load_strings(default="en"): +def load_strings(helpers, default="en"): """ Loads translated strings and fallback to English if the translation does not exist. diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 1eb508bc..825fa8b5 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -284,7 +284,7 @@ def main(): """ The main() function implements all of the logic that the GUI version of onionshare uses. """ - strings.load_strings() + strings.load_strings(helpers) print(strings._('version_string').format(helpers.get_version())) # start the Qt app