mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-21 22:03:18 -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 threading
|
||||
import tzlocal
|
||||
import ctypes
|
||||
|
||||
import plexpy
|
||||
from plexpy import common, config, database, helpers, logger, webstart
|
||||
|
@ -69,10 +70,20 @@ def main():
|
|||
plexpy.SYS_ENCODING = None
|
||||
|
||||
try:
|
||||
locale.setlocale(locale.LC_ALL, "")
|
||||
plexpy.SYS_LANGUAGE, plexpy.SYS_ENCODING = locale.getlocale()
|
||||
if not plexpy.SYS_ENCODING:
|
||||
plexpy.SYS_ENCODING = locale.getencoding()
|
||||
|
||||
language_code, encoding = locale.getlocale()
|
||||
if not encoding:
|
||||
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):
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue