- hunspell_path = external_path(addName(hunspell_path, lang));
- if (!haveLanguageFiles(hunspell_path)) {
- // try with '_' replaced by '-'
- hunspell_path = subst(hunspell_path, '_', '-');
- if (!haveLanguageFiles(hunspell_path)) {
- // FIXME: We should indicate somehow that this language is not
- // supported, probably by popping a warning. But we'll need to
- // remember which warnings we've issued.
- return 0;
+ FileName const affix(path + ".aff");
+ FileName const dict(path + ".dic");
+ Hunspell * h = new Hunspell(affix.absFileName().c_str(), dict.absFileName().c_str());
+ LYXERR(Debug::FILES, "Hunspell speller for langage " << lang << " at " << dict << " found");
+ spellers_[lang->lang()] = h;
+ return h;
+}
+
+
+Hunspell * HunspellChecker::Private::addSpeller(Language const * 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());