Method: messages.translateText
Translate a given text.
Styled text entities will only be preserved for Telegram Premium users.
Parameters:
Name | Type | Description | Required |
---|---|---|---|
peer | Username, chat ID, Update, Message or InputPeer | If the text is a chat message, the peer ID | Optional |
id | Array of int | A list of message IDs to translate | Optional |
text | Array of TextWithEntities | A list of styled messages to translate | Optional |
to_lang | string | Two-letter ISO 639-1 language code of the language to which the message is translated | Optional |
Return type: messages.TranslatedText
Can userbots use this method: YES
Can bots use this method: NO
MadelineProto Example (now async for huge speed and parallelism!):
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();
$messages_TranslatedText = $MadelineProto->messages->translateText(peer: $InputPeer, id: [$int, $int], text: [$TextWithEntities, $TextWithEntities], to_lang: 'string', );