How can it find dictionaries on Windows without the help of the users?
Magic ;) .
... actually, it guesses a few likely locations:
src/plugins/contrib/SpellChecker/SpellCheckerConfig.cpp (http://svn.berlios.de/wsvn/codeblocks/trunk/src/plugins/contrib/SpellChecker/SpellCheckerConfig.cpp)
const wxString SpellCheckerConfig::GetDictionaryPath()const
{
wxArrayString dictPaths;
dictPaths.Add(m_DictPath);
Manager::Get()->GetMacrosManager()->ReplaceEnvVars(dictPaths[0]);
if (platform::windows)
{
wxString programs = wxT("C:\\Program Files");
wxGetEnv(wxT("ProgramFiles"), &programs);
dictPaths.Add(programs + wxT("\\Mozilla Firefox\\dictionaries"));
dictPaths.Add(programs + wxT("\\Mozilla\\Firefox\\dictionaries"));
dictPaths.Add(programs + wxT("\\Mozilla Thunderbird\\dictionaries"));
dictPaths.Add(programs + wxT("\\Mozilla\\Thunderbird\\dictionaries"));
wxString libreOffice = wxFindFirstFile(programs + wxT("\\*LibreOffice*"), wxDIR);
wxString openOffice = wxFindFirstFile(programs + wxT("\\*OpenOffice*"), wxDIR);
wxArrayString langs = GetArrayFromString(wxT("en;fr;es;de"));
for (size_t i = 0; i < langs.GetCount(); ++i)
{
if (!libreOffice.IsEmpty())
dictPaths.Add(libreOffice + wxT("\\share\\extensions\\dict-") + langs[i]);
if (!openOffice.IsEmpty())
dictPaths.Add(openOffice + wxT("\\share\\extensions\\dict-") + langs[i]);
}
}
else
{
dictPaths.Add(wxT("/usr/share/hunspell"));
dictPaths.Add(wxT("/usr/share/myspell/dicts"));
}
dictPaths.Add(m_pPlugin->GetOnlineCheckerConfigPath());
for (size_t i = 0; i < dictPaths.GetCount(); ++i)
{
if (wxDirExists(dictPaths[i]) && !wxFindFirstFile(dictPaths[i] + wxFILE_SEP_PATH + wxT("*.dic"), wxFILE).IsEmpty())
return dictPaths[i];
}
return dictPaths[0];
}
I think we should remove this "first valid dictionary". Even using the system's local is dangerous. It should default to English most probably, because most code is written in English.
I will write up a patch, but which English:
m_LanguageNamesMap[_T("en")] = _T("English");
m_LanguageNamesMap[_T("en_AU")] = _T("English (Australia)");
m_LanguageNamesMap[_T("en_CA")] = _T("English (Canada)");
m_LanguageNamesMap[_T("en_GB")] = _T("English (United Kingdom)");
m_LanguageNamesMap[_T("en_NZ")] = _T("English (New Zealand)");
m_LanguageNamesMap[_T("en_US")] = _T("English (United States)");
m_LanguageNamesMap[_T("en_ZA")] = _T("English (South Africa)");
If you start C::B with an unconfigured spellchecker-plugin you get an annoying dialog telling you, that you need dictionaries, with a link to the appropriate wiki-site: http://wiki.codeblocks.org/index.php?title=SpellChecker_plugin (http://wiki.codeblocks.org/index.php?title=SpellChecker_plugin) .
I am not certain, but I think this dialog might fail to show up if a dictionary location is correctly guessed; I will be switching this to always show up on first run.