diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-04-15 18:45:17 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-04-15 18:45:17 +0200 |
commit | 53cc5af7c5b0c919f2dd567c1d095d1c66b0f5b4 (patch) | |
tree | 90914960b185e9a57607054187c0c4fd41cd6618 | |
parent | 377024835a7319ad6dc9d95c67d38e2889f6e4c7 (diff) | |
download | weechat-53cc5af7c5b0c919f2dd567c1d095d1c66b0f5b4.zip |
aspell: add section "option" in aspell.conf for speller options (task #11083)
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | doc/de/weechat_user.de.txt | 21 | ||||
-rw-r--r-- | doc/docgen.pl | 1 | ||||
-rw-r--r-- | doc/en/weechat_user.en.txt | 21 | ||||
-rw-r--r-- | doc/fr/weechat_user.fr.txt | 20 | ||||
-rw-r--r-- | doc/it/weechat_user.it.txt | 21 | ||||
-rw-r--r-- | po/cs.po | 11 | ||||
-rw-r--r-- | po/de.po | 11 | ||||
-rw-r--r-- | po/es.po | 11 | ||||
-rw-r--r-- | po/fr.po | 15 | ||||
-rw-r--r-- | po/hu.po | 11 | ||||
-rw-r--r-- | po/it.po | 11 | ||||
-rw-r--r-- | po/pl.po | 11 | ||||
-rw-r--r-- | po/pt_BR.po | 11 | ||||
-rw-r--r-- | po/ru.po | 11 | ||||
-rw-r--r-- | po/weechat.pot | 11 | ||||
-rw-r--r-- | src/plugins/aspell/weechat-aspell-config.c | 124 | ||||
-rw-r--r-- | src/plugins/aspell/weechat-aspell-speller.c | 14 |
18 files changed, 326 insertions, 11 deletions
@@ -46,6 +46,7 @@ Version 0.3.5 (under dev!) * api: add new functions buffer_match_list and window_search_with_buffer * plugins: fix memory leaks when setting buffer callbacks after /upgrade (plugins: irc, relay, xfer, scripts) +* aspell: add section "option" in aspell.conf for speller options (task #11083) * aspell: fix spellers used after switch of window (bug #32811) * irc: fix memory leak when copying or renaming server * irc: do not rejoin channels where /part has been issued before reconnection diff --git a/doc/de/weechat_user.de.txt b/doc/de/weechat_user.de.txt index d0d3a81c5..c1056090b 100644 --- a/doc/de/weechat_user.de.txt +++ b/doc/de/weechat_user.de.txt @@ -871,6 +871,27 @@ Befehle include::autogen/user/aspell_commands.txt[] +// TRANSLATION MISSING +[[aspell_speller_options]] +Speller options +^^^^^^^^^^^^^^^ + +Speller options can be defined by adding options in section "option" of aspell +configuration. + +The option name is an aspell configuration option. List of options can be found +in a shell with following command: + +---------------------------------------- +$ aspell config +---------------------------------------- + +For example, to enable option "ignore-case": + +---------------------------------------- +/set aspell.option.ignore-case "true" +---------------------------------------- + [[charset_plugin]] Charset Erweiterung ~~~~~~~~~~~~~~~~~~~ diff --git a/doc/docgen.pl b/doc/docgen.pl index 8b9a24259..9b9d15658 100644 --- a/doc/docgen.pl +++ b/doc/docgen.pl @@ -74,6 +74,7 @@ my %plugin_list = ("weechat" => "co", "alias" => "", # options to ignore my @ignore_options = ("aspell\\.dict\\..*", + "aspell\\.option\\..*", "charset\\.decode\\..*", "charset\\.encode\\..*", "irc\\.msgbuffer\\..*", diff --git a/doc/en/weechat_user.en.txt b/doc/en/weechat_user.en.txt index e914f01c4..18b3dfe9a 100644 --- a/doc/en/weechat_user.en.txt +++ b/doc/en/weechat_user.en.txt @@ -861,6 +861,27 @@ Commands include::autogen/user/aspell_commands.txt[] +[[aspell_speller_options]] +Speller options +^^^^^^^^^^^^^^^ + +Speller options can be defined by adding options in section "option" of aspell +configuration. + +The option name is an aspell configuration option. List of options can be found +in a shell with following command: + +---------------------------------------- +$ aspell config +---------------------------------------- + +For example, to enable option "ignore-case": + +---------------------------------------- +/set aspell.option.ignore-case "true" +---------------------------------------- + + [[charset_plugin]] Charset plugin ~~~~~~~~~~~~~~ diff --git a/doc/fr/weechat_user.fr.txt b/doc/fr/weechat_user.fr.txt index 95cc307db..378bbc5ff 100644 --- a/doc/fr/weechat_user.fr.txt +++ b/doc/fr/weechat_user.fr.txt @@ -878,6 +878,26 @@ Commandes include::autogen/user/aspell_commands.txt[] +[[aspell_speller_options]] +Options du vérificateur d'orthographe +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Les options du vérificateur d'orthographe peuvent être définies en ajoutant des +options dans la section "option" de la configuration aspell. + +Le nom de l'option est une option de configuration aspell. La liste des options +peut être trouvée par la commande suivante sous le shell : + +---------------------------------------- +$ aspell config +---------------------------------------- + +Par exemple, pour activer l'option "ignore-case": + +---------------------------------------- +/set aspell.option.ignore-case "true" +---------------------------------------- + [[charset_plugin]] Extension Charset ~~~~~~~~~~~~~~~~~ diff --git a/doc/it/weechat_user.it.txt b/doc/it/weechat_user.it.txt index 58fa5edf5..daa286f32 100644 --- a/doc/it/weechat_user.it.txt +++ b/doc/it/weechat_user.it.txt @@ -877,6 +877,27 @@ Comandi include::autogen/user/aspell_commands.txt[] +// TRANSLATION MISSING +[[aspell_speller_options]] +Speller options +^^^^^^^^^^^^^^^ + +Speller options can be defined by adding options in section "option" of aspell +configuration. + +The option name is an aspell configuration option. List of options can be found +in a shell with following command: + +---------------------------------------- +$ aspell config +---------------------------------------- + +For example, to enable option "ignore-case": + +---------------------------------------- +/set aspell.option.ignore-case "true" +---------------------------------------- + [[charset_plugin]] Plugin Charset ~~~~~~~~~~~~~~ @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-04-11 11:50+0200\n" +"POT-Creation-Date: 2011-04-15 12:10+0200\n" "PO-Revision-Date: 2011-04-10 17:32+0200\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3082,6 +3082,15 @@ msgstr "čárkami oddělený seznam slovníků, které použít pro tento buffer msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\"" msgstr "%s%s: chyba vytvoření aspell slovníku \"%s\" => \"%s\"" +msgid "" +"option for aspell (for list of available options and format, run command " +"\"aspell config\" in a shell)" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: error creating aspell option \"%s\" => \"%s\"" +msgstr "%s%s: chyba vytvoření aspell slovníku \"%s\" => \"%s\"" + msgid "color used for misspelled words" msgstr "barva použitá pro slova s chybou" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-04-13 11:29+0200\n" +"POT-Creation-Date: 2011-04-15 12:10+0200\n" "PO-Revision-Date: 2011-04-14 10:00+0200\n" "Last-Translator: Nils G.\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3306,6 +3306,15 @@ msgstr "" msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\"" msgstr "%s%s: Fehler beim Erstellen des aspell-Wörterbuches \"%s\" => \"%s\"" +msgid "" +"option for aspell (for list of available options and format, run command " +"\"aspell config\" in a shell)" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: error creating aspell option \"%s\" => \"%s\"" +msgstr "%s%s: Fehler beim Erstellen des aspell-Wörterbuches \"%s\" => \"%s\"" + msgid "color used for misspelled words" msgstr "" "In dieser Farbe wird ein Wort mit einem Rechtschreibfehler hervorgehoben" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-04-11 11:50+0200\n" +"POT-Creation-Date: 2011-04-15 12:10+0200\n" "PO-Revision-Date: 2011-04-10 17:31+0200\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3159,6 +3159,15 @@ msgstr "lista separada por comas de diccionarios para usar en este buffer" msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\"" msgstr "%s%s: error al crear el diccionario aspell \"%s\" => \"%s\"" +msgid "" +"option for aspell (for list of available options and format, run command " +"\"aspell config\" in a shell)" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: error creating aspell option \"%s\" => \"%s\"" +msgstr "%s%s: error al crear el diccionario aspell \"%s\" => \"%s\"" + msgid "color used for misspelled words" msgstr "color a usar para palabras mal escritas" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-04-11 11:50+0200\n" -"PO-Revision-Date: 2011-04-11 11:50+0200\n" +"POT-Creation-Date: 2011-04-15 12:10+0200\n" +"PO-Revision-Date: 2011-04-15 12:02+0200\n" "Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: French\n" @@ -3248,6 +3248,17 @@ msgstr "" msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\"" msgstr "%s%s: erreur en création du dictionnaire aspell \"%s\" => \"%s\"" +msgid "" +"option for aspell (for list of available options and format, run command " +"\"aspell config\" in a shell)" +msgstr "" +"option pour aspell (pour la liste des options disponibles et le format, " +"lancer la commande \"aspell config\" dans un shell)" + +#, c-format +msgid "%s%s: error creating aspell option \"%s\" => \"%s\"" +msgstr "%s%s: erreur en création de l'option aspell \"%s\" => \"%s\"" + msgid "color used for misspelled words" msgstr "couleur utilisée pour les mots mal orthographiés" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-04-11 11:50+0200\n" +"POT-Creation-Date: 2011-04-15 12:10+0200\n" "PO-Revision-Date: 2011-04-10 11:21+0200\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2864,6 +2864,15 @@ msgstr "" msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\"" msgstr "%s nincs elég memória az információs pult üzenethez\n" +msgid "" +"option for aspell (for list of available options and format, run command " +"\"aspell config\" in a shell)" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: error creating aspell option \"%s\" => \"%s\"" +msgstr "%s nincs elég memória az információs pult üzenethez\n" + msgid "color used for misspelled words" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-04-11 11:50+0200\n" +"POT-Creation-Date: 2011-04-15 12:10+0200\n" "PO-Revision-Date: 2011-04-10 17:33+0200\n" "Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3214,6 +3214,15 @@ msgstr "elenco separato da virgole di dizionari da utilizzare su questo buffer" msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\"" msgstr "%s%s: errore nella creazione del dizionario aspell \"%s\" => \"%s\"" +msgid "" +"option for aspell (for list of available options and format, run command " +"\"aspell config\" in a shell)" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: error creating aspell option \"%s\" => \"%s\"" +msgstr "%s%s: errore nella creazione del dizionario aspell \"%s\" => \"%s\"" + msgid "color used for misspelled words" msgstr "colore utilizzato per le parole non corrette" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-04-11 11:50+0200\n" +"POT-Creation-Date: 2011-04-15 12:10+0200\n" "PO-Revision-Date: 2011-04-10 17:32+0200\n" "Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3148,6 +3148,15 @@ msgstr "oddzielona przecinkami lista słowników do użycia w tym buforze" msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\"" msgstr "%s%s: błąd podczas tworzenia słownika aspell \"%s\" => \"%s\"" +msgid "" +"option for aspell (for list of available options and format, run command " +"\"aspell config\" in a shell)" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: error creating aspell option \"%s\" => \"%s\"" +msgstr "%s%s: błąd podczas tworzenia słownika aspell \"%s\" => \"%s\"" + msgid "color used for misspelled words" msgstr "kolor używany dla błędnie zapisanych słów" diff --git a/po/pt_BR.po b/po/pt_BR.po index 9f86cefd1..1e6697492 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-04-11 11:50+0200\n" +"POT-Creation-Date: 2011-04-15 12:10+0200\n" "PO-Revision-Date: 2011-04-10 11:22+0200\n" "Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3012,6 +3012,15 @@ msgstr "" msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\"" msgstr "" +msgid "" +"option for aspell (for list of available options and format, run command " +"\"aspell config\" in a shell)" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: error creating aspell option \"%s\" => \"%s\"" +msgstr "%sErro: incapaz de configurar a opção \"%s\" para a barra \"%s\"" + msgid "color used for misspelled words" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-04-11 11:50+0200\n" +"POT-Creation-Date: 2011-04-15 12:10+0200\n" "PO-Revision-Date: 2011-04-10 17:33+0200\n" "Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2883,6 +2883,15 @@ msgstr "" msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\"" msgstr "%s недостаточно памяти для сообщения в строке информации\n" +msgid "" +"option for aspell (for list of available options and format, run command " +"\"aspell config\" in a shell)" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: error creating aspell option \"%s\" => \"%s\"" +msgstr "%s недостаточно памяти для сообщения в строке информации\n" + msgid "color used for misspelled words" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index cdec29bd3..d644cd450 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-04-11 11:50+0200\n" +"POT-Creation-Date: 2011-04-15 12:10+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -2484,6 +2484,15 @@ msgstr "" msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\"" msgstr "" +msgid "" +"option for aspell (for list of available options and format, run command " +"\"aspell config\" in a shell)" +msgstr "" + +#, c-format +msgid "%s%s: error creating aspell option \"%s\" => \"%s\"" +msgstr "" + msgid "color used for misspelled words" msgstr "" diff --git a/src/plugins/aspell/weechat-aspell-config.c b/src/plugins/aspell/weechat-aspell-config.c index 3221065df..c91b28b6e 100644 --- a/src/plugins/aspell/weechat-aspell-config.c +++ b/src/plugins/aspell/weechat-aspell-config.c @@ -146,6 +146,7 @@ weechat_aspell_config_dict_delete_option (void *data, (void) section; weechat_config_option_free (option); + weechat_aspell_create_spellers (weechat_current_buffer ()); return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED; @@ -221,6 +222,115 @@ weechat_aspell_config_dict_create_option (void *data, } /* + * weechat_aspell_config_option_change: called when an aspell option is changed + */ + +void +weechat_aspell_config_option_change (void *data, + struct t_config_option *option) +{ + /* make C compiler happy */ + (void) data; + (void) option; + + weechat_aspell_speller_free_all (); + weechat_aspell_create_spellers (weechat_current_buffer ()); +} + +/* + * weechat_aspell_config_option_delete_option: delete option in "option" section + */ + +int +weechat_aspell_config_option_delete_option (void *data, + struct t_config_file *config_file, + struct t_config_section *section, + struct t_config_option *option) +{ + /* make C compiler happy */ + (void) data; + (void) config_file; + (void) section; + + weechat_config_option_free (option); + + weechat_aspell_speller_free_all (); + weechat_aspell_create_spellers (weechat_current_buffer ()); + + return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED; +} + +/* + * weechat_aspell_config_option_create_option: create option in "option" section + */ + +int +weechat_aspell_config_option_create_option (void *data, + struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, + const char *value) +{ + struct t_config_option *ptr_option; + int rc; + + /* make C compiler happy */ + (void) data; + + rc = WEECHAT_CONFIG_OPTION_SET_ERROR; + + if (option_name) + { + ptr_option = weechat_config_search_option (config_file, section, + option_name); + if (ptr_option) + { + if (value && value[0]) + rc = weechat_config_option_set (ptr_option, value, 1); + else + { + weechat_config_option_free (ptr_option); + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + } + } + else + { + if (value && value[0]) + { + ptr_option = weechat_config_new_option ( + config_file, section, + option_name, "string", + _("option for aspell (for list of available options and " + "format, run command \"aspell config\" in a shell)"), + NULL, 0, 0, "", value, 0, + NULL, NULL, + &weechat_aspell_config_option_change, NULL, + NULL, NULL); + rc = (ptr_option) ? + WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR; + } + else + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + } + } + + if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR) + { + weechat_printf (NULL, + _("%s%s: error creating aspell option \"%s\" => \"%s\""), + weechat_prefix ("error"), ASPELL_PLUGIN_NAME, + option_name, value); + } + else + { + weechat_aspell_speller_free_all (); + weechat_aspell_create_spellers (weechat_current_buffer ()); + } + + return rc; +} + +/* * weechat_aspell_config_get_dict: get a dictionary list for a buffer */ @@ -342,6 +452,20 @@ weechat_aspell_config_init () weechat_aspell_config_section_dict = ptr_section; + /* option */ + ptr_section = weechat_config_new_section (weechat_aspell_config_file, "option", + 1, 1, + NULL, NULL, + NULL, NULL, + NULL, NULL, + &weechat_aspell_config_option_create_option, NULL, + &weechat_aspell_config_option_delete_option, NULL); + if (!ptr_section) + { + weechat_config_free (weechat_aspell_config_file); + return 0; + } + return 1; } diff --git a/src/plugins/aspell/weechat-aspell-speller.c b/src/plugins/aspell/weechat-aspell-speller.c index 2e5c940aa..51822c4fa 100644 --- a/src/plugins/aspell/weechat-aspell-speller.c +++ b/src/plugins/aspell/weechat-aspell-speller.c @@ -131,6 +131,7 @@ weechat_aspell_speller_new (const char *lang) struct t_aspell_speller *new_speller; AspellConfig *config; AspellCanHaveError *ret; + struct t_infolist *infolist; if (!lang) return NULL; @@ -145,6 +146,19 @@ weechat_aspell_speller_new (const char *lang) /* create a speller instance for the newly created cell */ config = new_aspell_config(); aspell_config_replace (config, "lang", lang); + + /* apply all options on speller */ + infolist = weechat_infolist_get ("option", NULL, "aspell.option.*"); + if (infolist) + { + while (weechat_infolist_next (infolist)) + { + aspell_config_replace (config, + weechat_infolist_string (infolist, "option_name"), + weechat_infolist_string (infolist, "value")); + } + weechat_infolist_free (infolist); + } ret = new_aspell_speller (config); |