@tencentcloud/chat-uikit-engine
导出 TUIChatService
并调用setTranslationLanguage
方法,如下文代码所示:import { TUIChatService } from "@tencentcloud/chat-uikit-engine";// 切换为英文TUIChatService.setTranslationLanguage('en');// 切换为中文TUIChatService.setTranslationLanguage('zh');// 切换为日语 也支持其他语言TUIChatService.setTranslationLanguage('jp');
TUIChatService.translateText({sourceTextList: [text],sourceLanguage: 'auto', // zh/en/jp/kr}).then((response) => {// response data});
TUIStore
查询 StoreName.APP
中 enabledTranslationPlugin
这个 key,得到的布尔值即是开通结果。const enable = TUIStore.getData(StoreName.APP, 'enabledTranslationPlugin');
TUIKit/components/TUIChat/message-list/message-tool/index.vue
中,删除 actionItems
中 key 为 translate
的对象即可。{key: 'translate',text: TUITranslateService.t('TUIChat.翻译'),visible: false,iconUrl: translateIcon,renderCondition() {},clickEvent: translateMessage,}
源语言 | 支持的目标语言 |
zh(简体中文) | en(英语)、ja(日语)、ko(韩语)、fr(法语)、es(西班牙语)、it(意大利语)、de(德语)、tr(土耳其语)、ru(俄语)、pt(葡萄牙语)、vi(越南语)、id(印尼语)、th(泰语)、ms(马来语) |
zh-TW(繁体中文) | en(英语)、ja(日语)、ko(韩语)、fr(法语)、es(西班牙语)、it(意大利语)、de(德语)、tr(土耳其语)、ru(俄语)、pt(葡萄牙语)、vi(越南语)、id(印尼语)、th(泰语)、ms(马来语) |
en(英语) | zh(中文)、ja(日语)、ko(韩语)、fr(法语)、es(西班牙语)、it(意大利语)、de(德语)、tr(土耳其语)、ru(俄语)、pt(葡萄牙语)、vi(越南语)、id(印尼语)、th(泰语)、ms(马来语)、ar(阿拉伯语)、hi(印地语) |
ja(日语) | zh(中文)、en(英语)、ko(韩语) |
ko(韩语) | zh(中文)、en(英语)、ja(日语) |
fr(法语) | zh(中文)、en(英语)、es(西班牙语)、it(意大利语)、de(德语)、tr(土耳其语)、ru(俄语)、pt(葡萄牙语) |
es(西班牙语) | zh(中文)、en(英语)、fr(法语)、it(意大利语)、de(德语)、tr(土耳其语)、ru(俄语)、pt(葡萄牙语) |
it(意大利语) | zh(中文)、en(英语)、fr(法语)、es(西班牙语)、de(德语)、tr(土耳其语)、ru(俄语)、pt(葡萄牙语) |
de(德语) | zh(中文)、en(英语)、fr(法语)、es(西班牙语)、it(意大利语)、tr(土耳其语)、ru(俄语)、pt(葡萄牙语) |
tr(土耳其语) | zh(中文)、en(英语)、fr(法语)、es(西班牙语)、it(意大利语)、de(德语)、ru(俄语)、pt(葡萄牙语) |
ru(俄语) | zh(中文)、en(英语)、fr(法语)、es(西班牙语)、it(意大利语)、de(德语)、tr(土耳其语)、pt(葡萄牙语) |
pt(葡萄牙语) | zh(中文)、en(英语)、fr(法语)、es(西班牙语)、it(意大利语)、de(德语)、tr(土耳其语)、ru(俄语) |
vi(越南语) | zh(中文)、en(英语) |
id(印尼语) | zh(中文)、en(英语) |
th(泰语) | zh(中文)、en(英语) |
ms(马来语) | zh(中文)、en(英语) |
ar(阿拉伯语) | en(英语) |
hi(印地语) | en(英语) |
本页内容是否解决了您的问题?