Language detection improvements

This commit is contained in:
M66B 2022-12-19 15:54:20 +01:00
parent 30606a1e95
commit d28b76fa1c
3 changed files with 7 additions and 14 deletions

View File

@ -6845,7 +6845,12 @@ public class FragmentCompose extends FragmentBase {
if (spannedRef.length() > 0 && spannedRef.charAt(0) == '\n')
spannedRef = (Spanned) spannedRef.subSequence(1, spannedRef.length());
Locale ref_lang = TextHelper.detectLanguage(context, spannedRef.toString());
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean language_detection = prefs.getBoolean("language_detection", false);
Locale ref_lang = (language_detection
? TextHelper.detectLanguage(context, spannedRef.toString())
: null);
args.putSerializable("ref_lang", ref_lang);
}

View File

@ -157,17 +157,6 @@
app:layout_constraintTop_toBottomOf="@id/swConversationActionsReplies"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvLanguageDetectionHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_language_detection_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swLanguageDetection" />
<TextView
android:id="@+id/tvDelayHint"
android:layout_width="0dp"
@ -179,7 +168,7 @@
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvLanguageDetectionHint" />
app:layout_constraintTop_toBottomOf="@id/swLanguageDetection" />
<TextView
android:id="@+id/tvDefaultSnooze"

View File

@ -918,7 +918,6 @@
<string name="title_advanced_parse_classes_hint">This will more accurately display messages, but possibly with a delay</string>
<string name="title_advanced_restore_on_launch_hint">Restore last app state when restarted via the launcher icon within %1$d minutes</string>
<string name="title_advanced_language_detection_hint">Language detection support depends on the device manufacturer</string>
<string name="title_advanced_autoexpand_hint">Automatically open message when there is just one message or just one unread message in a conversation</string>
<string name="title_advanced_expandall_hint">The answer button will not be shown when multiple messages are expanded because it is unclear which message the button applies to</string>
<string name="title_advanced_autoseen_hint">Automatically marking messages as read on expanding can be disabled in the advanced account settings of each account</string>