translateText method

  1. @override
Future<String> translateText(
  1. String text,
  2. String target
)
override

Implementation

@override
Future<String> translateText(String text, String target) async {
  final result = await TencentImSDKPlugin.v2TIMManager
      .getMessageManager()
      .translateText(texts: [text], targetLanguage: target);
  if (result.code != 0) {
    _coreService.callOnCallback(TIMCallback(
        type: TIMCallbackType.API_ERROR,
        errorMsg: result.desc,
        errorCode: result.code));
  }
  return result.data?[text] ?? "";
}