- Spellers::iterator it = spellers_.find(lang);
- if (it != spellers_.end())
- return it->second;
-
- return addSpeller(lang);
+ Hunspell * h = 0;
+ for (int p = 0; p < maxLookupSelector() && 0 == h; ++p) {
+ string lpath = dictPath(p);
+ h = addSpeller(lang, lpath);
+ }
+ if (h) {
+ string const encoding = h->get_dic_encoding();
+ PersonalWordList * pd = new PersonalWordList(lang->lang());
+ pd->load();
+ personal_[lang->lang()] = pd;
+ docstring_list::const_iterator it = pd->begin();
+ docstring_list::const_iterator et = pd->end();
+ for (; it != et; ++it) {
+ string const word_to_add = to_iconv_encoding(*it, encoding);
+ h->add(word_to_add.c_str());
+ }
+ }
+ return h;
+}
+
+
+int HunspellChecker::Private::numDictionaries() const
+{
+ int result = 0;
+ Spellers::const_iterator it = spellers_.begin();
+ Spellers::const_iterator et = spellers_.end();
+
+ for (; it != et; ++it)
+ result += it->second != 0;
+ return result;