enchant::Dict * EnchantChecker::Private::addSpeller(string const & lang)
{
enchant::Broker * instance = enchant::Broker::instance();
+
+ if (!instance->dict_exists(lang))
+ // FIXME error handling?
+ return 0;
+
enchant::Dict * dict = instance->request_dict(lang);
if (dict) {
SpellChecker::Result EnchantChecker::check(WordLangTuple const & word)
{
- enchant::Dict * m = d->speller(word.lang_code());
+ enchant::Dict * m = d->speller(word.lang()->code());
if (!m)
return OK;
void EnchantChecker::insert(WordLangTuple const & word)
{
- Spellers::iterator it = d->spellers_.find(word.lang_code());
+ Spellers::iterator it = d->spellers_.find(word.lang()->code());
if (it != d->spellers_.end())
it->second.speller->add(to_utf8(word.word()));
}
void EnchantChecker::accept(WordLangTuple const & word)
{
- Spellers::iterator it = d->spellers_.find(word.lang_code());
+ Spellers::iterator it = d->spellers_.find(word.lang()->code());
if (it != d->spellers_.end())
it->second.speller->add_to_session(to_utf8(word.word()));
}
docstring_list & suggestions)
{
suggestions.clear();
- enchant::Dict * m = d->speller(wl.lang_code());
+ enchant::Dict * m = d->speller(wl.lang()->code());
if (!m)
return;
}
+bool EnchantChecker::hasDictionary(Language const * lang) const
+{
+ if (!lang)
+ return false;
+ enchant::Broker * instance = enchant::Broker::instance();
+ return (instance->dict_exists(lang->code()));
+}
+
+
docstring const EnchantChecker::error()
{
return docstring();