Allow to specify a language pack

This commit is contained in:
KurimuzonAkuma 2024-01-13 19:34:53 +03:00
parent fa069be341
commit f4dadd728c
2 changed files with 8 additions and 1 deletions

View File

@ -88,6 +88,10 @@ class Client(Methods):
Operating System version. Operating System version.
Defaults to *platform.system() + " " + platform.release()*. Defaults to *platform.system() + " " + platform.release()*.
lang_pack (``str``, *optional*):
Name of the language pack used on the client.
Defaults to "" (empty string).
lang_code (``str``, *optional*): lang_code (``str``, *optional*):
Code of the language used on the client, in ISO 639-1 standard. Code of the language used on the client, in ISO 639-1 standard.
Defaults to "en". Defaults to "en".
@ -187,6 +191,7 @@ class Client(Methods):
DEVICE_MODEL = f"{platform.python_implementation()} {platform.python_version()}" DEVICE_MODEL = f"{platform.python_implementation()} {platform.python_version()}"
SYSTEM_VERSION = f"{platform.system()} {platform.release()}" SYSTEM_VERSION = f"{platform.system()} {platform.release()}"
LANG_PACK = ""
LANG_CODE = "en" LANG_CODE = "en"
PARENT_DIR = Path(sys.argv[0]).parent PARENT_DIR = Path(sys.argv[0]).parent
@ -211,6 +216,7 @@ class Client(Methods):
app_version: str = APP_VERSION, app_version: str = APP_VERSION,
device_model: str = DEVICE_MODEL, device_model: str = DEVICE_MODEL,
system_version: str = SYSTEM_VERSION, system_version: str = SYSTEM_VERSION,
lang_pack: str = LANG_PACK,
lang_code: str = LANG_CODE, lang_code: str = LANG_CODE,
ipv6: bool = False, ipv6: bool = False,
proxy: dict = None, proxy: dict = None,
@ -240,6 +246,7 @@ class Client(Methods):
self.app_version = app_version self.app_version = app_version
self.device_model = device_model self.device_model = device_model
self.system_version = system_version self.system_version = system_version
self.lang_pack = lang_pack.lower()
self.lang_code = lang_code.lower() self.lang_code = lang_code.lower()
self.ipv6 = ipv6 self.ipv6 = ipv6
self.proxy = proxy self.proxy = proxy

View File

@ -126,8 +126,8 @@ class Session:
device_model=self.client.device_model, device_model=self.client.device_model,
system_version=self.client.system_version, system_version=self.client.system_version,
system_lang_code=self.client.lang_code, system_lang_code=self.client.lang_code,
lang_pack=self.client.lang_pack,
lang_code=self.client.lang_code, lang_code=self.client.lang_code,
lang_pack="",
query=raw.functions.help.GetConfig(), query=raw.functions.help.GetConfig(),
) )
), ),