[utils] Remove a redundant check in I18N

This commit is contained in:
Yen Chi Hsuan 2015-12-27 21:56:57 +08:00
parent 8a54fa704f
commit 7bdc9cc044

View File

@ -2539,14 +2539,13 @@ class I18N(object):
if t is not None: if t is not None:
return t return t
if t is None: for root in get_root_dirs():
for root in get_root_dirs(): try:
try: t = gettext.translation(self.domain, os.path.join(root, 'share', 'locale'), [lang])
t = gettext.translation(self.domain, os.path.join(root, 'share', 'locale'), [lang]) if t is not None:
if t is not None: break
break except (OSError, IOError): # OSError for 3.3+ and IOError otherwise
except (OSError, IOError): # OSError for 3.3+ and IOError otherwise t = None
t = None
if t is None and sys.platform == 'win32' and hasattr(sys, 'frozen'): if t is None and sys.platform == 'win32' and hasattr(sys, 'frozen'):
locale_data_zip = _load_exe_resource('LOCALE_DATA', 'LOCALE_DATA.ZIP') locale_data_zip = _load_exe_resource('LOCALE_DATA', 'LOCALE_DATA.ZIP')