mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-24 06:55:26 -07:00
Added Special Case For Windows (#2345)
This commit is contained in:
parent
71d7c4dddf
commit
6dc53da8bf
1 changed files with 15 additions and 4 deletions
19
Tautulli.py
19
Tautulli.py
|
@ -34,6 +34,7 @@ import shutil
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
import tzlocal
|
import tzlocal
|
||||||
|
import ctypes
|
||||||
|
|
||||||
import plexpy
|
import plexpy
|
||||||
from plexpy import common, config, database, helpers, logger, webstart
|
from plexpy import common, config, database, helpers, logger, webstart
|
||||||
|
@ -69,10 +70,20 @@ def main():
|
||||||
plexpy.SYS_ENCODING = None
|
plexpy.SYS_ENCODING = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
locale.setlocale(locale.LC_ALL, "")
|
|
||||||
plexpy.SYS_LANGUAGE, plexpy.SYS_ENCODING = locale.getlocale()
|
language_code, encoding = locale.getlocale()
|
||||||
if not plexpy.SYS_ENCODING:
|
if not encoding:
|
||||||
plexpy.SYS_ENCODING = locale.getencoding()
|
encoding = locale.getencoding()
|
||||||
|
|
||||||
|
# Special case for Windows where getlocale doesn't return correctly
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
# Get the kernel of the OS and the default UI Language to locate the language code in Windows
|
||||||
|
windll = ctypes.windll.kernel32
|
||||||
|
language_code = locale.windows_locale[windll.GetUserDefaultUILanguage()]
|
||||||
|
encoding = "cp1252"
|
||||||
|
|
||||||
|
plexpy.SYS_LANGUAGE = language_code
|
||||||
|
plexpy.SYS_ENCODING = encoding
|
||||||
except (locale.Error, IOError):
|
except (locale.Error, IOError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue