Do not fail if gettext.bindtextdomain not working (#485)

This commit is contained in:
Anjan Momi 2022-10-13 11:53:26 -04:00 committed by GitHub
parent dd16395471
commit d3594bdb8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -90,9 +90,12 @@ def main():
"""
system_locale = gettext.translation('safeeyes', localedir=utility.LOCALE_PATH, languages=[utility.system_locale(), 'en_US'], fallback=True)
system_locale.install()
# locale.bindtextdomain is required for Glade files
# gettext.bindtextdomain(gettext.textdomain(), Utility.LOCALE_PATH)
locale.bindtextdomain('safeeyes', utility.LOCALE_PATH)
try:
# locale.bindtextdomain is required for Glade files
locale.bindtextdomain('safeeyes', utility.LOCALE_PATH)
except AttributeError:
logging.warning('installed python\'s gettext module does not support locale.bindtextdomain. locale.bindtextdomain is required for Glade files')
parser = argparse.ArgumentParser(prog='safeeyes', description=_('description'))
group = parser.add_mutually_exclusive_group()