View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017990 | Scribus | Language Tools | public | 2026-10-01 03:11 | 2026-10-17 20:07 |
| Reporter | jaca101 | Assigned To | cbradney | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Platform | MacBook Pro M1 | OS | MacOS Tahoe 26.6.2 | OS Version | 26.6.2 (25G83) |
| Product Version | 1.7.4.svn | ||||
| Fixed in Version | 1.7.4.svn | ||||
| Summary | 0017990: "Dictionary files not found for language" is printed on every spell-check pass when a language has no dictionary | ||||
| Description | When the document language has no Hunspell dictionary installed (e.g. "es"), the console is flooded with Dictionary files not found for language: "es" while typing: in one editing session it was printed 33 times. Besides the noise, every spell-check pass searches the disk again. Cause: HunspellManager::getDictEntry() (scribus/spellcheckfunctions.cpp) caches the dictionaries it finds, but not the ones it cannot find. For a language without a dictionary, each pass re-runs findDictionaryFile() for the language and its alternative abbreviation (several QFile::exists() calls per spell directory) and prints the warning again. Fix (patch attached, against trunk r27875): - remember a missing dictionary for 30 seconds before searching the disk again; - print the warning only once per language per session. Misses expire, so a dictionary installed during the session (e.g. from the Resource Manager) is still picked up within 30 seconds. Found dictionaries are cached exactly as before. | ||||
| Steps To Reproduce | 1. Make sure no Hunspell dictionary is installed for a language, e.g. Spanish ("es"). 2. Start Scribus from a terminal so that its console output is visible. 3. Set the document/text language to that language and type a few lines in a text frame. -> "Dictionary files not found for language: "es"" is printed again and again (33 times in a short session). | ||||
| Additional Information | Environment: macOS 26.6 (Tahoe), Apple Silicon, Qt 6.11.2 (Homebrew), Scribus 1.7.4.svn trunk r27875. The code is platform independent. Verified with the patch applied: in an equivalent editing session the warning is printed once instead of 33 times. The patch was prepared with AI assistance (Claude Code) and reviewed and tested by me; it carries a Co-Authored-By trailer. | ||||
| Tags | spelling | ||||
| Attached Files | 0002-Spell-check-warn-once-and-cache-misses-for-missing-H.patch (3,159 bytes)
From 608a6f8a6e8803677b030d825dc27bcab93f3aab Mon Sep 17 00:00:00 2001
From: Satoshi Nakamoto <satoshi.nakamoto.xdos@proton.me>
Date: Thu, 1 Oct 2026 03:19:58 +0200
Subject: [PATCH 2/9] Spell check: warn once and cache misses for missing
Hunspell dictionaries
HunspellManager::getDictEntry() cached dictionaries it found but not the
ones it could not find. For a language without an installed dictionary,
every spell-check pass re-scanned all spell directories on disk (several
QFile::exists() calls for the language and its alternative abbreviation)
and printed "Dictionary files not found for language" again, flooding the
console while typing.
Remember misses for 30 seconds before searching again, and warn only once
per language per session. Misses expire so a dictionary installed during
the session (e.g. from the Resource Manager) is still picked up.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---
scribus/spellcheckfunctions.cpp | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/scribus/spellcheckfunctions.cpp b/scribus/spellcheckfunctions.cpp
index 26cacbfd6..ee209cd54 100644
--- a/scribus/spellcheckfunctions.cpp
+++ b/scribus/spellcheckfunctions.cpp
@@ -13,10 +13,13 @@
#include "spellcheckfunctions.h"
#include "textframespellchecker.h"
#include <hunspell/hunspell.hxx>
+#include <QElapsedTimer>
#include <QFile>
+#include <QHash>
#include <QMap>
#include <QMutex>
#include <QRegularExpression>
+#include <QSet>
#include <QStringDecoder>
#include <QStringEncoder>
@@ -47,6 +50,12 @@ class HunspellManager
if (m_dictionaries.contains(language))
return m_dictionaries[language];
+ // Don't hit the disk again for a language whose dictionary was just found missing.
+ // Misses expire so that a dictionary installed during the session is still picked up.
+ auto missIt = m_missingSince.constFind(language);
+ if (missIt != m_missingSince.constEnd() && !missIt->hasExpired(missingDictRetryMs))
+ return nullptr;
+
QString affPath = findDictionaryFile(language, ".aff");
QString dicPath = findDictionaryFile(language, ".dic");
QString altLanguage;
@@ -66,10 +75,16 @@ class HunspellManager
dicPath = findDictionaryFile(altLanguage, ".dic");
if (affPath.isEmpty() || dicPath.isEmpty())
{
- qWarning() << "Dictionary files not found for language:" << language;
+ m_missingSince[language].start();
+ if (!m_warnedMissing.contains(language))
+ {
+ m_warnedMissing.insert(language);
+ qWarning() << "Dictionary files not found for language:" << language;
+ }
return nullptr;
}
}
+ m_missingSince.remove(language);
Hunspell* hunspell = new Hunspell(affPath.toUtf8().constData(), dicPath.toUtf8().constData());
const std::string encoding = hunspell->get_dict_encoding();
@@ -135,7 +150,11 @@ class HunspellManager
return QString();
}
+ static constexpr qint64 missingDictRetryMs = 30000;
+
QMap<QString, DictEntry*> m_dictionaries;
+ QHash<QString, QElapsedTimer> m_missingSince;
+ QSet<QString> m_warnedMissing;
QMutex m_mutex;
};
--
2.54.0 (Apple Git-157)
| ||||
| Patch | No | ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-10-01 03:11 | jaca101 | New Issue | |
| 2026-10-01 03:11 | jaca101 | Tag Attached: spelling | |
| 2026-10-01 03:11 | jaca101 | File Added: 0002-Spell-check-warn-once-and-cache-misses-for-missing-H.patch | |
| 2026-10-05 19:25 | cbradney | Assigned To | => cbradney |
| 2026-10-05 19:25 | cbradney | Status | new => resolved |
| 2026-10-05 19:25 | cbradney | Resolution | open => fixed |
| 2026-10-05 19:25 | cbradney | Fixed in Version | => 1.7.4.svn |
| 2026-10-17 20:07 | cbradney | Status | resolved => closed |