Link Search Menu Expand Document

Method: messages.translateText

Back to methods index

Translate a given text.

Styled text entities will only be preserved for Telegram Premium users.


peerUsername, chat ID, Update, Message or InputPeerIf the text is a chat message, the peer IDOptional
idArray of intA list of message IDs to translateOptional
textArray of TextWithEntitiesA list of styled messages to translateOptional
to_langstringTwo-letter ISO 639-1 language code of the language to which the message is translatedOptional

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('', 'madeline.php');
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');

$messages_TranslatedText = $MadelineProto->messages->translateText(peer: $InputPeer, id: [$int, $int], text: [$TextWithEntities, $TextWithEntities], to_lang: 'string', );