Merge pull request #3162 from pangeachat/3161-only-do-phonetic-transcription-for-l1-l2-pairs-with-different-scripts
3161-only-do-phonetic-transcription-for-l1-l2-pairs-with-different-scripts
This commit is contained in:
commit
e108d69c2a
4 changed files with 30 additions and 14 deletions
|
|
@ -67,7 +67,7 @@ class VocabDetailsView extends StatelessWidget {
|
|||
);
|
||||
},
|
||||
),
|
||||
if (MatrixState.pangeaController.languageController.userL2 != null)
|
||||
if (MatrixState.pangeaController.languageController.showTrancription)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4.0),
|
||||
child: PhoneticTranscriptionWidget(
|
||||
|
|
|
|||
|
|
@ -112,4 +112,14 @@ class LanguageController {
|
|||
// final model = activeL2 != null ? PangeaLanguage.byLangCode(activeL2) : null;
|
||||
// return model;
|
||||
}
|
||||
|
||||
bool get showTrancription =>
|
||||
(_pangeaController.languageController.userL1 != null &&
|
||||
_pangeaController.languageController.userL2 != null &&
|
||||
_pangeaController.languageController.userL1?.script !=
|
||||
_pangeaController.languageController.userL2?.script) ||
|
||||
(_pangeaController.languageController.userL1?.script !=
|
||||
LanguageKeys.unknownLanguage ||
|
||||
_pangeaController.languageController.userL2?.script ==
|
||||
LanguageKeys.unknownLanguage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ import 'package:fluffychat/pangea/learning_settings/enums/l2_support_enum.dart';
|
|||
class LanguageModel {
|
||||
final String langCode;
|
||||
final String displayName;
|
||||
final String script;
|
||||
final L2SupportEnum l2Support;
|
||||
|
||||
LanguageModel({
|
||||
required this.langCode,
|
||||
required this.displayName,
|
||||
this.script = LanguageKeys.unknownLanguage,
|
||||
this.l2Support = L2SupportEnum.na,
|
||||
});
|
||||
|
||||
|
|
@ -28,12 +30,14 @@ class LanguageModel {
|
|||
l2Support: json['l2_support'] != null
|
||||
? L2SupportEnum.na.fromStorageString(json['l2_support'])
|
||||
: L2SupportEnum.na,
|
||||
script: json['script'] ?? LanguageKeys.unknownLanguage,
|
||||
);
|
||||
}
|
||||
|
||||
toJson() => {
|
||||
'language_code': langCode,
|
||||
'language_name': displayName,
|
||||
'script': script,
|
||||
'l2_support': l2Support.storageString,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -187,20 +187,22 @@ class OverlayMessage extends StatelessWidget {
|
|||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
PhoneticTranscriptionWidget(
|
||||
text: overlayController
|
||||
.transcription!.transcript.text,
|
||||
textLanguage: PLanguageStore.byLangCode(
|
||||
pangeaMessageEvent!
|
||||
.messageDisplayLangCode,
|
||||
) ??
|
||||
LanguageModel.unknown,
|
||||
style: AppConfig.messageTextStyle(
|
||||
event,
|
||||
textColor,
|
||||
if (MatrixState.pangeaController
|
||||
.languageController.showTrancription)
|
||||
PhoneticTranscriptionWidget(
|
||||
text: overlayController
|
||||
.transcription!.transcript.text,
|
||||
textLanguage: PLanguageStore.byLangCode(
|
||||
pangeaMessageEvent!
|
||||
.messageDisplayLangCode,
|
||||
) ??
|
||||
LanguageModel.unknown,
|
||||
style: AppConfig.messageTextStyle(
|
||||
event,
|
||||
textColor,
|
||||
),
|
||||
iconColor: textColor,
|
||||
),
|
||||
iconColor: textColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue