Skip to content

Commit

Permalink
Fix translations on Mac.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marginal committed May 22, 2015
1 parent c42369c commit e9aee02
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
14 changes: 3 additions & 11 deletions EliteOCR.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,18 +1126,10 @@ def enableButton(self, button, switch):
self.repaint()

def translateApp(app, qtTranslator):
if getattr(sys, 'frozen', False):
application_path = dirname(sys.executable).decode(sys.getfilesystemencoding())
elif __file__:
application_path = dirname(__file__).decode(sys.getfilesystemencoding())
else:
application_path = u"."
settings = QSettings('seeebek', 'eliteOCR')
ui_language = unicode(settings.value('ui_language', 'en', type=QString))
#application_path = unicode(application_path).encode('windows-1252')

settings = Settings()
ui_language = settings["ui_language"]
if not ui_language == 'en':
path = application_path+ os.sep +"translations"+ os.sep
path = join(settings.app_path, "translations")
if isdir(path):
qtTranslator.load("EliteOCR_"+ui_language, path)
app.installTranslator(qtTranslator)
Expand Down
5 changes: 4 additions & 1 deletion eliteOCRGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file 'eliteOCRGUI.ui'
#
# Created: Tue May 19 14:08:28 2015
# Created: Fri May 22 02:30:30 2015
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
Expand Down Expand Up @@ -482,9 +482,11 @@ def setupUi(self, MainWindow):
self.actionOpen = QtGui.QAction(MainWindow)
self.actionOpen.setObjectName(_fromUtf8("actionOpen"))
self.actionExit = QtGui.QAction(MainWindow)
self.actionExit.setMenuRole(QtGui.QAction.QuitRole)
self.actionExit.setObjectName(_fromUtf8("actionExit"))
self.actionPreferences = QtGui.QAction(MainWindow)
self.actionPreferences.setCheckable(False)
self.actionPreferences.setMenuRole(QtGui.QAction.PreferencesRole)
self.actionPreferences.setObjectName(_fromUtf8("actionPreferences"))
self.actionCommodity_Editor = QtGui.QAction(MainWindow)
self.actionCommodity_Editor.setObjectName(_fromUtf8("actionCommodity_Editor"))
Expand All @@ -496,6 +498,7 @@ def setupUi(self, MainWindow):
self.actionUpdate = QtGui.QAction(MainWindow)
self.actionUpdate.setObjectName(_fromUtf8("actionUpdate"))
self.actionAbout = QtGui.QAction(MainWindow)
self.actionAbout.setMenuRole(QtGui.QAction.AboutRole)
self.actionAbout.setObjectName(_fromUtf8("actionAbout"))
self.actionSetup_Wizard = QtGui.QAction(MainWindow)
self.actionSetup_Wizard.setObjectName(_fromUtf8("actionSetup_Wizard"))
Expand Down
9 changes: 9 additions & 0 deletions eliteOCRGUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,9 @@
<property name="text">
<string>Exit</string>
</property>
<property name="menuRole">
<enum>QAction::QuitRole</enum>
</property>
</action>
<action name="actionPreferences">
<property name="checkable">
Expand All @@ -1072,6 +1075,9 @@
<property name="text">
<string>Preferences</string>
</property>
<property name="menuRole">
<enum>QAction::PreferencesRole</enum>
</property>
</action>
<action name="actionCommodity_Editor">
<property name="text">
Expand Down Expand Up @@ -1100,6 +1106,9 @@
<property name="text">
<string>About</string>
</property>
<property name="menuRole">
<enum>QAction::AboutRole</enum>
</property>
</action>
<action name="actionSetup_Wizard">
<property name="text">
Expand Down
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def getUserProfile(self):
return isdir(path) and path or u"."

def getPathToSelf(self):
"""Return the path to EliteOCR.py or EliteOCR.exe"""
"""Return the path to our supporting files"""
if getattr(sys, 'frozen', False):
if platform=='darwin':
application_path = normpath(join(dirname(sys.executable), os.pardir, 'Resources'))
Expand Down

0 comments on commit e9aee02

Please sign in to comment.