Browse Source

fix bug where custom encoding wasn't being passed to open function

pull/240/head
chriskiehl 6 years ago
parent
commit
f90de0960b
2 changed files with 3 additions and 3 deletions
  1. 2
      gooey/gui/application.py
  2. 4
      gooey/gui/lang/i18n.py

2
gooey/gui/application.py

@ -25,7 +25,7 @@ def run(build_spec):
def build_app(build_spec): def build_app(build_spec):
app = wx.App(False) app = wx.App(False)
i18n.load(build_spec['language_dir'], build_spec['language'])
i18n.load(build_spec['language_dir'], build_spec['language'], build_spec['encoding'])
imagesPaths = image_repository.loadImages(build_spec['image_dir']) imagesPaths = image_repository.loadImages(build_spec['image_dir'])
gapp = GooeyApplication(merge(build_spec, imagesPaths)) gapp = GooeyApplication(merge(build_spec, imagesPaths))
# wx.lib.inspection.InspectionTool().Show() # wx.lib.inspection.InspectionTool().Show()

4
gooey/gui/lang/i18n.py

@ -15,12 +15,12 @@ __all__ = ['load', '_']
_DICTIONARY = None _DICTIONARY = None
def load(language_dir, filename):
def load(language_dir, filename, encoding):
''' Open and return the supplied json file ''' ''' Open and return the supplied json file '''
global _DICTIONARY global _DICTIONARY
try: try:
json_file = filename + '.json' json_file = filename + '.json'
with io.open(os.path.join(language_dir, json_file), 'r', encoding='utf-8') as f:
with io.open(os.path.join(language_dir, json_file), 'r', encoding=encoding) as f:
_DICTIONARY = json.load(f) _DICTIONARY = json.load(f)
except IOError: except IOError:
raise IOError('{0} Language file not found at location {1}. ' raise IOError('{0} Language file not found at location {1}. '

Loading…
Cancel
Save