feat: Load language file in lang/ instead of the ini file.

This commit is contained in:
Terry Geng
2020-07-11 11:01:33 +08:00
parent e84607b8e8
commit 9e2e09e5fd
12 changed files with 123 additions and 217 deletions

12
util.py
View File

@ -8,7 +8,6 @@ import io
import sys
import variables as var
import zipfile
import requests
import re
import subprocess as sp
import logging
@ -416,6 +415,17 @@ def verify_password(password, salted_hash, salt):
return False
def get_supported_language():
lang_files = os.listdir('lang')
lang_list = []
for lang_file in lang_files:
match = re.search("[a-z]{2}_[A-Z]{2}", lang_file)
if match:
lang_list.append(lang_file)
return lang_list
class LoggerIOWrapper(io.TextIOWrapper):
def __init__(self, logger: logging.Logger, logging_level, fallback_io_buffer):
super().__init__(fallback_io_buffer, write_through=True)