|
|
|
@ -12,6 +12,7 @@ import '../models/user_Info.dart' as userInfo; |
|
|
|
import '/data/models/appconfig_model.dart'; |
|
|
|
|
|
|
|
import '../../data/models/appconfig.dart'; |
|
|
|
import '../../core/translations/app_translations.dart'; |
|
|
|
import '../../core/utils/logger.dart'; |
|
|
|
import 'bluetooth_manager.dart'; |
|
|
|
import 'language_manager.dart'; |
|
|
|
@ -900,30 +901,44 @@ class BleManager extends GetxService { |
|
|
|
// 用户设置了特定语言 |
|
|
|
final parts = savedLanguage.split('_'); |
|
|
|
if (parts.length == 2) { |
|
|
|
final asrCode = languageManager.getAsrCodeByShortCode(parts[0]); |
|
|
|
final lang = parts[0]; |
|
|
|
final country = parts[1].toUpperCase(); |
|
|
|
|
|
|
|
if (lang == 'zh' && |
|
|
|
(country == 'HK' || country == 'TW' || country == 'CN')) { |
|
|
|
supportedLanguages.add('zh-$country'); |
|
|
|
} else { |
|
|
|
final asrCode = languageManager.getAsrCodeByShortCode(lang); |
|
|
|
if (asrCode != null) { |
|
|
|
supportedLanguages.add(asrCode); |
|
|
|
} else { |
|
|
|
// 直接使用语言-国家格式 |
|
|
|
supportedLanguages.add('${parts[0]}-${parts[1]}'); |
|
|
|
supportedLanguages.add('$lang-$country'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 跟随系统语言或未设置 |
|
|
|
final appLocale = Get.locale; |
|
|
|
final appLocale = Get.locale ?? AppTranslations.deviceLocale(); |
|
|
|
if (appLocale != null) { |
|
|
|
final lang = appLocale.languageCode; |
|
|
|
final country = appLocale.countryCode; |
|
|
|
|
|
|
|
// 尝试从语言管理器获取对应的ASR代码 |
|
|
|
if (lang.toLowerCase() == 'zh' && |
|
|
|
country != null && |
|
|
|
country.isNotEmpty && |
|
|
|
(country.toUpperCase() == 'HK' || |
|
|
|
country.toUpperCase() == 'TW' || |
|
|
|
country.toUpperCase() == 'CN')) { |
|
|
|
supportedLanguages.add('zh-${country.toUpperCase()}'); |
|
|
|
} else { |
|
|
|
final asrCode = languageManager.getAsrCodeByShortCode(lang); |
|
|
|
if (asrCode != null) { |
|
|
|
supportedLanguages.add(asrCode); |
|
|
|
} else if (country != null && country.isNotEmpty) { |
|
|
|
// 构造 Azure SDK 需要的格式 (e.g., 'en-US') |
|
|
|
supportedLanguages.add('$lang-$country'); |
|
|
|
} else { |
|
|
|
supportedLanguages.add('en-US'); // 默认英语 |
|
|
|
supportedLanguages.add('en-US'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|