set default fallback locale for gettext

This commit is contained in:
K4YT3X 2021-01-07 00:35:58 -05:00
parent b41f1f7e6c
commit 9213e3e13a
2 changed files with 8 additions and 4 deletions

View File

@ -4,7 +4,7 @@
Name: Video2X Upscaler Name: Video2X Upscaler
Author: K4YT3X Author: K4YT3X
Date Created: December 10, 2018 Date Created: December 10, 2018
Last Modified: October 26, 2020 Last Modified: December 30, 2020
Description: This file contains the Upscaler class. Each Description: This file contains the Upscaler class. Each
instance of the Upscaler class is an upscaler on an image or instance of the Upscaler class is an upscaler on an image or
@ -48,6 +48,8 @@ LOCALE_DIRECTORY = pathlib.Path(__file__).parent.absolute() / "locale"
# getting default locale settings # getting default locale settings
default_locale, encoding = locale.getdefaultlocale() default_locale, encoding = locale.getdefaultlocale()
if default_locale is None:
default_locale = "en_US"
language = gettext.translation( language = gettext.translation(
DOMAIN, LOCALE_DIRECTORY, [default_locale], fallback=True DOMAIN, LOCALE_DIRECTORY, [default_locale], fallback=True
) )
@ -55,7 +57,7 @@ language.install()
_ = language.gettext _ = language.gettext
# version information # version information
UPSCALER_VERSION = "4.4.1" UPSCALER_VERSION = "4.4.2"
# these names are consistent for # these names are consistent for
# - driver selection in command line # - driver selection in command line

View File

@ -13,7 +13,7 @@ __ __ _ _ ___ __ __
Name: Video2X Controller Name: Video2X Controller
Creator: K4YT3X Creator: K4YT3X
Date Created: Feb 24, 2018 Date Created: Feb 24, 2018
Last Modified: September 13, 2020 Last Modified: December 30, 2020
Editor: BrianPetkovsek Editor: BrianPetkovsek
Last Modified: June 17, 2019 Last Modified: June 17, 2019
@ -76,13 +76,15 @@ LOCALE_DIRECTORY = pathlib.Path(__file__).parent.absolute() / "locale"
# getting default locale settings # getting default locale settings
default_locale, encoding = locale.getdefaultlocale() default_locale, encoding = locale.getdefaultlocale()
if default_locale is None:
default_locale = "en_US"
language = gettext.translation( language = gettext.translation(
DOMAIN, LOCALE_DIRECTORY, [default_locale], fallback=True DOMAIN, LOCALE_DIRECTORY, [default_locale], fallback=True
) )
language.install() language.install()
_ = language.gettext _ = language.gettext
CLI_VERSION = "4.3.1" CLI_VERSION = "4.3.2"
LEGAL_INFO = _( LEGAL_INFO = _(
"""Video2X CLI Version: {} """Video2X CLI Version: {}