2023-05-22 14:54:47 +02:00
<!DOCTYPE html>
< html class = "" >
< head >
< meta charset = "utf-8" >
< title > Translation< / title >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< meta property = "description" content = "Telegram allows translating chat messages: Telegram Premium users may even enable real-time chat translation." >
< meta property = "og:title" content = "Translation" >
< meta property = "og:image" content = "" >
< meta property = "og:description" content = "Telegram allows translating chat messages: Telegram Premium users may even enable real-time chat translation." >
< link rel = "icon" type = "image/svg+xml" href = "/img/website_icon.svg?4" >
< link rel = "apple-touch-icon" sizes = "180x180" href = "/img/apple-touch-icon.png" >
< link rel = "icon" type = "image/png" sizes = "32x32" href = "/img/favicon-32x32.png" >
< link rel = "icon" type = "image/png" sizes = "16x16" href = "/img/favicon-16x16.png" >
< link rel = "alternate icon" href = "/img/favicon.ico" type = "image/x-icon" / >
< link href = "/css/bootstrap.min.css?3" rel = "stylesheet" >
2024-06-30 10:32:00 +02:00
< link href = "/css/telegram.css?238" rel = "stylesheet" media = "screen" >
2023-05-22 14:54:47 +02:00
< style >
< / style >
< / head >
< body class = "preload" >
< div class = "dev_page_wrap" >
< div class = "dev_page_head navbar navbar-static-top navbar-tg" >
< div class = "navbar-inner" >
< div class = "container clearfix" >
< ul class = "nav navbar-nav navbar-right hidden-xs" > < li class = "navbar-twitter" > < a href = "https://twitter.com/telegram" target = "_blank" data-track = "Follow/Twitter" onclick = "trackDlClick(this, event)" > < i class = "icon icon-twitter" > < / i > < span > Twitter< / span > < / a > < / li > < / ul >
< ul class = "nav navbar-nav" >
< li > < a href = "//telegram.org/" > Home< / a > < / li >
< li class = "hidden-xs" > < a href = "//telegram.org/faq" > FAQ< / a > < / li >
< li class = "hidden-xs" > < a href = "//telegram.org/apps" > Apps< / a > < / li >
< li class = "active" > < a href = "/api" > API< / a > < / li >
< li class = "" > < a href = "/mtproto" > Protocol< / a > < / li >
< li class = "" > < a href = "/schema" > Schema< / a > < / li >
< / ul >
< / div >
< / div >
< / div >
< div class = "container clearfix" >
< div class = "dev_page" >
< div id = "dev_page_content_wrap" class = " " >
< div class = "dev_page_bread_crumbs" > < ul class = "breadcrumb clearfix" > < li > < a href = "/api" > API< / a > < / li > < i class = "icon icon-breadcrumb-divider" > < / i > < li > < a href = "/api/translation" > Translation< / a > < / li > < / ul > < / div >
< h1 id = "dev_page_title" > Translation< / h1 >
< div id = "dev_page_content" > <!-- scroll_nav -->
< p > Telegram allows translating chat messages: < a href = "/api/premium" > Telegram Premium< / a > users may even enable real-time chat translation. < / p >
< pre > < code > < a href = '/constructor/textWithEntities' > textWithEntities< / a > #751f3146 text:< a href = '/type/string' > string< / a > entities:< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/MessageEntity' > MessageEntity< / a > > = < a href = '/type/TextWithEntities' > TextWithEntities< / a > ;
< a href = '/constructor/messages.translateResult' > messages.translateResult< / a > #33db32f8 result:< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/TextWithEntities' > TextWithEntities< / a > > = < a href = '/type/messages.TranslatedText' > messages.TranslatedText< / a > ;
---functions---
< a href = '/method/messages.translateText' > messages.translateText< / a > #63183030 flags:< a href = '/type/%23' > #< / a > peer:flags.0?< a href = '/type/InputPeer' > InputPeer< / a > id:flags.0?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/int' > int< / a > > text:flags.1?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/TextWithEntities' > TextWithEntities< / a > > to_lang:< a href = '/type/string' > string< / a > = < a href = '/type/messages.TranslatedText' > messages.TranslatedText< / a > ;< / code > < / pre >
< p > < a href = "/method/messages.translateText" > messages.translateText< / a > can be used to translate a list of chat messages (by populating the < code > peer< / code > and < code > id< / code > flags), or a generic list of messages (by populating the < code > text< / code > flag, for example when translating instant view articles). < / p >
< p > The method will return a vector of < a href = "/constructor/textWithEntities" > textWithEntities< / a > constructors, containing the translated text, and, only for < a href = "/api/premium" > Telegram Premium< / a > users, the corresponding < a href = "/api/entities" > styled text entities< / a > (i.e. correctly repositioned < strong > bold< / strong > , < em > italic< / em > , link entities for the translated message, corresponding to the same entities in the original message). < / p >
< h3 > < a class = "anchor" href = "#real-time-translation" id = "real-time-translation" name = "real-time-translation" > < i class = "anchor-icon" > < / i > < / a > Real-time translation< / h3 >
2024-02-10 15:29:33 +01:00
< pre > < code > < a href = '/constructor/userFull' > userFull< / a > #b9b12c6c flags:< a href = '/type/%23' > #< / a > blocked:flags.0?< a href = '/constructor/true' > true< / a > phone_calls_available:flags.4?< a href = '/constructor/true' > true< / a > phone_calls_private:flags.5?< a href = '/constructor/true' > true< / a > can_pin_message:flags.7?< a href = '/constructor/true' > true< / a > has_scheduled:flags.12?< a href = '/constructor/true' > true< / a > video_calls_available:flags.13?< a href = '/constructor/true' > true< / a > voice_messages_forbidden:flags.20?< a href = '/constructor/true' > true< / a > translations_disabled:flags.23?< a href = '/constructor/true' > true< / a > stories_pinned_available:flags.26?< a href = '/constructor/true' > true< / a > blocked_my_stories_from:flags.27?< a href = '/constructor/true' > true< / a > wallpaper_overridden:flags.28?< a href = '/constructor/true' > true< / a > id:< a href = '/type/long' > long< / a > about:flags.1?< a href = '/type/string' > string< / a > settings:< a href = '/type/PeerSettings' > PeerSettings< / a > personal_photo:flags.21?< a href = '/type/Photo' > Photo< / a > profile_photo:flags.2?< a href = '/type/Photo' > Photo< / a > fallback_photo:flags.22?< a href = '/type/Photo' > Photo< / a > notify_settings:< a href = '/type/PeerNotifySettings' > PeerNotifySettings< / a > bot_info:flags.3?< a href = '/type/BotInfo' > BotInfo< / a > pinned_msg_id:flags.6?< a href = '/type/int' > int< / a > common_chats_count:< a href = '/type/int' > int< / a > folder_id:flags.11?< a href = '/type/int' > int< / a > ttl_period:flags.14?< a href = '/type/int' > int< / a > theme_emoticon:flags.15?< a href = '/type/string' > string< / a > private_forward_name:flags.16?< a href = '/type/string' > string< / a > bot_group_admin_rights:flags.17?< a href = '/type/ChatAdminRights' > ChatAdminRights< / a > bot_broadcast_admin_rights:flags.18?< a href = '/type/ChatAdminRights' > ChatAdminRights< / a > premium_gifts:flags.19?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/PremiumGiftOption' > PremiumGiftOption< / a > > wallpaper:flags.24?< a href = '/type/WallPaper' > WallPaper< / a > stories:flags.25?< a href = '/type/PeerStories' > PeerStories< / a > = < a href = '/type/UserFull' > UserFull< / a > ;
2023-05-22 14:54:47 +02:00
< a href = '/constructor/chatFull' > chatFull< / a > #c9d31138 flags:< a href = '/type/%23' > #< / a > can_set_username:flags.7?< a href = '/constructor/true' > true< / a > has_scheduled:flags.8?< a href = '/constructor/true' > true< / a > translations_disabled:flags.19?< a href = '/constructor/true' > true< / a > id:< a href = '/type/long' > long< / a > about:< a href = '/type/string' > string< / a > participants:< a href = '/type/ChatParticipants' > ChatParticipants< / a > chat_photo:flags.2?< a href = '/type/Photo' > Photo< / a > notify_settings:< a href = '/type/PeerNotifySettings' > PeerNotifySettings< / a > exported_invite:flags.13?< a href = '/type/ExportedChatInvite' > ExportedChatInvite< / a > bot_info:flags.3?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/BotInfo' > BotInfo< / a > > pinned_msg_id:flags.6?< a href = '/type/int' > int< / a > folder_id:flags.11?< a href = '/type/int' > int< / a > call:flags.12?< a href = '/type/InputGroupCall' > InputGroupCall< / a > ttl_period:flags.14?< a href = '/type/int' > int< / a > groupcall_default_join_as:flags.15?< a href = '/type/Peer' > Peer< / a > theme_emoticon:flags.16?< a href = '/type/string' > string< / a > requests_pending:flags.17?< a href = '/type/int' > int< / a > recent_requesters:flags.17?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/long' > long< / a > > available_reactions:flags.18?< a href = '/type/ChatReactions' > ChatReactions< / a > = < a href = '/type/ChatFull' > ChatFull< / a > ;
2024-02-10 15:29:33 +01:00
< a href = '/constructor/channelFull' > channelFull< / a > #f2bcb6f flags:< a href = '/type/%23' > #< / a > can_view_participants:flags.3?< a href = '/constructor/true' > true< / a > can_set_username:flags.6?< a href = '/constructor/true' > true< / a > can_set_stickers:flags.7?< a href = '/constructor/true' > true< / a > hidden_prehistory:flags.10?< a href = '/constructor/true' > true< / a > can_set_location:flags.16?< a href = '/constructor/true' > true< / a > has_scheduled:flags.19?< a href = '/constructor/true' > true< / a > can_view_stats:flags.20?< a href = '/constructor/true' > true< / a > blocked:flags.22?< a href = '/constructor/true' > true< / a > flags2:< a href = '/type/%23' > #< / a > can_delete_channel:flags2.0?< a href = '/constructor/true' > true< / a > antispam:flags2.1?< a href = '/constructor/true' > true< / a > participants_hidden:flags2.2?< a href = '/constructor/true' > true< / a > translations_disabled:flags2.3?< a href = '/constructor/true' > true< / a > stories_pinned_available:flags2.5?< a href = '/constructor/true' > true< / a > view_forum_as_messages:flags2.6?< a href = '/constructor/true' > true< / a > id:< a href = '/type/long' > long< / a > about:< a href = '/type/string' > string< / a > participants_count:flags.0?< a href = '/type/int' > int< / a > admins_count:flags.1?< a href = '/type/int' > int< / a > kicked_count:flags.2?< a href = '/type/int' > int< / a > banned_count:flags.2?< a href = '/type/int' > int< / a > online_count:flags.13?< a href = '/type/int' > int< / a > read_inbox_max_id:< a href = '/type/int' > int< / a > read_outbox_max_id:< a href = '/type/int' > int< / a > unread_count:< a href = '/type/int' > int< / a > chat_photo:< a href = '/type/Photo' > Photo< / a > notify_settings:< a href = '/type/PeerNotifySettings' > PeerNotifySettings< / a > exported_invite:flags.23?< a href = '/type/ExportedChatInvite' > ExportedChatInvite< / a > bot_info:< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/BotInfo' > BotInfo< / a > > migrated_from_chat_id:flags.4?< a href = '/type/long' > long< / a > migrated_from_max_id:flags.4?< a href = '/type/int' > int< / a > pinned_msg_id:flags.5?< a href = '/type/int' > int< / a > stickerset:flags.8?< a href = '/type/StickerSet' > StickerSet< / a > available_min_id:flags.9?< a href = '/type/int' > int< / a > folder_id:flags.11?< a href = '/type/int' > int< / a > linked_chat_id:flags.14?< a href = '/type/long' > long< / a > location:flags.15?< a href = '/type/ChannelLocation' > ChannelLocation< / a > slowmode_seconds:flags.17?< a href = '/type/int' > int< / a > slowmode_next_send_date:flags.18?< a href = '/type/int' > int< / a > stats_dc:flags.12?< a href = '/type/int' > int< / a > pts:< a href = '/type/int' > int< / a > call:flags.21?< a href = '/type/InputGroupCall' > InputGroupCall< / a > ttl_period:flags.24?< a href = '/type/int' > int< / a > pending_suggestions:flags.25?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/string' > string< / a > > groupcall_default_join_as:flags.26?< a href = '/type/Peer' > Peer< / a > theme_emoticon:flags.27?< a href = '/type/string' > string< / a > requests_pending:flags.28?< a href = '/type/int' > int< / a > recent_requesters:flags.28?< a href = '/type/Vector%20t' > Vector< / a > < < a href = '/type/long' > long< / a > > default_send_as:flags.29?< a href = '/type/Peer' > Peer< / a > available_reactions:flags.30?< a href = '/type/ChatReactions' > ChatReactions< / a > stories:flags2.4?< a href = '/type/PeerStories' > PeerStories< / a > wallpaper:flags2.7?< a href = '/type/WallPaper' > WallPaper< / a > = < a href = '/type/ChatFull' > ChatFull< / a > ;
2023-05-22 14:54:47 +02:00
---functions---
< a href = '/method/messages.togglePeerTranslations' > messages.togglePeerTranslations< / a > #e47cb579 flags:< a href = '/type/%23' > #< / a > disabled:flags.0?< a href = '/constructor/true' > true< / a > peer:< a href = '/type/InputPeer' > InputPeer< / a > = < a href = '/type/Bool' > Bool< / a > ;< / code > < / pre >
< p > < a href = "/api/premium" > Telegram Premium< / a > users may also enable real-time chat translation.< br >
If the currently logged in account is a Premium account, and the < code > translations_disabled< / code > flag of < a href = "/constructor/userFull" > userFull< / a > , < a href = "/constructor/chatFull" > chatFull< / a > , < a href = "/constructor/channelFull" > channelFull< / a > is < strong > not< / strong > set, the client should run a local language recognition model for all messages received from private chats (not secret chats), chats and channels, and if:< / p >
< ul >
< li > The language recognition model was ran on at least 8 messages in the chat,< / li >
< li > < strong > and< / strong > the language of at least 35% of the processed messages was successfully detected,< / li >
< li > < strong > and< / strong > at least 65% of the messages whose language was successfully detected are in a foreign language (a language that is not the system language nor the Telegram in-app language, and a language that was not explicitly excluded from translation by the user),< / li >
< li > < strong > then< / strong > , a popup should be displayed to the user, offering to enable real-time chat translation, or to disallow translation of the detected language (the detected language is the language with most occurrences amongst all processed messages). < / li >
< / ul >
< p > If the user dismisses the autotranslation popup, invoke < a href = "/method/messages.togglePeerTranslations" > messages.togglePeerTranslations< / a > with the < code > disabled< / code > flag set: this will set the < code > translations_disabled< / code > flag in the corresponding full info constructor, signaling to the other sessions that the autotranslation popup should not be displayed. < / p >
< p > If the user enables autotranslation, store the preference locally and invoke < a href = "/method/messages.translateText" > messages.translateText< / a > for every received message, preferrably batching requests by specifying multiple message IDs in < code > id< / code > .< / p > < / div >
< / div >
< / div >
< / div >
< div class = "footer_wrap" >
< div class = "footer_columns_wrap footer_desktop" >
< div class = "footer_column footer_column_telegram" >
< h5 > Telegram< / h5 >
< div class = "footer_telegram_description" > < / div >
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/faq" > About< / a > < / h5 >
< ul >
< li > < a href = "//telegram.org/faq" > FAQ< / a > < / li >
< li > < a href = "//telegram.org/privacy" > Privacy< / a > < / li >
< li > < a href = "//telegram.org/press" > Press< / a > < / li >
< / ul >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/apps#mobile-apps" > Mobile Apps< / a > < / h5 >
< ul >
< li > < a href = "//telegram.org/dl/ios" > iPhone/iPad< / a > < / li >
< li > < a href = "//telegram.org/android" > Android< / a > < / li >
< li > < a href = "//telegram.org/dl/web" > Mobile Web< / a > < / li >
< / ul >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/apps#desktop-apps" > Desktop Apps< / a > < / h5 >
< ul >
< li > < a href = "//desktop.telegram.org/" > PC/Mac/Linux< / a > < / li >
< li > < a href = "//macos.telegram.org/" > macOS< / a > < / li >
< li > < a href = "//telegram.org/dl/web" > Web-browser< / a > < / li >
< / ul >
< / div >
< div class = "footer_column footer_column_platform" >
< h5 > < a href = "/" > Platform< / a > < / h5 >
< ul >
< li > < a href = "/api" > API< / a > < / li >
< li > < a href = "//translations.telegram.org/" > Translations< / a > < / li >
< li > < a href = "//instantview.telegram.org/" > Instant View< / a > < / li >
< / ul >
< / div >
< / div >
< div class = "footer_columns_wrap footer_mobile" >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/faq" > About< / a > < / h5 >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/blog" > Blog< / a > < / h5 >
< / div >
< div class = "footer_column" >
< h5 > < a href = "//telegram.org/apps" > Apps< / a > < / h5 >
< / div >
< div class = "footer_column" >
< h5 > < a href = "/" > Platform< / a > < / h5 >
< / div >
< div class = "footer_column" >
2024-02-15 10:54:50 +01:00
< h5 > < a href = "//telegram.org/press" > Press< / a > < / h5 >
2023-05-22 14:54:47 +02:00
< / div >
< / div >
< / div >
< / div >
< script src = "/js/main.js?47" > < / script >
< script src = "/js/jquery.min.js?1" > < / script >
< script src = "/js/bootstrap.min.js?1" > < / script >
< script > w i n d o w . i n i t D e v P a g e N a v & & i n i t D e v P a g e N a v ( ) ;
backToTopInit("Go up");
removePreloadInit();
< / script >
< / body >
< / html >