Method: messages.translateText
Translate a given text
Parameters:
Name | Type | Description | Required |
---|---|---|---|
peer | Username, chat ID, Update, Message or InputPeer | If the text is a chat message, the peer ID | Optional |
msg_id | int | If the text is a chat message, the message ID | Optional |
text | string | The text to translate | Optional |
from_lang | string | Two-letter ISO 639-1 language code of the language from which the message is translated, if not set will be autodetected | Optional |
to_lang | string | Two-letter ISO 639-1 language code of the language to which the message is translated | Yes |
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();
// PHP 8+ syntax, use an array on PHP 7.
$messages_TranslatedText = $MadelineProto->messages->translateText(peer: InputPeer, msg_id: int, text: 'string', from_lang: 'string', to_lang: 'string', );