From f4dadd728c9953b6917b028dd203d6b58cc6bc17 Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Sat, 13 Jan 2024 19:34:53 +0300 Subject: [PATCH] Allow to specify a language pack --- pyrogram/client.py | 7 +++++++ pyrogram/session/session.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pyrogram/client.py b/pyrogram/client.py index d2117fa5..1ea78b32 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -88,6 +88,10 @@ class Client(Methods): Operating System version. 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*): Code of the language used on the client, in ISO 639-1 standard. Defaults to "en". @@ -187,6 +191,7 @@ class Client(Methods): DEVICE_MODEL = f"{platform.python_implementation()} {platform.python_version()}" SYSTEM_VERSION = f"{platform.system()} {platform.release()}" + LANG_PACK = "" LANG_CODE = "en" PARENT_DIR = Path(sys.argv[0]).parent @@ -211,6 +216,7 @@ class Client(Methods): app_version: str = APP_VERSION, device_model: str = DEVICE_MODEL, system_version: str = SYSTEM_VERSION, + lang_pack: str = LANG_PACK, lang_code: str = LANG_CODE, ipv6: bool = False, proxy: dict = None, @@ -240,6 +246,7 @@ class Client(Methods): self.app_version = app_version self.device_model = device_model self.system_version = system_version + self.lang_pack = lang_pack.lower() self.lang_code = lang_code.lower() self.ipv6 = ipv6 self.proxy = proxy diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index 6830d726..7206050d 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -126,8 +126,8 @@ class Session: device_model=self.client.device_model, system_version=self.client.system_version, system_lang_code=self.client.lang_code, + lang_pack=self.client.lang_pack, lang_code=self.client.lang_code, - lang_pack="", query=raw.functions.help.GetConfig(), ) ),