translationLanguageSet function
- TranslationLanguageSetOptions options
Handles the translation:languageSet socket event. Called when the user's spoken language is confirmed.
Implementation
Future<void> translationLanguageSet(
TranslationLanguageSetOptions options) async {
try {
final data = options.data;
if (data.success) {
options.updateMySpokenLanguage?.call(data.language);
options.updateMySpokenLanguageEnabled?.call(data.enabled);
} else if (data.error != null) {
options.showAlert?.call(
message: data.error!,
type: 'danger',
duration: 3000,
);
}
} catch (e) {
// Handle error silently
}
}