Make the dictionary startup line report rows, not capabilities

It logged dictionary.Langs(), which is a compile-time constant of the languages
DreamDict *supports*. The database deployed until today supported Spanish and
contained none of it, so the line printed a confident "[en fr pt-PT es zh]"
over a file where every Spanish lookup came back empty — the exact failure the
line exists to catch, reported as success.

Contents() counts rows per language instead. For a file somebody has to copy
onto the box by hand, "what is in it" is the only question worth asking, and
the answer is now en=136615 es=102971 fr=56096 pt-PT=136300 zh=120883.

Claude-Session: https://claude.ai/code/session_016y6gyuHkQXPiEuW8RGQyua
This commit is contained in:
prosolis
2026-07-27 10:51:09 -07:00
parent 86175f1559
commit 74bf600593
4 changed files with 65 additions and 6 deletions
+10
View File
@@ -53,6 +53,16 @@ func NewSet(dream *DreamDict) *Set {
// usable.
func (s *Set) HasDreamDict() bool { return s.dream != nil }
// Contents describes what the open dict.db actually holds, for the startup log.
// With no dictionary it says so rather than returning an empty string, because
// a blank in a log line is indistinguishable from a bug in the log line.
func (s *Set) Contents() string {
if s.dream == nil {
return "no dict.db — embedded datasets only"
}
return s.dream.Contents()
}
// For returns the provider that should answer lookups for a writer whose pair
// language is lang.
//