Skip to content

Commit

Permalink
Merge 4525f75 into d6b167f
Browse files Browse the repository at this point in the history
  • Loading branch information
topic2k committed Jan 29, 2019
2 parents d6b167f + 4525f75 commit 6a2e4dc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
4 changes: 1 addition & 3 deletions eg/Classes/App.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ class App(wx.App):
def __init__(self):
self.onExitFuncs = []
wx.App.__init__(self, 0)
lang_id = LCID_TO_WX.get(kernel32.GetUserDefaultUILanguage(), None)

if lang_id is not None:
self.locale = wx.Locale(lang_id)
self.locale = wx.Locale(eg.Cli.lang_id)

self.shouldVeto = False
self.firstQuery = True
Expand Down
22 changes: 16 additions & 6 deletions eg/Cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,24 @@
import locale
import os
import sys
import threading
from os.path import abspath, dirname, join
from os.path import abspath, join

import PythonPaths
import LoopbackSocket
import wx

from . import LoopbackSocket
from . import PythonPaths
from .Classes.Translation import LCID_TO_WX

kernel32 = ctypes.windll.kernel32

lang_id = LCID_TO_WX.get(kernel32.GetUserDefaultUILanguage(), 0)
wx_loc = wx.Locale(lang_id, wx.LOCALE_DONT_LOAD_DEFAULT)
li = wx_loc.FindLanguageInfo(locale.getdefaultlocale()[0].split('_')[0])
locale.setlocale(locale.LC_ALL, li.GetLocaleName())
del li
del wx_loc

ENCODING = locale.getdefaultlocale()[1]
locale.setlocale(locale.LC_ALL, '')
argvIter = (val.decode(ENCODING) for val in sys.argv)
scriptPath = argvIter.next()

Expand Down Expand Up @@ -194,7 +204,7 @@ def send_message(msg, *msg_args):
else:
sys.exit(0)

appMutex = ctypes.windll.kernel32.CreateMutexA(
appMutex = kernel32.CreateMutexA(
None,
0,
"Global\\EventGhost:7EB106DC-468D-4345-9CFE-B0021039114B"
Expand Down
3 changes: 2 additions & 1 deletion eg/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

# Local imports
import eg
from . import PythonPaths

# Make sure our deprecation warnings will be shown
warnings.filterwarnings(
Expand Down Expand Up @@ -300,7 +301,7 @@ def GetClosestLanguage():
"""
Returns the language file closest to system locale.
"""
langDir = join(dirname(abspath(sys.executable)), "languages")
langDir = join(PythonPaths.install_directory, "languages")
if exists(langDir):
uiLang = windows_locale[windll.kernel32.GetUserDefaultUILanguage()]

Expand Down

0 comments on commit 6a2e4dc

Please sign in to comment.