+ bool have_dict = false;
+ string const sysdir = lyx::support::package().system_support().absFileName() ;
+ string const userdir = lyx::support::package().user_support().absFileName() ;
+
+ LYXERR(Debug::FILES, "aspell user dir: " << userdir);
+ have_dict = checkAspellData(config, userdir, dataDirectory(), dictDirectory(), lang, variety);
+ if (!have_dict) {
+ LYXERR(Debug::FILES, "aspell sysdir dir: " << sysdir);
+ have_dict = checkAspellData(config, sysdir, dataDirectory(), dictDirectory(), lang, variety);
+ }
+ if (!have_dict) {
+ // check for package data of OS installation
+ have_dict = checkAspellData(config, osPackageBase(), osPackageDataDirectory(), osPackageDictDirectory(), lang, variety);
+ }
+ return config ;
+}
+
+
+void AspellChecker::Private::initSessionDictionary(
+ Speller const & speller,
+ PersonalWordList * pd)
+{
+ AspellSpeller * aspell = to_aspell_speller(speller.e_speller);
+ aspell_speller_clear_session(aspell);
+ docstring_list::const_iterator it = pd->begin();
+ docstring_list::const_iterator et = pd->end();
+ for (; it != et; ++it) {
+ string const word_to_add = to_utf8(*it);
+ aspell_speller_add_to_session(aspell, word_to_add.c_str(), -1);
+ }
+ it = speller.ignored_words_.begin();
+ et = speller.ignored_words_.end();
+ for (; it != et; ++it) {
+ string const word_to_add = to_utf8(*it);
+ aspell_speller_add_to_session(aspell, word_to_add.c_str(), -1);
+ }
+}
+
+
+AspellSpeller * AspellChecker::Private::addSpeller(Language const * lang)
+{
+ Speller m;
+ string const code = lang->code();
+ string const variety = lang->variety();
+ m.config = getConfig(code, variety);
+ // Aspell supports both languages and varieties (such as German
+ // old vs. new spelling). The respective naming convention is
+ // lang_REGION-variety (e.g. de_DE-alt).
+ aspell_config_replace(m.config, "lang", code.c_str());
+ if (!variety.empty())
+ aspell_config_replace(m.config, "variety", variety.c_str());