diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -11,6 +11,7 @@ test_core test_suggest test_settings + test_autodetect NAME_PREFIX "sonnet-" LINK_LIBRARIES KF5::SonnetCore Qt5::Test ) diff --git a/src/core/guesslanguage.cpp b/src/core/guesslanguage.cpp --- a/src/core/guesslanguage.cpp +++ b/src/core/guesslanguage.cpp @@ -710,6 +710,13 @@ guesses.append(guessFromTrigrams(sample, s_scriptLanguages.values(script))); } + //if guesses are empty, we just append the languages of the scripts + if (guesses.isEmpty() && !scripts.isEmpty()) { + for (const QChar::Script script : scripts) { + guesses.append(s_scriptLanguages.values(script)); + } + } + return guesses; }