Browse Source

fix(azure_speech): 修正讯飞语音识别支持的语言代码

将支持的语言代码中的错误值"en-TW"更正为"zh-TW",以正确匹配台湾中文的语言标识。同时为语音识别入口添加登录和积分检查逻辑,并在相关方法上补充注释说明。
newdev_shunjiawei
lxm 8 months ago
parent
commit
5bb6930768
  1. 2
      lib/modules/translation/controllers/translation_controller.dart
  2. 2
      local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureAsrHelper.kt
  3. 990
      local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureAsrHelper.swift

2
lib/modules/translation/controllers/translation_controller.dart

@ -964,8 +964,10 @@ class TranslationController extends GetxController with WidgetsBindingObserver {
} }
/// 开始语音识别 /// 开始语音识别
/// 同声翻译、通话翻译、多媒体翻译的语音识别调用入口
Future<void> startRecognition() async { Future<void> startRecognition() async {
Logger.info('开始语音识别'); Logger.info('开始语音识别');
//检查用户是否登录且积分是否足够,不足则提示充值
if (User.isLoggedIn() && User.instance.tradeintegral <= 0) { if (User.isLoggedIn() && User.instance.tradeintegral <= 0) {
showRechargeDialog('translation'); showRechargeDialog('translation');
return; return;

2
local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureAsrHelper.kt

@ -130,7 +130,7 @@ class AzureAsrHelper(private val context: Context) {
val xunfeiConfigReady = this.xunfeiAppId.isNotBlank() && val xunfeiConfigReady = this.xunfeiAppId.isNotBlank() &&
this.xunfeiAccessKeyId.isNotBlank() && this.xunfeiAccessKeyId.isNotBlank() &&
this.xunfeiAccessKeySecret.isNotBlank() this.xunfeiAccessKeySecret.isNotBlank()
this.useXunfei = supportedLanguages.all { it == "zh-CN" || it == "en-US" || it == "zh-HK"|| it == "en-TW" } && xunfeiConfigReady this.useXunfei = supportedLanguages.all { it == "zh-CN" || it == "en-US" || it == "zh-HK"|| it == "zh-TW" } && xunfeiConfigReady
// 根据支持的语言数量决定是否启用自动语言检测 // 根据支持的语言数量决定是否启用自动语言检测
this.isAutoDetectLanguage = supportedLanguages.size >= 2 this.isAutoDetectLanguage = supportedLanguages.size >= 2

990
local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureAsrHelper.swift

File diff suppressed because it is too large
Loading…
Cancel
Save