Skip to content

Commit

Permalink
Fix for issue if environ['LANG'] is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
digidigital authored Feb 21, 2021
1 parent 887080e commit effaa9a
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions Code/AESify.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/local/bin/python
# coding: utf-8
from os import path
from os import path, getcwd, environ
import locale
import secrets
import webbrowser
import gettext
Expand All @@ -11,14 +12,14 @@
import pyperclip
from pikepdf import Pdf, Page, Permissions, Encryption, PasswordError, PdfError

# Environment of Windows executable created with cxFreeze seems to have no language setting
if "LANG" not in environ:
environ['LANG'] = locale.getdefaultlocale()[0]

# Set up translation, fall back to default if no translation file is found
try:
localization = gettext.translation('AESify', localedir='./locale')
localization.install()
_=localization.gettext
except FileNotFoundError:
_=gettext.gettext
localization = gettext.translation('AESify', localedir=getcwd() + '/locale', fallback=True)
localization.install()
_=localization.gettext

aboutPage = 'https://github.com/digidigital/AESify/blob/main/About.md'
version = '1.5.1'
Expand All @@ -34,7 +35,6 @@
# Characters that can be misinterpreted by humans (1 I l | O 0 o ' ` , . / \ ;) and some hard to reach special characters have been removed
passwordPool = '23456789abcdefghjkmnrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ!#$%&()*+-<=>?@[]_:'


theme='DefaultNoMoreNagging'
sg.theme(theme)
background = sg.LOOK_AND_FEEL_TABLE[theme]['BACKGROUND']
Expand Down Expand Up @@ -454,7 +454,3 @@ def updatePassword(key, password):
popUp(_('Please select an input file first!'))

window.close()




0 comments on commit effaa9a

Please sign in to comment.