Commit e81725978d5b09767f77ac4261700383601af474

Authored by tatiana
1 parent abb3cdf4

FIX: Error on linux2 when running from source and bin, and there is a new language in the source

Showing 2 changed files with 16 additions and 7 deletions   Show diff stats
invesalius/i18n.py
... ... @@ -64,8 +64,11 @@ def GetLocaleOS():
64 64  
65 65 def InstallLanguage(language):
66 66 language_dir = os.path.abspath(os.path.join('..','locale'))
67   - lang = gettext.translation('invesalius', language_dir,\
  67 + if os.path.isdir(language_dir):
  68 + lang = gettext.translation('invesalius', language_dir,\
68 69 languages=[language], codeset='utf8')
69   - # Using unicode
70   - lang.install(unicode=1)
71   - return lang.ugettext
  70 + # Using unicode
  71 + lang.install(unicode=1)
  72 + return lang.ugettext
  73 + else:
  74 + return False
... ...
invesalius/invesalius.py
... ... @@ -90,13 +90,19 @@ class SplashScreen(_SplashScreen):
90 90 create_session = True
91 91  
92 92 # Check if there is a language set (if session file exists
93   - if session.ReadLanguage():
  93 + language_exist = session.ReadLanguage()
  94 +
  95 + if language_exist:
94 96 lang = session.GetLanguage()
95   - _ = i18n.InstallLanguage(lang)
  97 + install = i18n.InstallLanguage(lang)
  98 + if install:
  99 + _ = install
  100 + else:
  101 + language_exist = False
96 102  
97 103 # If no language is set into session file, show dialog so
98 104 # user can select language
99   - else:
  105 + if not language_exist:
100 106 dialog = lang_dlg.LanguageDialog()
101 107  
102 108 # FIXME: This works ok in linux2, darwin and win32,
... ...