mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
spell: allow overriding dictionaries locations
Works for aspell and myspell (hunspell) when using enchant.
This commit is contained in:
committed by
Sébastien Helleu
parent
d91039ebd0
commit
6b19987e7f
@@ -166,6 +166,16 @@ if(ENABLE_TESTS AND NOT ENABLE_HEADLESS)
|
||||
message(FATAL_ERROR "Headless mode is required for tests.")
|
||||
endif()
|
||||
|
||||
# Set this to override aspell's dictionaries directory
|
||||
if(ASPELL_DICT_DIR)
|
||||
add_definitions(-DASPELL_DICT_DIR="${ASPELL_DICT_DIR}")
|
||||
endif()
|
||||
|
||||
# Set this to override the myspell dictionaries directory when using enchant
|
||||
if(ENCHANT_MYSPELL_DICT_DIR)
|
||||
add_definitions(-DENCHANT_MYSPELL_DICT_DIR="${ENCHANT_MYSPELL_DICT_DIR}")
|
||||
endif()
|
||||
|
||||
# option WEECHAT_HOME
|
||||
set(WEECHAT_HOME "${WEECHAT_HOME}" CACHE
|
||||
STRING "Force a single WeeChat home directory for config, logs, scripts, etc."
|
||||
|
||||
@@ -157,6 +157,9 @@ spell_command_speller_list_dicts (void)
|
||||
NULL);
|
||||
#else
|
||||
config = new_aspell_config ();
|
||||
#ifdef ASPELL_DICT_DIR
|
||||
aspell_config_replace (config, "dict-dir", ASPELL_DICT_DIR);
|
||||
#endif
|
||||
list = get_aspell_dict_info_list (config);
|
||||
elements = aspell_dict_info_list_elements (list);
|
||||
|
||||
|
||||
@@ -107,6 +107,9 @@ spell_completion_dicts_cb (const void *pointer, void *data,
|
||||
completion);
|
||||
#else
|
||||
config = new_aspell_config ();
|
||||
#ifdef ASPELL_DICT_DIR
|
||||
aspell_config_replace (config, "dict-dir", ASPELL_DICT_DIR);
|
||||
#endif
|
||||
list = get_aspell_dict_info_list (config);
|
||||
elements = aspell_dict_info_list_elements (list);
|
||||
|
||||
|
||||
@@ -65,6 +65,9 @@ spell_speller_dict_supported (const char *lang)
|
||||
rc = 0;
|
||||
|
||||
config = new_aspell_config ();
|
||||
#ifdef ASPELL_DICT_DIR
|
||||
aspell_config_replace (config, "dict-dir", ASPELL_DICT_DIR);
|
||||
#endif
|
||||
list = get_aspell_dict_info_list (config);
|
||||
elements = aspell_dict_info_list_elements (list);
|
||||
|
||||
@@ -174,6 +177,9 @@ spell_speller_new (const char *lang)
|
||||
/* create a speller instance for the newly created cell */
|
||||
config = new_aspell_config ();
|
||||
aspell_config_replace (config, "lang", lang);
|
||||
#ifdef ASPELL_DICT_DIR
|
||||
aspell_config_replace (config, "dict-dir", ASPELL_DICT_DIR);
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
/* apply all options */
|
||||
|
||||
@@ -1180,6 +1180,9 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
broker = enchant_broker_init ();
|
||||
if (!broker)
|
||||
return WEECHAT_RC_ERROR;
|
||||
#ifdef ENCHANT_MYSPELL_DICT_DIR
|
||||
enchant_broker_set_param(broker, "enchant.myspell.dictionary.path", ENCHANT_MYSPELL_DICT_DIR);
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
if (!spell_speller_init ())
|
||||
|
||||
Reference in New Issue
Block a user