Skip to content

Commit

Permalink
bugfix: Locales for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
torzdf committed Jun 6, 2023
1 parent e2ad3e2 commit 013f301
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -488,5 +488,5 @@ known-third-party=enchant

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
17 changes: 11 additions & 6 deletions faceswap.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
#!/usr/bin/env python3
""" The master faceswap.py script """
import gettext
import locale
import os
import sys

from lib.cli import args as cli_args
from lib.config import generate_configs
from lib.utils import get_backend
# Translations don't work by default in Windows, so hack in environment variable
if sys.platform.startswith("win"):
os.environ["LANG"], _ = locale.getdefaultlocale()

from lib.cli import args as cli_args # pylint:disable=wrong-import-position
from lib.config import generate_configs # pylint:disable=wrong-import-position
from lib.utils import get_backend # pylint:disable=wrong-import-position

# LOCALES
_LANG = gettext.translation("faceswap", localedir="locales", fallback=True)
_ = _LANG.gettext


if sys.version_info < (3, 7):
raise Exception("This program requires at least python3.7")
raise ValueError("This program requires at least python3.7")
if get_backend() == "amd" and sys.version_info >= (3, 9):
raise Exception("The AMD version of Faceswap cannot run on versions of Python higher than 3.8")
raise ValueError("The AMD version of Faceswap cannot run on versions of Python higher "
"than 3.8")


_PARSER = cli_args.FullHelpArgumentParser()
Expand Down

0 comments on commit 013f301

Please sign in to comment.