• UIKit
  • SDK
  • 서버 API
  • 개요
  • 설치
    • TUIKit
      • React
      • Vue
    • TUIChat만
      • React
      • Vue
  • Features
    • 반응
    • 읽음 확인
    • 입력 상태
    • 사용자 온라인 상태
    • Message Search
    • Quote Reply
    • Voice Message To Text
    • Translate Message
  • 주제
    • UI 스타일 설정
      • Web
      • 모바일
  • 맞춤화
    • 메시지 맞춤화
    • Customize Emoji and Stickers
  • 현지화
  • Guideline for Beginners
  • 콘솔 안내
    • 애플리케이션 생성 및 업그레이드
    • 기본 구성
    • 기능 구성
    • 계정 관리
    • 그룹 관리
    • 콜백 구성
  • 제품 소개
    • 메시지 관리
      • 1대1 메시지
      • 메시지 저장
      • 오프라인 푸시
      • 그룹 메시지
      • 메시지 포맷
    • 계정 시스템
      • 로그인 인증
      • 온라인 상태 관리
    • 그룹 관련
      • 그룹 시스템
      • 그룹 관리
    • 사용자 정보 및 관계망
      • 정보 관리
      • 관계망 관리
  • 구매 가이드
    • 과금 개요
    • 가격
  • 에러코드
이 페이지는 현재 영어로만 제공되며 한국어 버전은 곧 제공될 예정입니다. 기다려 주셔서 감사드립니다.

Translate Message

Feature Description

Starting from version v2.1.0, TUIKit offers a text message translation feature. The messaging tool in the TUIChat component supports translating text messages. Currently, it can translate from mainstream languages to languages such as English, Chinese, Russian, Japanese, Korean, and more. For details on supported languages, see the Text Translation Support List.
After text translation, the results will be retained for the duration of the current login session, and remain saved even after conversation switching. If you switch conversations and change the target language for translation, the previous translation results will automatically be translated into the new target language.
The text message translation feature is currently offered for free. You can contact us through the Telegram technical exchange group to enable and experience the full feature.

Feature Introduction

Setting the Target Language for Translation

The default target language for translation is Chinese, but you can also manually switch the target language. Import TUIChatService from @tencentcloud/chat-uikit-engine and call the setTranslationLanguage method, as shown in the following code:
import { TUIChatService } from "@tencentcloud/chat-uikit-engine";

// Switches to English.
// Switches to Chinese.
// Switches to Japanese and supports other languages as well.
Logging in again will reset the default translation to Chinese.

Setting the Source Language for Translation

Currently, in TUIKit, it is default and recommended to use automatic detection of the source language, but you can also manually set the source language to ensure the accuracy of the translation.
In TUIChat/utils/translation.ts, a translation utility class Translator is implemented, where you can change the sourceLanguage attribute according to the Text Translation Language Support List.
sourceTextList: [text],
sourceLanguage: 'auto', // zh/en/jp/kr
}).then((response) => {
// response data

Extended Reading

The following content serves as supplementary reading material only. Text message translation and related features have been implemented in TUIKit 2.1.0 and later, and do not require manual implementation by users.

Checking Whether the Current Package Supports the Translation Feature

By querying the StoreName.APP in TUIStore for the key enabledTranslationPlugin, the obtained boolean value indicates whether the feature is enabled.
const enable = TUIStore.getData(StoreName.APP, 'enabledTranslationPlugin');

Removing the Translation Feature

In the file TUIKit/components/TUIChat/message-list/message-tool/index.vue, simply delete the object with the key translate in actionItems.
key: 'translate',
text: TUITranslateService.t('TUIChat.Translation'),
visible: false,
iconUrl: translateIcon,
renderCondition() {},
clickEvent: translateMessage,

Text Translation Language Support List

Source Language
Supported Target Language
zh (Simplified Chinese)
en (English), ja (Japanese), ko (Korean), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), ru (Russian), pt (Portuguese), vi (Vietnamese), id (Indonesian), th (Thai), ms (Malay)
zh-TW (Traditional Chinese)
en (English), ja (Japanese), ko (Korean), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), ru (Russian), pt (Portuguese), vi (Vietnamese), id (Indonesian), th (Thai), ms (Malay)
en (English)
zh (Chinese), ja (Japanese), ko (Korean), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), ru (Russian), pt (Portuguese), vi (Vietnamese), id (Indonesian), th (Thai), ms (Malay), ar (Arabic), hi (Hindi)
ja (Japanese)
zh (Chinese), en (English), ko (Korean)
ko (Korean)
zh (Chinese), en (English), ja (Japanese)
fr (French)
zh (Chinese), en (English), es (Spanish), it (Italian), de (German), tr (Turkish), ru (Russian), pt (Portuguese)
es (Spanish)
zh (Chinese), en (English), fr (French), it (Italian), de (German), tr (Turkish), ru (Russian), pt (Portuguese)
it (Italian)
zh (Chinese), en (English), fr (French), es (Spanish), de (German), tr (Turkish), ru (Russian), pt (Portuguese)
de (German)
zh (Chinese), en (English), fr (French), es (Spanish), it (Italian), tr (Turkish), ru (Russian), pt (Portuguese)
tr (Turkish)
zh (Chinese), en (English), fr (French), es (Spanish), it (Italian), de (German), ru (Russian), pt (Portuguese)
ru (Russian)
zh (Chinese), en (English), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), pt (Portuguese)
pt (Portuguese)
zh (Chinese), en (English), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), ru (Russian)
vi (Vietnamese)
zh (Chinese), en (English)
id (Indonesian)
zh (Chinese), en (English)
th (Thai)
zh (Chinese), en (English)
ms (Malay)
zh (Chinese), en (English)
ar (Arabic)
en (English)
hi (Hindi)
en (English)