TranslateTextRequest

Both users and bots may be able to use this method. See code examples.

---functions---
messages.translateText#24ce6dee flags:# peer:flags.0?InputPeer msg_id:flags.0?int text:flags.1?string from_lang:flags.2?string to_lang:string = messages.TranslatedText

Returns

messages.TranslatedText

This type can be an instance of either:

TranslateNoResultTranslateResultText

Parameters

to_langstring
peerInputPeerThis argument defaults to None and can be omitted. Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer, User or Channel objects, etc.).
msg_idintThis argument defaults to None and can be omitted.
textstringThis argument defaults to None and can be omitted.
from_langstringThis argument defaults to None and can be omitted.

Known RPC errors

This request can't cause any RPC error as far as we know.

Example

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.messages.TranslateTextRequest(
        to_lang='some string here',
        peer='username',
        msg_id=42,
        text='some string here',
        from_lang='some string here'
    ))
    print(result.stringify())