mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-03 00:40:33 -06:00
Nine languages each kept their own copy of the same code: the installed dictionary behind a lock, read on first use and logged, replaced by install_dictionary, forgotten by reload_dictionary, and its file reported by installed_path. The copies had drifted already. Every one documented that a dictionary given with install_dictionary has no file and isn't reported, but only Russian and Czech did that (#3252); the other seven reported the disk file anyway. `DictSlot` (proof/src/slot.rs) is that code once. It is generic over the dictionary type, so Turkish's `TrDict` fits, and keeps the dictionary and its in-memory origin under one lock as #3252 made it. Each language keeps its functions as one-line wrappers over its slot, so no caller changes, and the log lines are the same. installed_path now follows the documented rule in every language. Nothing outside tests installs a dictionary in memory, but tests do, concurrently, so the dictionaries-folder tests in proof and engine could race on the reported path of a language another test installs. They now accept the folder's file or none there, and check that the folder is searched first with hunspell::find, which no install affects. Tests: proof 279, engine 927, layout 501 (lib); slot.rs has a test of its own.