From 4b889221048cc2ab8f7d53964516555fddd7f577 Mon Sep 17 00:00:00 2001 From: mailchuck Date: Wed, 11 Nov 2015 02:42:03 +0100 Subject: [PATCH] Translation directory for OSX bundles Addresses bitmessage#514 --- src/bitmessageqt/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 447b8d9b..3d68f37d 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -67,11 +67,13 @@ def _translate(context, text): def change_translation(locale): global qtranslator qtranslator = QtCore.QTranslator() - translationpath = os.path.join( - getattr(sys, '_MEIPASS', sys.path[0]), - 'translations', - 'bitmessage_' + locale - ) + if shared.frozen == "macosx_app": + translationpath = os.environ.get("RESOURCEPATH") + elif shared.frozen: # windows + translationpath = sys._MEIPASS + else: + translationpath = os.path.dirname(os.path.dirname(__file__)) + translationpath = os.path.join (translationpath, 'translations', 'bitmessage_' + locale) qtranslator.load(translationpath) QtGui.QApplication.installTranslator(qtranslator)