1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 09:38:57 +01:00

Add systemLangCode config

This commit is contained in:
Daniil Gentili 2023-09-26 18:43:36 +02:00
parent 8227e4d02c
commit 5d2951e527
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 41 additions and 1 deletions

View File

@ -209,7 +209,23 @@ final class WriteLoop extends Loop
if (!$this->shared->getTempAuthKey()->isInited()) {
if ($constructor === 'help.getConfig' || $constructor === 'upload.getCdnFile') {
$this->API->logger(\sprintf('Writing client info (also executing %s)...', $constructor), Logger::NOTICE);
$MTmessage['body'] = ($this->API->getTL()->serializeMethod('invokeWithLayer', ['layer' => $this->API->settings->getSchema()->getLayer(), 'query' => $this->API->getTL()->serializeMethod('initConnection', ['api_id' => $this->API->settings->getAppInfo()->getApiId(), 'api_hash' => $this->API->settings->getAppInfo()->getApiHash(), 'device_model' => !$this->connection->isCDN() ? $this->API->settings->getAppInfo()->getDeviceModel() : 'n/a', 'system_version' => !$this->connection->isCDN() ? $this->API->settings->getAppInfo()->getSystemVersion() : 'n/a', 'app_version' => $this->API->settings->getAppInfo()->getAppVersion(), 'system_lang_code' => $this->API->settings->getAppInfo()->getLangCode(), 'lang_code' => $this->API->settings->getAppInfo()->getLangCode(), 'lang_pack' => $this->API->settings->getAppInfo()->getLangPack(), 'proxy' => $this->connection->getInputClientProxy(), 'query' => $MTmessage['body']])]));
$MTmessage['body'] = ($this->API->getTL()->serializeMethod('invokeWithLayer', [
'layer' => $this->API->settings->getSchema()->getLayer(),
'query' => $this->API->getTL()->serializeMethod(
'initConnection', [
'api_id' => $this->API->settings->getAppInfo()->getApiId(),
'api_hash' => $this->API->settings->getAppInfo()->getApiHash(),
'device_model' => !$this->connection->isCDN() ? $this->API->settings->getAppInfo()->getDeviceModel() : 'n/a',
'system_version' => !$this->connection->isCDN() ? $this->API->settings->getAppInfo()->getSystemVersion() : 'n/a',
'app_version' => $this->API->settings->getAppInfo()->getAppVersion(),
'system_lang_code' => $this->API->settings->getAppInfo()->getLangCode(),
'lang_code' => $this->API->settings->getAppInfo()->getLangCode(),
'lang_pack' => $this->API->settings->getAppInfo()->getLangPack(),
'proxy' => $this->connection->getInputClientProxy(),
'query' => $MTmessage['body']
]
)
]));
} else {
$this->API->logger("Skipping $message due to uninited connection in DC $this->datacenter");
$skipped = true;

View File

@ -55,6 +55,10 @@ final class AppInfo extends SettingsAbstract
* Language code.
*/
protected string $langCode = 'en';
/**
* System language code.
*/
protected string $systemLangCode = 'en';
/**
* Language pack.
*/
@ -237,6 +241,26 @@ final class AppInfo extends SettingsAbstract
return $this;
}
/**
* Get system language code.
*/
public function getSystemLangCode(): string
{
return $this->systemLangCode;
}
/**
* Set system language code.
*
* @param string $langCode Language code.
*/
public function setSystemLangCode(string $langCode): self
{
$this->systemLangCode = $langCode;
return $this;
}
/**
* Get language pack.
*/