MadelineProtoDocs/docs/API_docs/methods/messages.translateText.md
2024-05-01 14:53:46 +02:00

1.8 KiB

title description grand_parent parent image redirect_from
messages.translateText Translate a given text. Telegram RPC API Methods https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png /API_docs/methods/messages_translateText.html

Method: messages.translateText

Back to methods index

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 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', );