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);
}