diff --git a/ChangeLog b/ChangeLog index e8b026b9c..41dffbcf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ Version 0.4.1 (under dev!) weechat.history.max_buffer_lines_minutes is set (bug #38197) * core: use default hash/comparison callback for keys of type integer/pointer/time in hashtable +* aspell: add completion "aspell_dicts" (list of aspell installed dictionaries) +* aspell: add info "aspell_dict" (dictionaries used on a buffer) +* aspell: optimization on spellers to improve speed (save state by buffer) * guile: fix compilation with guile 2.0 * irc: add color in output of /names when result is on server buffer (channel not joined) (bug #38070) diff --git a/doc/de/autogen/plugin_api/completions.txt b/doc/de/autogen/plugin_api/completions.txt index 49c7aa9db..86a4e4545 100644 --- a/doc/de/autogen/plugin_api/completions.txt +++ b/doc/de/autogen/plugin_api/completions.txt @@ -6,7 +6,9 @@ | alias | alias_value | Wert von Alias -| aspell | aspell_langs | Liste der zu nutzenden Übersetzungen für Aspell +| aspell | aspell_dicts | list of aspell installed dictionaries + +| aspell | aspell_langs | list of all languages supported by aspell | guile | guile_script | Liste der Skripten diff --git a/doc/de/autogen/plugin_api/infos.txt b/doc/de/autogen/plugin_api/infos.txt index c591a61e1..7aca25544 100644 --- a/doc/de/autogen/plugin_api/infos.txt +++ b/doc/de/autogen/plugin_api/infos.txt @@ -2,6 +2,8 @@ |======================================== | Erweiterung | Name | Beschreibung | Argumente +| aspell | aspell_dict | comma-separated list of dictionaries used in buffer | buffer pointer ("0x12345678") or buffer full name ("irc.freenode.#weechat") + | fifo | fifo_filename | Name der FIFO-Pipe | - | irc | irc_buffer | holt Buffer Pointer für einen IRC Server/Channel/Nick | server,channel,nick (Channel und Nicks sind optional) diff --git a/doc/de/autogen/user/aspell_commands.txt b/doc/de/autogen/user/aspell_commands.txt index ab51a4c98..fc68c9963 100644 --- a/doc/de/autogen/user/aspell_commands.txt +++ b/doc/de/autogen/user/aspell_commands.txt @@ -3,24 +3,24 @@ ........................................ /aspell enable|disable|toggle listdict - setdict + setdict [,...] deldict - addword [] + addword [] - enable: Aspell wird aktiviert - disable: Aspell wird deaktiviert - toggle: Aspell Funktionalität umschalten -listdict: die, auf dem System, installierten Wörterbücher werden aufgelistet - setdict: Wörterbuch für den aktuellen Buffer einstellen - deldict: Wörterbuch für den aktuellen Buffer entfernen - addword: fügt ein Wort in das persönliche Wörterbuch von Aspell hinzu + enable: enable aspell + disable: disable aspell + toggle: toggle aspell +listdict: show installed dictionaries + setdict: set dictionary for current buffer (multiple dictionaries can be separated by a comma) + deldict: delete dictionary used on current buffer + addword: add a word in personal aspell dictionary -Eingaben die mit '/' beginnen werden nicht überprüft, davon ausgenommen sind einige Befehle (siehe /set aspell.check.commands). +Input line beginning with a '/' is not checked, except for some commands (see /set aspell.check.commands). -Um Aspell auf alle Buffer anzuwenden sollte die Option "default_dict" genutzt und Aspell aktiviert werden: - /set aspell.check.default_dict "de_DE-neu" +To enable aspell on all buffers, use option "default_dict", then enable aspell, for example: + /set aspell.check.default_dict "en" /aspell enable -Die Standardtastaturbelegung zum Umschalten der Aspell Funktionalität lautet alt-s. +Default key to toggle aspell is alt-s. ........................................ diff --git a/doc/en/autogen/plugin_api/completions.txt b/doc/en/autogen/plugin_api/completions.txt index a7e073a21..1fc9dcb1a 100644 --- a/doc/en/autogen/plugin_api/completions.txt +++ b/doc/en/autogen/plugin_api/completions.txt @@ -6,7 +6,9 @@ | alias | alias_value | value of alias -| aspell | aspell_langs | list of supported langs for aspell +| aspell | aspell_dicts | list of aspell installed dictionaries + +| aspell | aspell_langs | list of all languages supported by aspell | guile | guile_script | list of scripts diff --git a/doc/en/autogen/plugin_api/infos.txt b/doc/en/autogen/plugin_api/infos.txt index 9c28269fa..2981b9f66 100644 --- a/doc/en/autogen/plugin_api/infos.txt +++ b/doc/en/autogen/plugin_api/infos.txt @@ -2,6 +2,8 @@ |======================================== | Plugin | Name | Description | Arguments +| aspell | aspell_dict | comma-separated list of dictionaries used in buffer | buffer pointer ("0x12345678") or buffer full name ("irc.freenode.#weechat") + | fifo | fifo_filename | name of FIFO pipe | - | irc | irc_buffer | get buffer pointer for an IRC server/channel/nick | server,channel,nick (channel and nicks are optional) diff --git a/doc/en/autogen/user/aspell_commands.txt b/doc/en/autogen/user/aspell_commands.txt index ea03acd19..2f8e00181 100644 --- a/doc/en/autogen/user/aspell_commands.txt +++ b/doc/en/autogen/user/aspell_commands.txt @@ -3,15 +3,15 @@ ........................................ /aspell enable|disable|toggle listdict - setdict + setdict [,...] deldict - addword [] + addword [] enable: enable aspell disable: disable aspell toggle: toggle aspell listdict: show installed dictionaries - setdict: set dictionary for current buffer + setdict: set dictionary for current buffer (multiple dictionaries can be separated by a comma) deldict: delete dictionary used on current buffer addword: add a word in personal aspell dictionary diff --git a/doc/en/weechat_dev.en.txt b/doc/en/weechat_dev.en.txt index 0bfaad037..cec4efd5a 100644 --- a/doc/en/weechat_dev.en.txt +++ b/doc/en/weechat_dev.en.txt @@ -174,11 +174,14 @@ Plugins | alias/ | Alias plugin | alias.c | Main alias functions | alias-config.c | Alias config options -| alias-info.c | Info and infolists from alias plugin +| alias-info.c | Alias info/infolists/hdata | aspell/ | Aspell plugin | weechat-aspell.c | Main aspell functions | weechat-aspell-bar-item.c | Aspell bar items +| weechat-aspell-command.c | Aspell commands +| weechat-aspell-completion.c | Aspell completions | weechat-aspell-config.c | Aspell config options +| weechat-aspell-info.c | Aspell info/infolists/hdata | weechat-aspell-speller.c | Spellers management | charset/ | Charset plugin | charset.c | Charset functions @@ -186,7 +189,7 @@ Plugins | demo.c | Demo functions | fifo/ | Fifo plugin | fifo.c | Main fifo functions -| fifo-info.c | Info and infolists from fifo plugin +| fifo-info.c | Fifo info/infolists/hdata | guile/ | Guile (scheme) plugin | weechat-guile.c | Main guile functions (load/unload scripts, execute guile code) | weechat-guile-api.c | Guile scripting API functions @@ -203,7 +206,7 @@ Plugins | irc-debug.c | IRC debug functions | irc-display.c | IRC display functions | irc-ignore.c | IRC Ignore -| irc-info.c | Info and infolists from IRC plugin +| irc-info.c | IRC info/infolists/hdata | irc-input.c | Input of commands/text | irc-message.c | Functions to manipulate IRC messages | irc-mode.c | Functions about channel/nick modes @@ -220,7 +223,7 @@ Plugins | logger.c | Main logger functions | logger-buffer.c | Logger buffer list management | logger-config.c | Logger config options -| logger-info.c | Info and infolists from logger plugin +| logger-info.c | Logger info/infolists/hdata | logger-tail.c | Return last lines of a file | lua/ | Lua plugin | weechat-lua.c | Main lua functions (load/unload scripts, execute lua code) @@ -238,7 +241,7 @@ Plugins | relay-command.c | Relay commands | relay-completion.c | Relay completions | relay-config.c | Relay config options -| relay-info.c | Info and infolists from relay plugin +| relay-info.c | Relay info/infolists/hdata | relay-network.c | Network functions for relay | relay-raw.c | Relay raw buffer | relay-server.c | Relay server @@ -255,7 +258,7 @@ Plugins | rmodifier-completion.c | Rmodifier completions | rmodifier-config.c | Rmodifier config options | rmodifier-debug.c | Rmodifier debug functions -| rmodifier-info.c | Info and infolists from rmodifier plugin +| rmodifier-info.c | Rmodifier info/infolists/hdata | ruby/ | Ruby plugin | weechat-ruby.c | Main ruby functions (load/unload scripts, execute ruby code) | weechat-ruby-api.c | Ruby scripting API functions @@ -266,7 +269,7 @@ Plugins | script-command.c | Commands for scripts manager | script-completion.c | Completions for scripts manager | script-config.c | Config options for scripts manager -| script-info.c | Info and infolists from scripts manager plugin +| script-info.c | Script manager info/infolists/hdata | script-repo.c | Download and read repository file | tcl/ | Tcl plugin | weechat-tcl.c | Main tcl functions (load/unload scripts, execute tcl code) @@ -280,7 +283,7 @@ Plugins | xfer-config.c | Xfer config options | xfer-dcc.c | Xfer DCC file | xfer-file.c | File functions for xfer -| xfer-info.c | Info and infolists from xfer plugin +| xfer-info.c | Xfer info/infolists/hdata | xfer-network.c | Network functions for xfer | xfer-upgrade.c | Save/restore xfer data when upgrading WeeChat |======================================== diff --git a/doc/fr/autogen/plugin_api/completions.txt b/doc/fr/autogen/plugin_api/completions.txt index f00244a02..c0273ed35 100644 --- a/doc/fr/autogen/plugin_api/completions.txt +++ b/doc/fr/autogen/plugin_api/completions.txt @@ -6,7 +6,9 @@ | alias | alias_value | valeur de l'alias -| aspell | aspell_langs | liste des langues supportées pour aspell +| aspell | aspell_dicts | liste des dictionnaires aspell installés + +| aspell | aspell_langs | liste de toutes les langues supportées par aspell | guile | guile_script | liste des scripts diff --git a/doc/fr/autogen/plugin_api/infos.txt b/doc/fr/autogen/plugin_api/infos.txt index 52439b03c..8c72cab34 100644 --- a/doc/fr/autogen/plugin_api/infos.txt +++ b/doc/fr/autogen/plugin_api/infos.txt @@ -2,6 +2,8 @@ |======================================== | Extension | Nom | Description | Paramètres +| aspell | aspell_dict | liste de dictionnaires (séparés par des virgules) utilisés sur le tampon | pointeur vers un tampon ("0x12345678") ou nom complet de tampon ("irc.freenode.#weechat") + | fifo | fifo_filename | nom du tube FIFO | - | irc | irc_buffer | retourne le pointeur vers le tampon pour un serveur/canal/pseudo IRC | serveur,canal,pseudo (canal et pseudo sont optionnels) diff --git a/doc/fr/autogen/user/aspell_commands.txt b/doc/fr/autogen/user/aspell_commands.txt index 7433c6477..7e96140d0 100644 --- a/doc/fr/autogen/user/aspell_commands.txt +++ b/doc/fr/autogen/user/aspell_commands.txt @@ -3,15 +3,15 @@ ........................................ /aspell enable|disable|toggle listdict - setdict + setdict [,...] deldict - addword [] + addword [] enable: activer aspell disable: désactiver aspell toggle: activer/désactiver aspell listdict: afficher les dictionnaires installés - setdict: définir le dictionnaire pour le tampon courant + setdict: définir le dictionnaire pour le tampon courant (plusieurs dictionnaires peuvent être séparés par une virgule) deldict: supprimer le dictionnaire utilisé sur le tampon courant addword: ajouter un mot dans le dictionnaire personnel aspell diff --git a/doc/it/autogen/plugin_api/completions.txt b/doc/it/autogen/plugin_api/completions.txt index a823ae39b..3561a6c23 100644 --- a/doc/it/autogen/plugin_api/completions.txt +++ b/doc/it/autogen/plugin_api/completions.txt @@ -6,7 +6,9 @@ | alias | alias_value | valore dell'alias -| aspell | aspell_langs | elenco di lingue supportate per aspell +| aspell | aspell_dicts | list of aspell installed dictionaries + +| aspell | aspell_langs | list of all languages supported by aspell | guile | guile_script | elenco degli script diff --git a/doc/it/autogen/plugin_api/infos.txt b/doc/it/autogen/plugin_api/infos.txt index 7bb9670a6..fc68bcb69 100644 --- a/doc/it/autogen/plugin_api/infos.txt +++ b/doc/it/autogen/plugin_api/infos.txt @@ -2,6 +2,8 @@ |======================================== | Plugin | Nome | Descrizione | Argomenti +| aspell | aspell_dict | comma-separated list of dictionaries used in buffer | buffer pointer ("0x12345678") or buffer full name ("irc.freenode.#weechat") + | fifo | fifo_filename | nome della pipe FIFO | - | irc | irc_buffer | ottiene puntatore al buffer per un server/canale/nick IRC | server,canale,nick (canale e nick sono opzionali) diff --git a/doc/it/autogen/user/aspell_commands.txt b/doc/it/autogen/user/aspell_commands.txt index 6a5ee7134..9752134f5 100644 --- a/doc/it/autogen/user/aspell_commands.txt +++ b/doc/it/autogen/user/aspell_commands.txt @@ -3,24 +3,24 @@ ........................................ /aspell enable|disable|toggle listdict - setdict + setdict [,...] deldict - addword [] + addword [] - enable: abilita aspell - disable: disabilita aspell - toggle: abilita/disabilita aspell -listdict: mostra i dizionari installati - setdict: imposta dizionario per il buffer corrente - deldict: elimina dizionario usato per il buffer corrente - addword: aggiunge una parola nel dizionario personale aspell + enable: enable aspell + disable: disable aspell + toggle: toggle aspell +listdict: show installed dictionaries + setdict: set dictionary for current buffer (multiple dictionaries can be separated by a comma) + deldict: delete dictionary used on current buffer + addword: add a word in personal aspell dictionary -La riga di input che comincia con '/' non viene controllata, tranne che per alcuni comandi (consultare /set aspell.check.commands). +Input line beginning with a '/' is not checked, except for some commands (see /set aspell.check.commands). -Per abilitare aspell su tutti i buffer, usare l'opzione "default_dict", poi abilita aspell, ad esempio: - /set aspell.check.default_dict "it" +To enable aspell on all buffers, use option "default_dict", then enable aspell, for example: + /set aspell.check.default_dict "en" /aspell enable -Il tasto predefinito per (dis)abilitare aspell è alt-s. +Default key to toggle aspell is alt-s. ........................................ diff --git a/doc/ja/autogen/plugin_api/completions.txt b/doc/ja/autogen/plugin_api/completions.txt index 276e50477..0884cfef6 100644 --- a/doc/ja/autogen/plugin_api/completions.txt +++ b/doc/ja/autogen/plugin_api/completions.txt @@ -6,7 +6,9 @@ | alias | alias_value | 別名の値 -| aspell | aspell_langs | aspell でサポートされる言語のリスト +| aspell | aspell_dicts | list of aspell installed dictionaries + +| aspell | aspell_langs | list of all languages supported by aspell | guile | guile_script | スクリプトのリスト diff --git a/doc/ja/autogen/plugin_api/infos.txt b/doc/ja/autogen/plugin_api/infos.txt index a57786334..007332232 100644 --- a/doc/ja/autogen/plugin_api/infos.txt +++ b/doc/ja/autogen/plugin_api/infos.txt @@ -2,6 +2,8 @@ |======================================== | プラグイン | 名前 | 説明 | 引数 +| aspell | aspell_dict | comma-separated list of dictionaries used in buffer | buffer pointer ("0x12345678") or buffer full name ("irc.freenode.#weechat") + | fifo | fifo_filename | FIFO パイプの名前 | - | irc | irc_buffer | ある IRC サーバ/チャンネル/ニックネームのバッファポインタを取得 | server,channel,nick (channel と nick はオプション) diff --git a/doc/ja/autogen/user/aspell_commands.txt b/doc/ja/autogen/user/aspell_commands.txt index 60eb2f62a..bb21c8e14 100644 --- a/doc/ja/autogen/user/aspell_commands.txt +++ b/doc/ja/autogen/user/aspell_commands.txt @@ -3,24 +3,24 @@ ........................................ /aspell enable|disable|toggle listdict - setdict + setdict [,...] deldict - addword [] + addword [] - enable: aspell の有効化 - disable: aspell の無効化 - toggle: aspell の有効無効を切り替え -listdict: インストール済み辞書を表示 - setdict: 現在のバッファ用の辞書を設定 - deldict: 現在のバッファ用の辞書を削除 - addword: aspell の個人辞書に単語を追加 + enable: enable aspell + disable: disable aspell + toggle: toggle aspell +listdict: show installed dictionaries + setdict: set dictionary for current buffer (multiple dictionaries can be separated by a comma) + deldict: delete dictionary used on current buffer + addword: add a word in personal aspell dictionary -いくつかのコマンドを除いて '/' で始まる入力行はチェックされません (/set aspell.check.commands を参照)。 +Input line beginning with a '/' is not checked, except for some commands (see /set aspell.check.commands). -全てのバッファで aspell を有効化するには、"default_dict" オプションを設定した後に、aspell を有効化してください。例えば: +To enable aspell on all buffers, use option "default_dict", then enable aspell, for example: /set aspell.check.default_dict "en" /aspell enable -aspell の有効無効を切り替えるデフォルトのキーは alt-s です。 +Default key to toggle aspell is alt-s. ........................................ diff --git a/po/POTFILES.in b/po/POTFILES.in index 6367c85cf..ee21e12ea 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -107,8 +107,14 @@ ./src/plugins/aspell/weechat-aspell.h ./src/plugins/aspell/weechat-aspell-bar-item.c ./src/plugins/aspell/weechat-aspell-bar-item.h +./src/plugins/aspell/weechat-aspell-command.c +./src/plugins/aspell/weechat-aspell-command.h +./src/plugins/aspell/weechat-aspell-completion.c +./src/plugins/aspell/weechat-aspell-completion.h ./src/plugins/aspell/weechat-aspell-config.c ./src/plugins/aspell/weechat-aspell-config.h +./src/plugins/aspell/weechat-aspell-info.c +./src/plugins/aspell/weechat-aspell-info.h ./src/plugins/aspell/weechat-aspell-speller.c ./src/plugins/aspell/weechat-aspell-speller.h ./src/plugins/charset/charset.c diff --git a/po/cs.po b/po/cs.po index 5a86802a2..b7c2b4d09 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-01-29 20:16+0100\n" +"POT-Creation-Date: 2013-01-31 19:07+0100\n" "PO-Revision-Date: 2013-01-20 12:07+0100\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -3758,19 +3758,30 @@ msgstr "" msgid "Spell checker for input (with Aspell)" msgstr "" -#, c-format -msgid "%s: \"%s\" removed" -msgstr "%s: \"%s\" odebrán" - #. TRANSLATORS: "%s" is "aspell" #, c-format msgid "%s dictionaries list:" msgstr "seznam slovníku %s:" +#, c-format +msgid "%s: \"%s\" removed" +msgstr "%s: \"%s\" odebrán" + #, c-format msgid "%s: error: dictionary \"%s\" is not available on your system" msgstr "%s: chyba: slovník \"%s\" není ve vašem systému dostupný" +#, c-format +msgid "%s%s: no dictionary on this buffer for adding word" +msgstr "%s%s: není žádný slovník pro přidání slova pro tento buffer" + +#, c-format +msgid "" +"%s%s: many dictionaries are defined for this buffer, please specify " +"dictionary" +msgstr "" +"%s%s: pro tento buffer je definováno mnoho slovníků, prosím uveďte slovník" + #, c-format msgid "%s: word \"%s\" added to personal dictionary" msgstr "%s: slovo \"%s\" přidáno do soukromého slovníku" @@ -3805,24 +3816,13 @@ msgstr "1 pokud jsou filtry povoleny" msgid "Aspell disabled" msgstr "Filtrování zpráv zakázáno" -#, c-format -msgid "%s%s: no dictionary on this buffer for adding word" -msgstr "%s%s: není žádný slovník pro přidání slova pro tento buffer" - -#, c-format -msgid "" -"%s%s: many dictionaries are defined for this buffer, please specify " -"dictionary" -msgstr "" -"%s%s: pro tento buffer je definováno mnoho slovníků, prosím uveďte slovník" - msgid "aspell plugin configuration" msgstr "konfigurace pluginu aspell" #, fuzzy msgid "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgstr "dictlist || enable || disable || addword [] " #, fuzzy @@ -3831,7 +3831,8 @@ msgid "" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" -" setdict: set dictionary for current buffer\n" +" setdict: set dictionary for current buffer (multiple dictionaries can be " +"separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" @@ -3852,9 +3853,13 @@ msgstr "" "\n" "Vstupní řádka začínající '/' není kontrolována, vyjma některých příkaů." -msgid "list of supported langs for aspell" +#, fuzzy +msgid "list of all languages supported by aspell" msgstr "seznam podporovaných jazyků v aspell" +msgid "list of aspell installed dictionaries" +msgstr "" + msgid "comma separated list of dictionaries to use on this buffer" msgstr "čárkami oddělený seznam slovníků, které použít pro tento buffer" @@ -3918,14 +3923,19 @@ msgstr "" "mimimální délka slova pro kontrolu pravopisu (použijte 0 pro kontrolu všech " "slov)" +#, fuzzy +msgid "comma-separated list of dictionaries used in buffer" +msgstr "čárkami oddělený seznam slovníků, které použít pro tento buffer" + +msgid "" +"buffer pointer (\"0x12345678\") or buffer full name (\"irc.freenode.#weechat" +"\")" +msgstr "" + #, c-format msgid "%s: warning: dictionary \"%s\" is not available on your system" msgstr "%s: upozornění: slovník \"%s\" není dostupný ve vašem systému" -#, c-format -msgid "%s%s: not enough memory to create new speller" -msgstr "%s%s: nedostatek paměti pro vytvoření kontroly pravopisu" - #, fuzzy msgid "Charset conversions" msgstr "verze WeeChat" @@ -9302,6 +9312,9 @@ msgstr "" msgid "Constants" msgstr "" +#~ msgid "%s%s: not enough memory to create new speller" +#~ msgstr "%s%s: nedostatek paměti pro vytvoření kontroly pravopisu" + #~ msgid "%s%s: cannot set socket option \"SO_REUSEADDR\"" #~ msgstr "%s%s: nemohu nastavit nastavení sketu \"SO_REUSEADDR\"" diff --git a/po/de.po b/po/de.po index 7a371a4a3..677bd2c48 100644 --- a/po/de.po +++ b/po/de.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-01-29 20:16+0100\n" +"POT-Creation-Date: 2013-01-31 19:07+0100\n" "PO-Revision-Date: 2013-01-20 12:07+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -4209,20 +4209,34 @@ msgstr "" msgid "Spell checker for input (with Aspell)" msgstr "Rechtschreibprüfung für die Eingabezeile (mittels Aspell)" -#, c-format -msgid "%s: \"%s\" removed" -msgstr "%s: \"%s\" entfernt" - #. TRANSLATORS: "%s" is "aspell" #, c-format msgid "%s dictionaries list:" msgstr "%s Wörterbücher:" +#, c-format +msgid "%s: \"%s\" removed" +msgstr "%s: \"%s\" entfernt" + #, c-format msgid "%s: error: dictionary \"%s\" is not available on your system" msgstr "" "%s: Fehler: das Wörterbuch \"%s\" ist auf diesem Rechner nicht verfügbar." +#, c-format +msgid "%s%s: no dictionary on this buffer for adding word" +msgstr "" +"%s%s: Es ist kein Wörterbuch für diesen Buffer aktiviert, deshalb kann das " +"Wort nicht hinzugefügt werden." + +#, c-format +msgid "" +"%s%s: many dictionaries are defined for this buffer, please specify " +"dictionary" +msgstr "" +"%s%s: es sind mehrere Wörterbücher für diesen Buffer definiert. Bitte wählen " +"Sie ein Wörterbuch davon aus." + #, c-format msgid "%s: word \"%s\" added to personal dictionary" msgstr "%s: Das Wort \"%s\" wurde dem persönlichen Wörterbuch hinzugefügt." @@ -4254,36 +4268,25 @@ msgstr "Aspell wurde aktiviert" msgid "Aspell disabled" msgstr "Aspell wurde deaktiviert" -#, c-format -msgid "%s%s: no dictionary on this buffer for adding word" -msgstr "" -"%s%s: Es ist kein Wörterbuch für diesen Buffer aktiviert, deshalb kann das " -"Wort nicht hinzugefügt werden." - -#, c-format -msgid "" -"%s%s: many dictionaries are defined for this buffer, please specify " -"dictionary" -msgstr "" -"%s%s: es sind mehrere Wörterbücher für diesen Buffer definiert. Bitte wählen " -"Sie ein Wörterbuch davon aus." - msgid "aspell plugin configuration" msgstr "Konfiguration für Aspell-Erweiterung" +#, fuzzy msgid "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgstr "" "enable|disable|toggle || listdict || setdict || deldict || addword " "[] " +#, fuzzy msgid "" " enable: enable aspell\n" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" -" setdict: set dictionary for current buffer\n" +" setdict: set dictionary for current buffer (multiple dictionaries can be " +"separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" @@ -4317,9 +4320,14 @@ msgstr "" "Die Standardtastaturbelegung zum Umschalten der Aspell Funktionalität lautet " "alt-s." -msgid "list of supported langs for aspell" +#, fuzzy +msgid "list of all languages supported by aspell" msgstr "Liste der zu nutzenden Übersetzungen für Aspell" +#, fuzzy +msgid "list of aspell installed dictionaries" +msgstr "Auflistung der installierten Skripten (vom Repositorium)" + msgid "comma separated list of dictionaries to use on this buffer" msgstr "" "eine durch Kommata getrennte Liste von Wörterbüchern, die in diesem Buffer " @@ -4393,14 +4401,21 @@ msgstr "" "Mindestlänge für ein Wort, welches auf Rechtschreibung überprüft werden soll " "(bei 0 werden alle Wörter überprüft)" +#, fuzzy +msgid "comma-separated list of dictionaries used in buffer" +msgstr "" +"eine durch Kommata getrennte Liste von Wörterbüchern, die in diesem Buffer " +"genutzt werden sollen" + +msgid "" +"buffer pointer (\"0x12345678\") or buffer full name (\"irc.freenode.#weechat" +"\")" +msgstr "" + #, c-format msgid "%s: warning: dictionary \"%s\" is not available on your system" msgstr "%s: Hinweis: das Wörterbuch \"%s\" ist auf dem Rechner nicht verfügbar" -#, c-format -msgid "%s%s: not enough memory to create new speller" -msgstr "%s%s: Nicht genug Speicher um neue Rechtschreibung zu erstellen" - msgid "Charset conversions" msgstr "Zeichensatzkonvertierung" @@ -10150,6 +10165,9 @@ msgstr "Type" msgid "Constants" msgstr "Konstanten" +#~ msgid "%s%s: not enough memory to create new speller" +#~ msgstr "%s%s: Nicht genug Speicher um neue Rechtschreibung zu erstellen" + #~ msgid "%s%s: cannot set socket option \"SO_REUSEADDR\"" #~ msgstr "%s%s Fehler beim Erstellen der Socket-Option \"SO_REUSEADDR\"" diff --git a/po/es.po b/po/es.po index d68c4404d..ebe9ab11d 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-01-29 20:16+0100\n" +"POT-Creation-Date: 2013-01-31 19:07+0100\n" "PO-Revision-Date: 2013-01-20 12:07+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -3951,19 +3951,31 @@ msgstr "" msgid "Spell checker for input (with Aspell)" msgstr "" -#, c-format -msgid "%s: \"%s\" removed" -msgstr "%s: \"%s\" eliminado" - #. TRANSLATORS: "%s" is "aspell" #, c-format msgid "%s dictionaries list:" msgstr "Lista de diccionarios %s:" +#, c-format +msgid "%s: \"%s\" removed" +msgstr "%s: \"%s\" eliminado" + #, c-format msgid "%s: error: dictionary \"%s\" is not available on your system" msgstr "%s: error: diccionario \"%s\" no está disponible en tu sistema" +#, c-format +msgid "%s%s: no dictionary on this buffer for adding word" +msgstr "%s%s: no hay diccionario en este buffer para agregar una palabra" + +#, c-format +msgid "" +"%s%s: many dictionaries are defined for this buffer, please specify " +"dictionary" +msgstr "" +"%s%s: varios diccionarios definidos para este buffer, por favor especifique " +"uno" + #, c-format msgid "%s: word \"%s\" added to personal dictionary" msgstr "%s: palabra \"%s\" agregada al diccionario personal" @@ -3994,24 +4006,13 @@ msgstr "Aspell activado" msgid "Aspell disabled" msgstr "Aspell desactivado" -#, c-format -msgid "%s%s: no dictionary on this buffer for adding word" -msgstr "%s%s: no hay diccionario en este buffer para agregar una palabra" - -#, c-format -msgid "" -"%s%s: many dictionaries are defined for this buffer, please specify " -"dictionary" -msgstr "" -"%s%s: varios diccionarios definidos para este buffer, por favor especifique " -"uno" - msgid "aspell plugin configuration" msgstr "configuración del plugin aspell" +#, fuzzy msgid "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgstr "" "enable|disable|toggle || listdict || setdict || deldict || addword " "[] " @@ -4022,7 +4023,8 @@ msgid "" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" -" setdict: set dictionary for current buffer\n" +" setdict: set dictionary for current buffer (multiple dictionaries can be " +"separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" @@ -4048,9 +4050,14 @@ msgstr "" "por ejemplo:\n" " /set aspell.check.default_dict \"es\"" -msgid "list of supported langs for aspell" +#, fuzzy +msgid "list of all languages supported by aspell" msgstr "lista de lenguajes soportados para aspell" +#, fuzzy +msgid "list of aspell installed dictionaries" +msgstr "lista de scripts instalados (desde el repositorio)" + msgid "comma separated list of dictionaries to use on this buffer" msgstr "lista separada por comas de diccionarios para usar en este buffer" @@ -4114,14 +4121,19 @@ msgstr "" "longitud mínima de una palabra para poder ser verificada ortográficamente " "(usar 0 para verificar todas las palabras)" +#, fuzzy +msgid "comma-separated list of dictionaries used in buffer" +msgstr "lista separada por comas de diccionarios para usar en este buffer" + +msgid "" +"buffer pointer (\"0x12345678\") or buffer full name (\"irc.freenode.#weechat" +"\")" +msgstr "" + #, c-format msgid "%s: warning: dictionary \"%s\" is not available on your system" msgstr "%s: atención: diccionario \"%s\" no está disponible en su sistema" -#, c-format -msgid "%s%s: not enough memory to create new speller" -msgstr "%s%s: no hay suficiente memoria para crear el nuevo deletreador" - msgid "Charset conversions" msgstr "Conversiones de mapa de caracteres" @@ -9542,6 +9554,9 @@ msgstr "Tipo" msgid "Constants" msgstr "Constantes" +#~ msgid "%s%s: not enough memory to create new speller" +#~ msgstr "%s%s: no hay suficiente memoria para crear el nuevo deletreador" + #~ msgid "%s%s: cannot set socket option \"SO_REUSEADDR\"" #~ msgstr "" #~ "%s%s: no ha sido posible configurar la opción del socket \"SO_REUSEADDR\"" diff --git a/po/fr.po b/po/fr.po index 821120d2f..3c85f06e1 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-01-29 20:16+0100\n" -"PO-Revision-Date: 2013-01-29 20:16+0100\n" +"POT-Creation-Date: 2013-01-31 19:07+0100\n" +"PO-Revision-Date: 2013-01-31 14:11+0100\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" "Language: French\n" @@ -4089,20 +4089,32 @@ msgstr "" msgid "Spell checker for input (with Aspell)" msgstr "Vérificateur d'orthographe pour la saisie (avec Aspell)" -#, c-format -msgid "%s: \"%s\" removed" -msgstr "%s: \"%s\" supprimé" - #. TRANSLATORS: "%s" is "aspell" #, c-format msgid "%s dictionaries list:" msgstr "Liste des dictionnaires %s:" +#, c-format +msgid "%s: \"%s\" removed" +msgstr "%s: \"%s\" supprimé" + #, c-format msgid "%s: error: dictionary \"%s\" is not available on your system" msgstr "" "%s: erreur: le dictionnaire \"%s\" n'est pas disponible sur votre système" +#, c-format +msgid "%s%s: no dictionary on this buffer for adding word" +msgstr "%s%s: pas de dictionnaire sur ce tampon pour ajouter le mot" + +#, c-format +msgid "" +"%s%s: many dictionaries are defined for this buffer, please specify " +"dictionary" +msgstr "" +"%s%s: plusieurs dictionnaires sont définis pour ce tampon, merci de préciser " +"le dictionnaire" + #, c-format msgid "%s: word \"%s\" added to personal dictionary" msgstr "%s: mot \"%s\" ajouté dans le dictionnaire personnel" @@ -4133,34 +4145,23 @@ msgstr "Aspell activé" msgid "Aspell disabled" msgstr "Aspell désactivé" -#, c-format -msgid "%s%s: no dictionary on this buffer for adding word" -msgstr "%s%s: pas de dictionnaire sur ce tampon pour ajouter le mot" - -#, c-format -msgid "" -"%s%s: many dictionaries are defined for this buffer, please specify " -"dictionary" -msgstr "" -"%s%s: plusieurs dictionnaires sont définis pour ce tampon, merci de préciser " -"le dictionnaire" - msgid "aspell plugin configuration" msgstr "configuration de l'extension aspell" msgid "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgstr "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgid "" " enable: enable aspell\n" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" -" setdict: set dictionary for current buffer\n" +" setdict: set dictionary for current buffer (multiple dictionaries can be " +"separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" @@ -4178,7 +4179,8 @@ msgstr "" " disable: désactiver aspell\n" " toggle: activer/désactiver aspell\n" "listdict: afficher les dictionnaires installés\n" -" setdict: définir le dictionnaire pour le tampon courant\n" +" setdict: définir le dictionnaire pour le tampon courant (plusieurs " +"dictionnaires peuvent être séparés par une virgule)\n" " deldict: supprimer le dictionnaire utilisé sur le tampon courant\n" " addword: ajouter un mot dans le dictionnaire personnel aspell\n" "\n" @@ -4192,8 +4194,11 @@ msgstr "" "\n" "La touche par défaut pour activer/désactiver aspell est alt-s." -msgid "list of supported langs for aspell" -msgstr "liste des langues supportées pour aspell" +msgid "list of all languages supported by aspell" +msgstr "liste de toutes les langues supportées par aspell" + +msgid "list of aspell installed dictionaries" +msgstr "liste des dictionnaires aspell installés" msgid "comma separated list of dictionaries to use on this buffer" msgstr "" @@ -4263,16 +4268,23 @@ msgstr "" "longueur minimum d'un mot pour que l'otrhographe soit vérifiée (utilisez 0 " "pour vérifier tous les mots)" +msgid "comma-separated list of dictionaries used in buffer" +msgstr "" +"liste de dictionnaires (séparés par des virgules) utilisés sur le tampon" + +msgid "" +"buffer pointer (\"0x12345678\") or buffer full name (\"irc.freenode.#weechat" +"\")" +msgstr "" +"pointeur vers un tampon (\"0x12345678\") ou nom complet de tampon (\"irc." +"freenode.#weechat\")" + #, c-format msgid "%s: warning: dictionary \"%s\" is not available on your system" msgstr "" "%s: attention: le dictionnaire \\\"%s\\\" n'est pas disponible sur votre " "système" -#, c-format -msgid "%s%s: not enough memory to create new speller" -msgstr "%s%s: pas assez de mémoire pour créer un nouveau speller" - msgid "Charset conversions" msgstr "Conversions de charset" @@ -9894,33 +9906,3 @@ msgstr "Type" msgid "Constants" msgstr "Constantes" - -#~ msgid "%s%s: cannot set socket option \"SO_REUSEADDR\"" -#~ msgstr "%s%s: impossible d'activer l'option socket \"SO_REUSEADDR\"" - -#~ msgid "%s%s: cannot set socket option \"IPV6_V6ONLY\" to value %d" -#~ msgstr "" -#~ "%s%s: impossible d'activer l'option socket \"IPV6_V6ONLY\" à la valeur %d" - -#~ msgid "%s%s: cannot set socket option \"SO_KEEPALIVE\"" -#~ msgstr "%s%s: impossible d'activer l'option socket \"SO_KEEPALIVE\"" - -#~ msgid "%s%s: cannot create socket for xfer" -#~ msgstr "%s%s: impossible de créer la socket pour le xfer" - -#~ msgid "%s%s: not enough memory to parse file \"%s\"" -#~ msgstr "%s%s: mémoire insuffisante pour lire le fichier \"%s\"" - -#~ msgid "%s%s: unable to run file \"%s\"" -#~ msgstr "%s%s: impossible de lancer le fichier \"%s\"" - -#~ msgid "%s%s: unknown error while loading file \"%s\"" -#~ msgstr "%s%s: erreur inconnue en chargement du fichier \"%s\"" - -#~ msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)" -#~ msgstr "" -#~ "%s: erreur de chargement du script \"%s\" (mauvais nom, les espaces sont " -#~ "interdits)" - -#~ msgid "%s%s: cannot create socket" -#~ msgstr "%s%s: impossible de créer la socket" diff --git a/po/hu.po b/po/hu.po index 082830482..3b247adce 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-01-29 20:16+0100\n" +"POT-Creation-Date: 2013-01-31 19:07+0100\n" "PO-Revision-Date: 2013-01-20 12:07+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -3394,19 +3394,29 @@ msgstr "" msgid "Spell checker for input (with Aspell)" msgstr "" -#, fuzzy, c-format -msgid "%s: \"%s\" removed" -msgstr "A \"%s\" aliasz eltávolítva\n" - #. TRANSLATORS: "%s" is "aspell" #, fuzzy, c-format msgid "%s dictionaries list:" msgstr "a /who lista vége" +#, fuzzy, c-format +msgid "%s: \"%s\" removed" +msgstr "A \"%s\" aliasz eltávolítva\n" + #, c-format msgid "%s: error: dictionary \"%s\" is not available on your system" msgstr "" +#, c-format +msgid "%s%s: no dictionary on this buffer for adding word" +msgstr "" + +#, c-format +msgid "" +"%s%s: many dictionaries are defined for this buffer, please specify " +"dictionary" +msgstr "" + #, c-format msgid "%s: word \"%s\" added to personal dictionary" msgstr "" @@ -3441,23 +3451,13 @@ msgstr "a felhasználók le lettek tiltva" msgid "Aspell disabled" msgstr "Nincs aliasz definiálva.\n" -#, c-format -msgid "%s%s: no dictionary on this buffer for adding word" -msgstr "" - -#, c-format -msgid "" -"%s%s: many dictionaries are defined for this buffer, please specify " -"dictionary" -msgstr "" - #, fuzzy msgid "aspell plugin configuration" msgstr "Beállítások mentése a lemezre\n" msgid "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgstr "" msgid "" @@ -3465,7 +3465,8 @@ msgid "" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" -" setdict: set dictionary for current buffer\n" +" setdict: set dictionary for current buffer (multiple dictionaries can be " +"separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" @@ -3480,7 +3481,10 @@ msgid "" "Default key to toggle aspell is alt-s." msgstr "" -msgid "list of supported langs for aspell" +msgid "list of all languages supported by aspell" +msgstr "" + +msgid "list of aspell installed dictionaries" msgstr "" msgid "comma separated list of dictionaries to use on this buffer" @@ -3535,14 +3539,18 @@ msgid "" "minimum length for a word to be spell checked (use 0 to check all words)" msgstr "" +msgid "comma-separated list of dictionaries used in buffer" +msgstr "" + +msgid "" +"buffer pointer (\"0x12345678\") or buffer full name (\"irc.freenode.#weechat" +"\")" +msgstr "" + #, c-format msgid "%s: warning: dictionary \"%s\" is not available on your system" msgstr "" -#, fuzzy, c-format -msgid "%s%s: not enough memory to create new speller" -msgstr "%s nincs elegendő memória új DCC számára\n" - #, fuzzy msgid "Charset conversions" msgstr "WeeChat szlogen" @@ -8782,6 +8790,10 @@ msgstr "" msgid "Constants" msgstr "" +#, fuzzy +#~ msgid "%s%s: not enough memory to create new speller" +#~ msgstr "%s nincs elegendő memória új DCC számára\n" + #, fuzzy #~ msgid "%s%s: cannot set socket option \"SO_REUSEADDR\"" #~ msgstr "%s nem sikerült a \"SO_REUSEADDR\" csatornaopciót beállítani\n" diff --git a/po/it.po b/po/it.po index e071e8641..8f5963a00 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-01-29 20:16+0100\n" +"POT-Creation-Date: 2013-01-31 19:07+0100\n" "PO-Revision-Date: 2013-01-20 12:07+0100\n" "Last-Translator: Marco Paolone \n" "Language-Team: weechat-dev \n" @@ -3936,19 +3936,31 @@ msgstr "" msgid "Spell checker for input (with Aspell)" msgstr "" -#, c-format -msgid "%s: \"%s\" removed" -msgstr "%s; \"%s\" eliminato" - #. TRANSLATORS: "%s" is "aspell" #, c-format msgid "%s dictionaries list:" msgstr "elenco dizionari %s" +#, c-format +msgid "%s: \"%s\" removed" +msgstr "%s; \"%s\" eliminato" + #, c-format msgid "%s: error: dictionary \"%s\" is not available on your system" msgstr "%s: errore: il dizionario \"%s\" non è disponibile su questo sistema" +#, c-format +msgid "%s%s: no dictionary on this buffer for adding word" +msgstr "%s%s: nessun dizionario su questo buffer per aggiungere parole" + +#, c-format +msgid "" +"%s%s: many dictionaries are defined for this buffer, please specify " +"dictionary" +msgstr "" +"%s%s: più dizionari definiti per questo buffer, è necessario specificare un " +"dizionario" + #, c-format msgid "%s: word \"%s\" added to personal dictionary" msgstr "%s: la parola \"%s\" è stata aggiunta al dizionario personale" @@ -3979,34 +3991,25 @@ msgstr "Aspell abilitato" msgid "Aspell disabled" msgstr "Aspell disabilitato" -#, c-format -msgid "%s%s: no dictionary on this buffer for adding word" -msgstr "%s%s: nessun dizionario su questo buffer per aggiungere parole" - -#, c-format -msgid "" -"%s%s: many dictionaries are defined for this buffer, please specify " -"dictionary" -msgstr "" -"%s%s: più dizionari definiti per questo buffer, è necessario specificare un " -"dizionario" - msgid "aspell plugin configuration" msgstr "configurazione del plugin aspell" +#, fuzzy msgid "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgstr "" "enable|disable|toggle || listdict || setdict || deldict || addword " "[] " +#, fuzzy msgid "" " enable: enable aspell\n" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" -" setdict: set dictionary for current buffer\n" +" setdict: set dictionary for current buffer (multiple dictionaries can be " +"separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" @@ -4038,9 +4041,13 @@ msgstr "" "\n" "Il tasto predefinito per (dis)abilitare aspell è alt-s." -msgid "list of supported langs for aspell" +#, fuzzy +msgid "list of all languages supported by aspell" msgstr "elenco di lingue supportate per aspell" +msgid "list of aspell installed dictionaries" +msgstr "" + msgid "comma separated list of dictionaries to use on this buffer" msgstr "elenco separato da virgole di dizionari da usare su questo buffer" @@ -4103,15 +4110,20 @@ msgid "" msgstr "" "lunghezza minima per una parola da controllare (0 per controllarle tutte)" +#, fuzzy +msgid "comma-separated list of dictionaries used in buffer" +msgstr "elenco separato da virgole di dizionari da usare su questo buffer" + +msgid "" +"buffer pointer (\"0x12345678\") or buffer full name (\"irc.freenode.#weechat" +"\")" +msgstr "" + #, c-format msgid "%s: warning: dictionary \"%s\" is not available on your system" msgstr "" "%s: attenzione: il dizionario \"%s\" non è disponibile su questo sistema" -#, c-format -msgid "%s%s: not enough memory to create new speller" -msgstr "%s%s: memoria non sufficiente per creare un nuovo correttore" - #, fuzzy msgid "Charset conversions" msgstr "versione di WeeChat" @@ -9574,6 +9586,9 @@ msgstr "Tipo" msgid "Constants" msgstr "Costanti" +#~ msgid "%s%s: not enough memory to create new speller" +#~ msgstr "%s%s: memoria non sufficiente per creare un nuovo correttore" + #~ msgid "%s%s: cannot set socket option \"SO_REUSEADDR\"" #~ msgstr "%s%s: impossibile impostare l'opzione del socket \"SO_REUSEADDR\"" diff --git a/po/ja.po b/po/ja.po index 5c54f035f..e5f1dfeea 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-01-29 20:16+0100\n" +"POT-Creation-Date: 2013-01-31 19:07+0100\n" "PO-Revision-Date: 2013-01-20 12:07+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -3930,19 +3930,30 @@ msgstr "" msgid "Spell checker for input (with Aspell)" msgstr "入力に対するスペルチェッカ (Aspell を利用)" -#, c-format -msgid "%s: \"%s\" removed" -msgstr "%s: \"%s\" 削除しました" - #. TRANSLATORS: "%s" is "aspell" #, c-format msgid "%s dictionaries list:" msgstr "%s ディレクトリリスト:" +#, c-format +msgid "%s: \"%s\" removed" +msgstr "%s: \"%s\" 削除しました" + #, c-format msgid "%s: error: dictionary \"%s\" is not available on your system" msgstr "%s: エラー: ディレクトリ \"%s\" がシステム上に見つかりません" +#, c-format +msgid "%s%s: no dictionary on this buffer for adding word" +msgstr "%s%s: このバッファ上には単語を追加する辞書がありません" + +#, c-format +msgid "" +"%s%s: many dictionaries are defined for this buffer, please specify " +"dictionary" +msgstr "" +"%s%s: このバッファには複数の辞書が定義されています、辞書を指定してください" + #, c-format msgid "%s: word \"%s\" added to personal dictionary" msgstr "%s: 単語 \"%s\" を個人辞書に追加" @@ -3973,33 +3984,25 @@ msgstr "Aspell が有効化されています" msgid "Aspell disabled" msgstr "Aspell が無効化されています" -#, c-format -msgid "%s%s: no dictionary on this buffer for adding word" -msgstr "%s%s: このバッファ上には単語を追加する辞書がありません" - -#, c-format -msgid "" -"%s%s: many dictionaries are defined for this buffer, please specify " -"dictionary" -msgstr "" -"%s%s: このバッファには複数の辞書が定義されています、辞書を指定してください" - msgid "aspell plugin configuration" msgstr "aspell プラグイン設定" +#, fuzzy msgid "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgstr "" "enable|disable|toggle || listdict || setdict || deldict || addword " "[] " +#, fuzzy msgid "" " enable: enable aspell\n" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" -" setdict: set dictionary for current buffer\n" +" setdict: set dictionary for current buffer (multiple dictionaries can be " +"separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" @@ -4031,9 +4034,14 @@ msgstr "" "\n" "aspell の有効無効を切り替えるデフォルトのキーは alt-s です。" -msgid "list of supported langs for aspell" +#, fuzzy +msgid "list of all languages supported by aspell" msgstr "aspell でサポートされる言語のリスト" +#, fuzzy +msgid "list of aspell installed dictionaries" +msgstr "インストール済みスクリプトのリスト (リポジトリから)" + msgid "comma separated list of dictionaries to use on this buffer" msgstr "このバッファで使用中の辞書のカンマ区切りリスト" @@ -4097,14 +4105,19 @@ msgid "" "minimum length for a word to be spell checked (use 0 to check all words)" msgstr "スペルチェックを行う単語長の最小値 (0 の場合は全ての単語をチェック)" +#, fuzzy +msgid "comma-separated list of dictionaries used in buffer" +msgstr "このバッファで使用中の辞書のカンマ区切りリスト" + +msgid "" +"buffer pointer (\"0x12345678\") or buffer full name (\"irc.freenode.#weechat" +"\")" +msgstr "" + #, c-format msgid "%s: warning: dictionary \"%s\" is not available on your system" msgstr "%s: 警告: 辞書 \"%s\" がこのシステム上では利用できません" -#, c-format -msgid "%s%s: not enough memory to create new speller" -msgstr "%s%s: 新しい speller を作る十分なメモリがありません" - msgid "Charset conversions" msgstr "文字コード変換" @@ -9557,6 +9570,9 @@ msgstr "タイプ" msgid "Constants" msgstr "定数" +#~ msgid "%s%s: not enough memory to create new speller" +#~ msgstr "%s%s: 新しい speller を作る十分なメモリがありません" + #~ msgid "%s%s: cannot set socket option \"SO_REUSEADDR\"" #~ msgstr "%s%s: ソケットオプション \"SO_REUSEADDR\" の設定に失敗" diff --git a/po/pl.po b/po/pl.po index ae53a21e9..dd8374d92 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-01-29 20:16+0100\n" +"POT-Creation-Date: 2013-01-31 19:07+0100\n" "PO-Revision-Date: 2013-01-20 12:08+0100\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -4023,19 +4023,30 @@ msgstr "nazwa aliasu (może się zaczynać lub kończyć \"*\") (opcjonalne)" msgid "Spell checker for input (with Aspell)" msgstr "Sprawdzanie pisowni dla wejścia (poprzez Aspell)" -#, c-format -msgid "%s: \"%s\" removed" -msgstr "%s: \"%s\" usunięty" - #. TRANSLATORS: "%s" is "aspell" #, c-format msgid "%s dictionaries list:" msgstr "%s lista słowników:" +#, c-format +msgid "%s: \"%s\" removed" +msgstr "%s: \"%s\" usunięty" + #, c-format msgid "%s: error: dictionary \"%s\" is not available on your system" msgstr "%s: błąd: słownik \"%s\" jest niedostępny w Twoim systemie" +#, c-format +msgid "%s%s: no dictionary on this buffer for adding word" +msgstr "%s%s: brak słownika w tym buforze do dodania słowa" + +#, c-format +msgid "" +"%s%s: many dictionaries are defined for this buffer, please specify " +"dictionary" +msgstr "" +"%s%s: wiele słowników zdefiniowanych dla tego bufora, podaj konkretny słownik" + #, c-format msgid "%s: word \"%s\" added to personal dictionary" msgstr "%s: słowo \"%s\" dodane do osobistego słownika" @@ -4066,33 +4077,25 @@ msgstr "Aspell włączony" msgid "Aspell disabled" msgstr "Aspell wyłączony" -#, c-format -msgid "%s%s: no dictionary on this buffer for adding word" -msgstr "%s%s: brak słownika w tym buforze do dodania słowa" - -#, c-format -msgid "" -"%s%s: many dictionaries are defined for this buffer, please specify " -"dictionary" -msgstr "" -"%s%s: wiele słowników zdefiniowanych dla tego bufora, podaj konkretny słownik" - msgid "aspell plugin configuration" msgstr "konfiguracja wtyczki aspell" +#, fuzzy msgid "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgstr "" "enable|disable|toggle || listdict || setdict || deldict || addword " "[] " +#, fuzzy msgid "" " enable: enable aspell\n" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" -" setdict: set dictionary for current buffer\n" +" setdict: set dictionary for current buffer (multiple dictionaries can be " +"separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" @@ -4124,9 +4127,14 @@ msgstr "" "\n" "Domyślny skrót klawiszowy przełączający aspell to alt-s." -msgid "list of supported langs for aspell" +#, fuzzy +msgid "list of all languages supported by aspell" msgstr "lista wspieranych przez aspell języków" +#, fuzzy +msgid "list of aspell installed dictionaries" +msgstr "lista zainstalowanych skryptów (z repozytorium)" + msgid "comma separated list of dictionaries to use on this buffer" msgstr "oddzielona przecinkami lista słowników do użycia w tym buforze" @@ -4191,14 +4199,19 @@ msgid "" msgstr "" "minimalna długość słowa do sprawdzenia ( 0 - sprawdzaj wszystkie słowa)" +#, fuzzy +msgid "comma-separated list of dictionaries used in buffer" +msgstr "oddzielona przecinkami lista słowników do użycia w tym buforze" + +msgid "" +"buffer pointer (\"0x12345678\") or buffer full name (\"irc.freenode.#weechat" +"\")" +msgstr "" + #, c-format msgid "%s: warning: dictionary \"%s\" is not available on your system" msgstr "%s: ostrzeżenie: słownik \"%s\" nie jest dostępny w Twoim systemie" -#, c-format -msgid "%s%s: not enough memory to create new speller" -msgstr "%s%s: za mało pamięci na utworzenie nowego słownika" - msgid "Charset conversions" msgstr "Konwersja kodowania" @@ -9712,6 +9725,9 @@ msgstr "Typ" msgid "Constants" msgstr "Stałe" +#~ msgid "%s%s: not enough memory to create new speller" +#~ msgstr "%s%s: za mało pamięci na utworzenie nowego słownika" + #~ msgid "%s%s: cannot set socket option \"SO_REUSEADDR\"" #~ msgstr "%s%s: nie można ustawić opcji gniazda \"SO_REUSEADDR\"" diff --git a/po/pt_BR.po b/po/pt_BR.po index 070aa5922..69589d955 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-01-29 20:16+0100\n" +"POT-Creation-Date: 2013-01-31 19:07+0100\n" "PO-Revision-Date: 2013-01-20 12:08+0100\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -3811,19 +3811,31 @@ msgstr "" msgid "Spell checker for input (with Aspell)" msgstr "" -#, c-format -msgid "%s: \"%s\" removed" -msgstr "%s: \"%s\" removido" - #. TRANSLATORS: "%s" is "aspell" #, c-format msgid "%s dictionaries list:" msgstr "lista de dicionários do %s" +#, c-format +msgid "%s: \"%s\" removed" +msgstr "%s: \"%s\" removido" + #, c-format msgid "%s: error: dictionary \"%s\" is not available on your system" msgstr "%s: erro: dicionário \"%s\" não está disponível em seu sistema" +#, c-format +msgid "%s%s: no dictionary on this buffer for adding word" +msgstr "%s%s: nenhum dicionário para adicionar palavra neste buffer" + +#, c-format +msgid "" +"%s%s: many dictionaries are defined for this buffer, please specify " +"dictionary" +msgstr "" +"%s%s: muitos dicionários estão definidor para este buffer, por favor " +"especifique o dicionário" + #, c-format msgid "%s: word \"%s\" added to personal dictionary" msgstr "%s: palavra \"%s\" adicionada ao dicionário pessoal" @@ -3858,25 +3870,13 @@ msgstr "Mouse habilitado" msgid "Aspell disabled" msgstr "Mouse desabilitado" -#, c-format -msgid "%s%s: no dictionary on this buffer for adding word" -msgstr "%s%s: nenhum dicionário para adicionar palavra neste buffer" - -#, c-format -msgid "" -"%s%s: many dictionaries are defined for this buffer, please specify " -"dictionary" -msgstr "" -"%s%s: muitos dicionários estão definidor para este buffer, por favor " -"especifique o dicionário" - msgid "aspell plugin configuration" msgstr "configuração do plugin aspell" #, fuzzy msgid "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgstr "dictlist || enable || disable || addword [] " msgid "" @@ -3884,7 +3884,8 @@ msgid "" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" -" setdict: set dictionary for current buffer\n" +" setdict: set dictionary for current buffer (multiple dictionaries can be " +"separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" @@ -3899,9 +3900,13 @@ msgid "" "Default key to toggle aspell is alt-s." msgstr "" -msgid "list of supported langs for aspell" +#, fuzzy +msgid "list of all languages supported by aspell" msgstr "lista de idiomas suportados para aspell" +msgid "list of aspell installed dictionaries" +msgstr "" + msgid "comma separated list of dictionaries to use on this buffer" msgstr "lista de dicionários (separados por vírgula) para uso neste buffer" @@ -3967,14 +3972,19 @@ msgstr "" "tamanho mínimo de uma palavra para ser verificada ortograficamente (use 0 " "para verificar todas as palavras)" +#, fuzzy +msgid "comma-separated list of dictionaries used in buffer" +msgstr "lista de dicionários (separados por vírgula) para uso neste buffer" + +msgid "" +"buffer pointer (\"0x12345678\") or buffer full name (\"irc.freenode.#weechat" +"\")" +msgstr "" + #, c-format msgid "%s: warning: dictionary \"%s\" is not available on your system" msgstr "%s: aviso: dicionário \"%s\" não está disponível em seu sistema" -#, c-format -msgid "%s%s: not enough memory to create new speller" -msgstr "%s%s: memória insuficiente para criar novo verificador ortográfico" - #, fuzzy msgid "Charset conversions" msgstr "versão do WeeChat" @@ -8931,6 +8941,9 @@ msgstr "" msgid "Constants" msgstr "" +#~ msgid "%s%s: not enough memory to create new speller" +#~ msgstr "%s%s: memória insuficiente para criar novo verificador ortográfico" + #~ msgid "%s%s: cannot set socket option \"SO_REUSEADDR\"" #~ msgstr "%s%s: não foi possível setar opção \"SO_REUSEADDR\" para o socket" diff --git a/po/ru.po b/po/ru.po index 73499a9e3..f8a8cedd5 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-01-29 20:16+0100\n" +"POT-Creation-Date: 2013-01-31 19:07+0100\n" "PO-Revision-Date: 2013-01-20 12:08+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -3426,19 +3426,29 @@ msgstr "" msgid "Spell checker for input (with Aspell)" msgstr "" -#, fuzzy, c-format -msgid "%s: \"%s\" removed" -msgstr "Сокращение \"%s\" удалено\n" - #. TRANSLATORS: "%s" is "aspell" #, fuzzy, c-format msgid "%s dictionaries list:" msgstr "конец списка /who" +#, fuzzy, c-format +msgid "%s: \"%s\" removed" +msgstr "Сокращение \"%s\" удалено\n" + #, c-format msgid "%s: error: dictionary \"%s\" is not available on your system" msgstr "" +#, c-format +msgid "%s%s: no dictionary on this buffer for adding word" +msgstr "" + +#, c-format +msgid "" +"%s%s: many dictionaries are defined for this buffer, please specify " +"dictionary" +msgstr "" + #, c-format msgid "%s: word \"%s\" added to personal dictionary" msgstr "" @@ -3473,23 +3483,13 @@ msgstr "команда users отключена" msgid "Aspell disabled" msgstr "Сокращения не заданы.\n" -#, c-format -msgid "%s%s: no dictionary on this buffer for adding word" -msgstr "" - -#, c-format -msgid "" -"%s%s: many dictionaries are defined for this buffer, please specify " -"dictionary" -msgstr "" - #, fuzzy msgid "aspell plugin configuration" msgstr "Сохраняю конфигурацию\n" msgid "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgstr "" msgid "" @@ -3497,7 +3497,8 @@ msgid "" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" -" setdict: set dictionary for current buffer\n" +" setdict: set dictionary for current buffer (multiple dictionaries can be " +"separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" @@ -3512,7 +3513,10 @@ msgid "" "Default key to toggle aspell is alt-s." msgstr "" -msgid "list of supported langs for aspell" +msgid "list of all languages supported by aspell" +msgstr "" + +msgid "list of aspell installed dictionaries" msgstr "" msgid "comma separated list of dictionaries to use on this buffer" @@ -3567,14 +3571,18 @@ msgid "" "minimum length for a word to be spell checked (use 0 to check all words)" msgstr "" +msgid "comma-separated list of dictionaries used in buffer" +msgstr "" + +msgid "" +"buffer pointer (\"0x12345678\") or buffer full name (\"irc.freenode.#weechat" +"\")" +msgstr "" + #, c-format msgid "%s: warning: dictionary \"%s\" is not available on your system" msgstr "" -#, fuzzy, c-format -msgid "%s%s: not enough memory to create new speller" -msgstr "%s недостаточно памяти для нового DCC\n" - #, fuzzy msgid "Charset conversions" msgstr "слоган WeeChat" @@ -8799,6 +8807,10 @@ msgstr "" msgid "Constants" msgstr "" +#, fuzzy +#~ msgid "%s%s: not enough memory to create new speller" +#~ msgstr "%s недостаточно памяти для нового DCC\n" + #, fuzzy #~ msgid "%s%s: cannot set socket option \"SO_REUSEADDR\"" #~ msgstr "%s не могу установить настройку сокета \"SO_REUSEADDR\"\n" diff --git a/po/srcfiles.cmake b/po/srcfiles.cmake index e1d101059..685225b56 100644 --- a/po/srcfiles.cmake +++ b/po/srcfiles.cmake @@ -108,8 +108,14 @@ SET(WEECHAT_SOURCES ./src/plugins/aspell/weechat-aspell.h ./src/plugins/aspell/weechat-aspell-bar-item.c ./src/plugins/aspell/weechat-aspell-bar-item.h +./src/plugins/aspell/weechat-aspell-command.c +./src/plugins/aspell/weechat-aspell-command.h +./src/plugins/aspell/weechat-aspell-completion.c +./src/plugins/aspell/weechat-aspell-completion.h ./src/plugins/aspell/weechat-aspell-config.c ./src/plugins/aspell/weechat-aspell-config.h +./src/plugins/aspell/weechat-aspell-info.c +./src/plugins/aspell/weechat-aspell-info.h ./src/plugins/aspell/weechat-aspell-speller.c ./src/plugins/aspell/weechat-aspell-speller.h ./src/plugins/charset/charset.c diff --git a/po/weechat.pot b/po/weechat.pot index 3be5e17c7..3cdc12aa7 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: 2013-01-29 20:16+0100\n" +"POT-Creation-Date: 2013-01-31 19:07+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3002,19 +3002,29 @@ msgstr "" msgid "Spell checker for input (with Aspell)" msgstr "" -#, c-format -msgid "%s: \"%s\" removed" -msgstr "" - #. TRANSLATORS: "%s" is "aspell" #, c-format msgid "%s dictionaries list:" msgstr "" +#, c-format +msgid "%s: \"%s\" removed" +msgstr "" + #, c-format msgid "%s: error: dictionary \"%s\" is not available on your system" msgstr "" +#, c-format +msgid "%s%s: no dictionary on this buffer for adding word" +msgstr "" + +#, c-format +msgid "" +"%s%s: many dictionaries are defined for this buffer, please specify " +"dictionary" +msgstr "" + #, c-format msgid "%s: word \"%s\" added to personal dictionary" msgstr "" @@ -3045,22 +3055,12 @@ msgstr "" msgid "Aspell disabled" msgstr "" -#, c-format -msgid "%s%s: no dictionary on this buffer for adding word" -msgstr "" - -#, c-format -msgid "" -"%s%s: many dictionaries are defined for this buffer, please specify " -"dictionary" -msgstr "" - msgid "aspell plugin configuration" msgstr "" msgid "" -"enable|disable|toggle || listdict || setdict || deldict || addword " -"[] " +"enable|disable|toggle || listdict || setdict [,...] || deldict " +"|| addword [] " msgstr "" msgid "" @@ -3068,7 +3068,8 @@ msgid "" " disable: disable aspell\n" " toggle: toggle aspell\n" "listdict: show installed dictionaries\n" -" setdict: set dictionary for current buffer\n" +" setdict: set dictionary for current buffer (multiple dictionaries can be " +"separated by a comma)\n" " deldict: delete dictionary used on current buffer\n" " addword: add a word in personal aspell dictionary\n" "\n" @@ -3083,7 +3084,10 @@ msgid "" "Default key to toggle aspell is alt-s." msgstr "" -msgid "list of supported langs for aspell" +msgid "list of all languages supported by aspell" +msgstr "" + +msgid "list of aspell installed dictionaries" msgstr "" msgid "comma separated list of dictionaries to use on this buffer" @@ -3137,12 +3141,16 @@ msgid "" "minimum length for a word to be spell checked (use 0 to check all words)" msgstr "" -#, c-format -msgid "%s: warning: dictionary \"%s\" is not available on your system" +msgid "comma-separated list of dictionaries used in buffer" +msgstr "" + +msgid "" +"buffer pointer (\"0x12345678\") or buffer full name (\"irc.freenode.#weechat" +"\")" msgstr "" #, c-format -msgid "%s%s: not enough memory to create new speller" +msgid "%s: warning: dictionary \"%s\" is not available on your system" msgstr "" msgid "Charset conversions" diff --git a/src/plugins/aspell/CMakeLists.txt b/src/plugins/aspell/CMakeLists.txt index 6b5248ecb..eadb701e1 100644 --- a/src/plugins/aspell/CMakeLists.txt +++ b/src/plugins/aspell/CMakeLists.txt @@ -21,7 +21,10 @@ ADD_LIBRARY(aspell MODULE weechat-aspell.c weechat-aspell.h weechat-aspell-bar-item.c weechat-aspell-bar-item.h +weechat-aspell-command.c weechat-aspell-command.h +weechat-aspell-completion.c weechat-aspell-completion.h weechat-aspell-config.c weechat-aspell-config.h +weechat-aspell-info.c weechat-aspell-info.h weechat-aspell-speller.c weechat-aspell-speller.h) SET_TARGET_PROPERTIES(aspell PROPERTIES PREFIX "") diff --git a/src/plugins/aspell/Makefile.am b/src/plugins/aspell/Makefile.am index 41679833f..c101d05a0 100644 --- a/src/plugins/aspell/Makefile.am +++ b/src/plugins/aspell/Makefile.am @@ -28,8 +28,14 @@ aspell_la_SOURCES = weechat-aspell.c \ weechat-aspell.h \ weechat-aspell-bar-item.c \ weechat-aspell-bar-item.h \ + weechat-aspell-command.c \ + weechat-aspell-command.h \ + weechat-aspell-completion.c \ + weechat-aspell-completion.h \ weechat-aspell-config.c \ weechat-aspell-config.h \ + weechat-aspell-info.c \ + weechat-aspell-info.h \ weechat-aspell-speller.c \ weechat-aspell-speller.h aspell_la_LDFLAGS = -module diff --git a/src/plugins/aspell/weechat-aspell-command.c b/src/plugins/aspell/weechat-aspell-command.c new file mode 100644 index 000000000..9ef908776 --- /dev/null +++ b/src/plugins/aspell/weechat-aspell-command.c @@ -0,0 +1,410 @@ +/* + * weechat-aspell-command.c - aspell commands + * + * Copyright (C) 2013 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see . + */ + +#include +#include +#include + +#include "../weechat-plugin.h" +#include "weechat-aspell.h" +#include "weechat-aspell-config.h" +#include "weechat-aspell-speller.h" + + +/* + * Converts an aspell ISO lang code in its English full name. + * + * Note: result must be freed after use. + */ + +char * +weechat_aspell_command_iso_to_lang (const char *code) +{ + int i; + + for (i = 0; aspell_langs[i].code; i++) + { + if (strcmp (aspell_langs[i].code, code) == 0) + return strdup (aspell_langs[i].name); + } + + /* lang code not found */ + return strdup ("Unknown"); +} + +/* + * Converts an aspell ISO country code in its English full name. + * + * Note: result must be freed after use. + */ + +char * +weechat_aspell_command_iso_to_country (const char *code) +{ + int i; + + for (i = 0; aspell_countries[i].code; i++) + { + if (strcmp (aspell_countries[i].code, code) == 0) + return strdup (aspell_countries[i].name); + } + + /* country code not found */ + return strdup ("Unknown"); +} + +/* + * Displays list of aspell dictionaries installed on system. + */ + +void +weechat_aspell_command_speller_list_dicts () +{ + char *country, *lang, *pos; + char str_dict[256], str_country[128]; + struct AspellConfig *config; + AspellDictInfoList *list; + AspellDictInfoEnumeration *elements; + const AspellDictInfo *dict; + + config = new_aspell_config(); + list = get_aspell_dict_info_list (config); + elements = aspell_dict_info_list_elements (list); + + weechat_printf (NULL, ""); + weechat_printf (NULL, + /* TRANSLATORS: "%s" is "aspell" */ + _( "%s dictionaries list:"), + ASPELL_PLUGIN_NAME); + + while ((dict = aspell_dict_info_enumeration_next (elements)) != NULL) + { + country = NULL; + pos = strchr (dict->code, '_'); + + if (pos) + { + pos[0] = '\0'; + lang = weechat_aspell_command_iso_to_lang ((char*)dict->code); + pos[0] = '_'; + country = weechat_aspell_command_iso_to_country (pos + 1); + } + else + lang = weechat_aspell_command_iso_to_lang ((char*)dict->code); + + str_country[0] = '\0'; + if (country || dict->jargon[0]) + { + snprintf (str_country, sizeof (str_country), " (%s%s%s)", + (country) ? country : dict->jargon, + (country && dict->jargon[0]) ? " - " : "", + (country && dict->jargon[0]) ? ((dict->jargon[0]) ? dict->jargon : country) : ""); + } + + snprintf (str_dict, sizeof (str_dict), "%-22s %s%s", + dict->name, lang, str_country); + + weechat_printf (NULL, " %s", str_dict); + + if (lang) + free (lang); + if (country) + free (country); + } + + delete_aspell_dict_info_enumeration (elements); + delete_aspell_config (config); +} + +/* + * Sets a list of dictionaries for a buffer. + */ + +void +weechat_aspell_command_set_dict (struct t_gui_buffer *buffer, const char *value) +{ + char *name; + + name = weechat_aspell_build_option_name (buffer); + if (!name) + return; + + if (weechat_aspell_config_set_dict (name, value) > 0) + { + if (value && value[0]) + weechat_printf (NULL, "%s: \"%s\" => %s", + ASPELL_PLUGIN_NAME, name, value); + else + weechat_printf (NULL, _("%s: \"%s\" removed"), + ASPELL_PLUGIN_NAME, name); + } + + free (name); +} + +/* + * Adds a word in personal dictionary. + */ + +void +weechat_aspell_command_add_word (struct t_gui_buffer *buffer, const char *dict, + const char *word) +{ + struct t_aspell_speller_buffer *ptr_speller_buffer; + AspellSpeller *new_speller, *ptr_speller; + + new_speller = NULL; + + if (dict) + { + ptr_speller = weechat_hashtable_get (weechat_aspell_spellers, dict); + if (!ptr_speller) + { + if (!weechat_aspell_speller_dict_supported (dict)) + { + weechat_printf (NULL, + _("%s: error: dictionary \"%s\" is not " + "available on your system"), + ASPELL_PLUGIN_NAME, dict); + return; + } + new_speller = weechat_aspell_speller_new (dict); + if (!new_speller) + return; + ptr_speller = new_speller; + } + } + else + { + ptr_speller_buffer = weechat_hashtable_get (weechat_aspell_speller_buffer, + buffer); + if (!ptr_speller_buffer) + ptr_speller_buffer = weechat_aspell_speller_buffer_new (buffer); + if (!ptr_speller_buffer) + goto error; + if (!ptr_speller_buffer->spellers || !ptr_speller_buffer->spellers[0]) + { + weechat_printf (NULL, + _("%s%s: no dictionary on this buffer for " + "adding word"), + weechat_prefix ("error"), + ASPELL_PLUGIN_NAME); + return; + } + else if (ptr_speller_buffer->spellers[1]) + { + weechat_printf (NULL, + _("%s%s: many dictionaries are defined for " + "this buffer, please specify dictionary"), + weechat_prefix ("error"), + ASPELL_PLUGIN_NAME); + return; + } + ptr_speller = ptr_speller_buffer->spellers[0]; + } + + if (aspell_speller_add_to_personal (ptr_speller, + word, + strlen (word)) == 1) + { + weechat_printf (NULL, + _("%s: word \"%s\" added to personal dictionary"), + ASPELL_PLUGIN_NAME, word); + } + else + goto error; + + goto end; + +error: + weechat_printf (NULL, + _("%s%s: failed to add word to personal " + "dictionary"), + weechat_prefix ("error"), ASPELL_PLUGIN_NAME); + +end: + if (new_speller) + weechat_hashtable_remove (weechat_aspell_spellers, dict); +} + +/* + * Callback for command "/aspell". + */ + +int +weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer, + int argc, char **argv, char **argv_eol) +{ + char *dicts; + const char *default_dict; + struct t_infolist *infolist; + int number; + + /* make C compiler happy */ + (void) data; + + if (argc == 1) + { + /* display aspell status */ + weechat_printf (NULL, ""); + weechat_printf (NULL, "%s", + (aspell_enabled) ? + _("Aspell is enabled") : _("Aspell is disabled")); + default_dict = weechat_config_string (weechat_aspell_config_check_default_dict); + weechat_printf (NULL, + _("Default dictionary: %s"), + (default_dict && default_dict[0]) ? + default_dict : _("(not set)")); + number = 0; + infolist = weechat_infolist_get ("option", NULL, "aspell.dict.*"); + if (infolist) + { + while (weechat_infolist_next (infolist)) + { + if (number == 0) + weechat_printf (NULL, _("Specific dictionaries on buffers:")); + number++; + weechat_printf (NULL, " %s: %s", + weechat_infolist_string (infolist, "option_name"), + weechat_infolist_string (infolist, "value")); + } + weechat_infolist_free (infolist); + } + return WEECHAT_RC_OK; + } + + /* enable aspell */ + if (weechat_strcasecmp (argv[1], "enable") == 0) + { + weechat_config_option_set (weechat_aspell_config_check_enabled, "1", 1); + weechat_printf (NULL, _("Aspell enabled")); + return WEECHAT_RC_OK; + } + + /* disable aspell */ + if (weechat_strcasecmp (argv[1], "disable") == 0) + { + weechat_config_option_set (weechat_aspell_config_check_enabled, "0", 1); + weechat_printf (NULL, _("Aspell disabled")); + return WEECHAT_RC_OK; + } + + /* toggle aspell */ + if (weechat_strcasecmp (argv[1], "toggle") == 0) + { + if (aspell_enabled) + { + weechat_config_option_set (weechat_aspell_config_check_enabled, "0", 1); + weechat_printf (NULL, _("Aspell disabled")); + } + else + { + weechat_config_option_set (weechat_aspell_config_check_enabled, "1", 1); + weechat_printf (NULL, _("Aspell enabled")); + } + return WEECHAT_RC_OK; + } + + /* list of dictionaries */ + if (weechat_strcasecmp (argv[1], "listdict") == 0) + { + weechat_aspell_command_speller_list_dicts (); + return WEECHAT_RC_OK; + } + + /* set dictionary for current buffer */ + if (weechat_strcasecmp (argv[1], "setdict") == 0) + { + if (argc > 2) + { + dicts = weechat_string_replace (argv_eol[2], " ", ""); + weechat_aspell_command_set_dict (buffer, + (dicts) ? dicts : argv[2]); + if (dicts) + free (dicts); + } + return WEECHAT_RC_OK; + } + + /* delete dictionary used on current buffer */ + if (weechat_strcasecmp (argv[1], "deldict") == 0) + { + weechat_aspell_command_set_dict (buffer, NULL); + return WEECHAT_RC_OK; + } + + /* add word to personal dictionary */ + if (weechat_strcasecmp (argv[1], "addword") == 0) + { + if (argc > 3) + weechat_aspell_command_add_word (buffer, argv[2], argv_eol[3]); + else + weechat_aspell_command_add_word (buffer, NULL, argv_eol[2]); + return WEECHAT_RC_OK; + } + + return WEECHAT_RC_ERROR; +} + +/* + * Hooks aspell command. + */ + +void +weechat_aspell_command_init () +{ + weechat_hook_command ("aspell", + N_("aspell plugin configuration"), + N_("enable|disable|toggle" + " || listdict" + " || setdict [,...]" + " || deldict" + " || addword [] "), + N_(" enable: enable aspell\n" + " disable: disable aspell\n" + " toggle: toggle aspell\n" + "listdict: show installed dictionaries\n" + " setdict: set dictionary for current buffer " + "(multiple dictionaries can be separated by a " + "comma)\n" + " deldict: delete dictionary used on current " + "buffer\n" + " addword: add a word in personal aspell " + "dictionary\n" + "\n" + "Input line beginning with a '/' is not checked, " + "except for some commands (see /set " + "aspell.check.commands).\n\n" + "To enable aspell on all buffers, use option " + "\"default_dict\", then enable aspell, for " + "example:\n" + " /set aspell.check.default_dict \"en\"\n" + " /aspell enable\n\n" + "Default key to toggle aspell is alt-s."), + "enable" + " || disable" + " || toggle" + " || listdict" + " || setdict %(aspell_dicts)" + " || deldict" + " || addword", + &weechat_aspell_command_cb, NULL); +} diff --git a/src/plugins/aspell/weechat-aspell-command.h b/src/plugins/aspell/weechat-aspell-command.h new file mode 100644 index 000000000..f24bc7790 --- /dev/null +++ b/src/plugins/aspell/weechat-aspell-command.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2013 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see . + */ + +#ifndef __WEECHAT_ASPELL_COMMAND_H +#define __WEECHAT_ASPELL_COMMAND_H 1 + +extern void weechat_aspell_command_init (); + +#endif /* __WEECHAT_ASPELL_COMMAND_H */ diff --git a/src/plugins/aspell/weechat-aspell-completion.c b/src/plugins/aspell/weechat-aspell-completion.c new file mode 100644 index 000000000..36ccf24f6 --- /dev/null +++ b/src/plugins/aspell/weechat-aspell-completion.c @@ -0,0 +1,106 @@ +/* + * weechat-aspell-completion.c - completion for aspell commands + * + * Copyright (C) 2013 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see . + */ + +#include +#include +#include + +#include "../weechat-plugin.h" +#include "weechat-aspell.h" + + +/* + * Adds aspell langs (all langs, even for dictionaries not installed) to + * completion list. + */ + +int +weechat_aspell_completion_langs_cb (void *data, const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + int i; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (i = 0; aspell_langs[i].code; i++) + { + weechat_hook_completion_list_add (completion, + aspell_langs[i].code, + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * Adds aspell dictionaries (only installed dictionaries) to completion list. + */ + +int +weechat_aspell_completion_dicts_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct AspellConfig *config; + AspellDictInfoList *list; + AspellDictInfoEnumeration *elements; + const AspellDictInfo *dict; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + config = new_aspell_config (); + list = get_aspell_dict_info_list (config); + elements = aspell_dict_info_list_elements (list); + + while ((dict = aspell_dict_info_enumeration_next (elements)) != NULL) + { + weechat_hook_completion_list_add (completion, dict->name, + 0, WEECHAT_LIST_POS_SORT); + } + + delete_aspell_dict_info_enumeration (elements); + delete_aspell_config (config); + + return WEECHAT_RC_OK; +} + +/* + * Hooks completion. + */ + +void +weechat_aspell_completion_init () +{ + weechat_hook_completion ("aspell_langs", + N_("list of all languages supported by aspell"), + &weechat_aspell_completion_langs_cb, NULL); + weechat_hook_completion ("aspell_dicts", + N_("list of aspell installed dictionaries"), + &weechat_aspell_completion_dicts_cb, NULL); +} diff --git a/src/plugins/aspell/weechat-aspell-completion.h b/src/plugins/aspell/weechat-aspell-completion.h new file mode 100644 index 000000000..96010a5aa --- /dev/null +++ b/src/plugins/aspell/weechat-aspell-completion.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2013 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see . + */ + +#ifndef __WEECHAT_ASPELL_COMPLETION_H +#define __WEECHAT_ASPELL_COMPLETION_H 1 + +extern void weechat_aspell_completion_init (); + +#endif /* __WEECHAT_ASPELL_COMPLETION_H */ diff --git a/src/plugins/aspell/weechat-aspell-config.c b/src/plugins/aspell/weechat-aspell-config.c index c7a6e9a6a..2301f91a5 100644 --- a/src/plugins/aspell/weechat-aspell-config.c +++ b/src/plugins/aspell/weechat-aspell-config.c @@ -33,6 +33,8 @@ struct t_config_file *weechat_aspell_config_file = NULL; struct t_config_section *weechat_aspell_config_section_dict = NULL; +int weechat_aspell_config_loading = 0; + /* aspell config, look section */ struct t_config_option *weechat_aspell_config_look_color; @@ -110,7 +112,9 @@ weechat_aspell_config_change_default_dict (void *data, (void) data; (void) option; - weechat_aspell_create_spellers (weechat_current_buffer ()); + weechat_hashtable_remove_all (weechat_aspell_speller_buffer); + if (!weechat_aspell_config_loading) + weechat_aspell_speller_remove_unused (); } /* @@ -157,7 +161,9 @@ weechat_aspell_config_dict_change (void *data, (void) data; (void) option; - weechat_aspell_create_spellers (weechat_current_buffer ()); + weechat_hashtable_remove_all (weechat_aspell_speller_buffer); + if (!weechat_aspell_config_loading) + weechat_aspell_speller_remove_unused (); } /* @@ -177,7 +183,9 @@ weechat_aspell_config_dict_delete_option (void *data, weechat_config_option_free (option); - weechat_aspell_create_spellers (weechat_current_buffer ()); + weechat_hashtable_remove_all (weechat_aspell_speller_buffer); + if (!weechat_aspell_config_loading) + weechat_aspell_speller_remove_unused (); return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED; } @@ -211,7 +219,7 @@ weechat_aspell_config_dict_create_option (void *data, if (ptr_option) { if (value && value[0]) - rc = weechat_config_option_set (ptr_option, value, 1); + rc = weechat_config_option_set (ptr_option, value, 0); else { weechat_config_option_free (ptr_option); @@ -246,7 +254,11 @@ weechat_aspell_config_dict_create_option (void *data, option_name, value); } else - weechat_aspell_create_spellers (weechat_current_buffer ()); + { + weechat_hashtable_remove_all (weechat_aspell_speller_buffer); + if (!weechat_aspell_config_loading) + weechat_aspell_speller_remove_unused (); + } return rc; } @@ -263,8 +275,9 @@ weechat_aspell_config_option_change (void *data, (void) data; (void) option; - weechat_aspell_speller_free_all (); - weechat_aspell_create_spellers (weechat_current_buffer ()); + weechat_hashtable_remove_all (weechat_aspell_speller_buffer); + if (!weechat_aspell_config_loading) + weechat_aspell_speller_remove_unused (); } /* @@ -284,8 +297,9 @@ weechat_aspell_config_option_delete_option (void *data, weechat_config_option_free (option); - weechat_aspell_speller_free_all (); - weechat_aspell_create_spellers (weechat_current_buffer ()); + weechat_hashtable_remove_all (weechat_aspell_speller_buffer); + if (!weechat_aspell_config_loading) + weechat_aspell_speller_remove_unused (); return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED; } @@ -353,8 +367,9 @@ weechat_aspell_config_option_create_option (void *data, } else { - weechat_aspell_speller_free_all (); - weechat_aspell_create_spellers (weechat_current_buffer ()); + weechat_hashtable_remove_all (weechat_aspell_speller_buffer); + if (!weechat_aspell_config_loading) + weechat_aspell_speller_remove_unused (); } return rc; @@ -525,12 +540,15 @@ weechat_aspell_config_read () { int rc; + weechat_aspell_config_loading = 1; rc = weechat_config_read (weechat_aspell_config_file); + weechat_aspell_config_loading = 0; if (rc == WEECHAT_CONFIG_READ_OK) { weechat_aspell_config_change_commands (NULL, weechat_aspell_config_check_commands); } + weechat_aspell_speller_remove_unused (); return rc; } diff --git a/src/plugins/aspell/weechat-aspell-info.c b/src/plugins/aspell/weechat-aspell-info.c new file mode 100644 index 000000000..5b3614aa6 --- /dev/null +++ b/src/plugins/aspell/weechat-aspell-info.c @@ -0,0 +1,89 @@ +/* + * weechat-aspell-info.c - info for aspell plugin + * + * Copyright (C) 2013 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see . + */ + +#include +#include +#include + +#include "../weechat-plugin.h" +#include "weechat-aspell.h" + + +/* + * Returns aspell info. + */ + +const char * +weechat_aspell_info_get_info_cb (void *data, const char *info_name, + const char *arguments) +{ + int rc; + long unsigned int value; + struct t_gui_buffer *buffer; + const char *buffer_full_name; + + /* make C compiler happy */ + (void) data; + + if (weechat_strcasecmp (info_name, "aspell_dict") == 0) + { + if (arguments) + { + buffer_full_name = NULL; + if (strncmp (arguments, "0x", 2) == 0) + { + rc = sscanf (arguments, "%lx", &value); + if ((rc != EOF) && (rc != 0)) + { + buffer = (struct t_gui_buffer *)value; + if (buffer) + { + buffer_full_name = weechat_buffer_get_string (buffer, + "full_name"); + } + } + } + else + buffer_full_name = arguments; + + if (buffer_full_name) + return weechat_aspell_get_dict_with_buffer_name (buffer_full_name); + } + return NULL; + } + + return NULL; +} + +/* + * Hooks info for aspell plugin. + */ + +void +weechat_aspell_info_init () +{ + /* info hooks */ + weechat_hook_info ("aspell_dict", + N_("comma-separated list of dictionaries used in buffer"), + N_("buffer pointer (\"0x12345678\") or buffer full name " + "(\"irc.freenode.#weechat\")"), + &weechat_aspell_info_get_info_cb, NULL); +} diff --git a/src/plugins/aspell/weechat-aspell-info.h b/src/plugins/aspell/weechat-aspell-info.h new file mode 100644 index 000000000..aa0bcdf9c --- /dev/null +++ b/src/plugins/aspell/weechat-aspell-info.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2013 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see . + */ + +#ifndef __WEECHAT_ASPELL_INFO_H +#define __WEECHAT_ASPELL_INFO_H 1 + +extern void weechat_aspell_info_init (); + +#endif /* __WEECHAT_ASPELL_INFO_H */ diff --git a/src/plugins/aspell/weechat-aspell-speller.c b/src/plugins/aspell/weechat-aspell-speller.c index bb12d9745..0b674b4b8 100644 --- a/src/plugins/aspell/weechat-aspell-speller.c +++ b/src/plugins/aspell/weechat-aspell-speller.c @@ -26,22 +26,32 @@ #include "../weechat-plugin.h" #include "weechat-aspell.h" #include "weechat-aspell-speller.h" - - -struct t_aspell_speller *weechat_aspell_spellers = NULL; -struct t_aspell_speller *last_weechat_aspell_speller = NULL; +#include "weechat-aspell-config.h" /* - * Checks if an aspell dictionary exists for a lang. + * spellers: one by dictionary (key is name of dictionary (eg: "fr"), value is + * pointer on AspellSpeller) + */ +struct t_hashtable *weechat_aspell_spellers = NULL; + +/* + * spellers by buffer (key is buffer pointer, value is pointer on + * struct t_aspell_speller_buffer) + */ +struct t_hashtable *weechat_aspell_speller_buffer = NULL; + + +/* + * Checks if an aspell dictionary is supported (installed on system). * * Returns: - * 1: aspell dict exists for the lang - * 0: aspell dict does not exist for the lang + * 1: aspell dict is supported + * 0: aspell dict is NOT supported */ int -weechat_aspell_speller_exists (const char *lang) +weechat_aspell_speller_dict_supported (const char *lang) { struct AspellConfig *config; AspellDictInfoList *list; @@ -90,7 +100,7 @@ weechat_aspell_speller_check_dictionaries (const char *dict_list) { for (i = 0; i < argc; i++) { - if (!weechat_aspell_speller_exists (argv[i])) + if (!weechat_aspell_speller_dict_supported (argv[i])) { weechat_printf (NULL, _("%s: warning: dictionary \"%s\" is not " @@ -104,39 +114,17 @@ weechat_aspell_speller_check_dictionaries (const char *dict_list) } /* - * Searches for a speller by lang. + * Creates and adds a new speller instance in the hashtable. * - * Returns pointer to speller found, NULL if not found. + * Returns pointer to new aspell speller, NULL if error. */ -struct t_aspell_speller * -weechat_aspell_speller_search (const char *lang) -{ - struct t_aspell_speller *ptr_speller; - - for (ptr_speller = weechat_aspell_spellers; ptr_speller; - ptr_speller = ptr_speller->next_speller) - { - if (strcmp (ptr_speller->lang, lang) == 0) - return ptr_speller; - } - - /* no speller found */ - return NULL; -} - -/* - * Creates and adds a new speller instance. - * - * Returns pointer to new speller, NULL if error. - */ - -struct t_aspell_speller * +AspellSpeller * weechat_aspell_speller_new (const char *lang) { - struct t_aspell_speller *new_speller; AspellConfig *config; AspellCanHaveError *ret; + AspellSpeller *new_speller; struct t_infolist *infolist; if (!lang) @@ -179,27 +167,8 @@ weechat_aspell_speller_new (const char *lang) return NULL; } - /* create and add a new speller cell */ - new_speller = malloc (sizeof (*new_speller)); - if (!new_speller) - { - weechat_printf (NULL, - _("%s%s: not enough memory to create new speller"), - weechat_prefix ("error"), ASPELL_PLUGIN_NAME); - return NULL; - } - - new_speller->speller = to_aspell_speller (ret); - new_speller->lang = strdup (lang); - - /* add speller to list */ - new_speller->prev_speller = last_weechat_aspell_speller; - new_speller->next_speller = NULL; - if (weechat_aspell_spellers) - last_weechat_aspell_speller->next_speller = new_speller; - else - weechat_aspell_spellers = new_speller; - last_weechat_aspell_speller = new_speller; + new_speller = to_aspell_speller (ret); + weechat_hashtable_set (weechat_aspell_spellers, lang, new_speller); /* free configuration */ delete_aspell_config (config); @@ -207,54 +176,260 @@ weechat_aspell_speller_new (const char *lang) return new_speller; } +void +weechat_aspell_speller_add_dicts_to_hash (struct t_hashtable *hashtable, + const char *dict) +{ + char **dicts; + int num_dicts, i; + + if (!dict || !dict[0]) + return; + + dicts = weechat_string_split (dict, ",", 0, 0, &num_dicts); + if (dicts) + { + for (i = 0; i < num_dicts; i++) + { + weechat_hashtable_set (hashtable, dicts[i], NULL); + } + weechat_string_free_split (dicts); + } +} + /* - * Removes a speller instance. + * Removes a speller if it is NOT in hashtable "used_spellers". */ void -weechat_aspell_speller_free (struct t_aspell_speller *speller) +weechat_aspell_speller_remove_unused_cb (void *data, + struct t_hashtable *hashtable, + const void *key, const void *value) { - if (!speller) + struct t_hashtable *used_spellers; + + /* make C compiler happy */ + (void) value; + + used_spellers = (struct t_hashtable *)data; + + /* if speller is not in "used_spellers", remove it (not used any more) */ + if (!weechat_hashtable_has_key (used_spellers, key)) + weechat_hashtable_remove (hashtable, key); +} + +/* + * Removes unused spellers from hashtable "weechat_aspell_spellers". + */ + +void +weechat_aspell_speller_remove_unused () +{ + struct t_hashtable *used_spellers; + struct t_infolist *infolist; + + if (weechat_aspell_plugin->debug) + { + weechat_printf (NULL, + "%s: removing unused spellers", + ASPELL_PLUGIN_NAME); + } + + /* create a hashtable that will contain all used spellers */ + used_spellers = weechat_hashtable_new (32, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING, + NULL, + NULL); + if (!used_spellers) return; + /* collect used spellers and store them in hashtable "used_spellers" */ + weechat_aspell_speller_add_dicts_to_hash (used_spellers, + weechat_config_string (weechat_aspell_config_check_default_dict)); + infolist = weechat_infolist_get ("option", NULL, "aspell.dict.*"); + if (infolist) + { + while (weechat_infolist_next (infolist)) + { + weechat_aspell_speller_add_dicts_to_hash (used_spellers, + weechat_infolist_string (infolist, "value")); + } + weechat_infolist_free (infolist); + } + + /* + * look at current spellers, and remove spellers that are not in hashtable + * "used_spellers" + */ + weechat_hashtable_map (weechat_aspell_spellers, + &weechat_aspell_speller_remove_unused_cb, + used_spellers); + + weechat_hashtable_free (used_spellers); +} + +/* + * Callback called when a key is removed in hashtable "weechat_aspell_spellers". + */ + +void +weechat_aspell_speller_free_value_cb (struct t_hashtable *hashtable, + const void *key, void *value) +{ + AspellSpeller *ptr_speller; + + /* make C compiler happy */ + (void) hashtable; + if (weechat_aspell_plugin->debug) { weechat_printf (NULL, "%s: removing speller for lang \"%s\"", - ASPELL_PLUGIN_NAME, speller->lang); + ASPELL_PLUGIN_NAME, (const char *)key); } - /* free data */ - if (speller->speller) - { - aspell_speller_save_all_word_lists (speller->speller); - delete_aspell_speller (speller->speller); - } - if (speller->lang) - free (speller->lang); - - /* remove speller from list */ - if (speller->prev_speller) - (speller->prev_speller)->next_speller = speller->next_speller; - if (speller->next_speller) - (speller->next_speller)->prev_speller = speller->prev_speller; - if (weechat_aspell_spellers == speller) - weechat_aspell_spellers = speller->next_speller; - if (last_weechat_aspell_speller == speller) - last_weechat_aspell_speller = speller->prev_speller; - - free (speller); + /* free aspell data */ + ptr_speller = (AspellSpeller *)value; + aspell_speller_save_all_word_lists (ptr_speller); + delete_aspell_speller (ptr_speller); } /* - * Frees all spellers. + * Creates a structure for buffer speller info in hashtable + * "weechat_aspell_buffer_spellers". + */ + +struct t_aspell_speller_buffer * +weechat_aspell_speller_buffer_new (struct t_gui_buffer *buffer) +{ + const char *buffer_dicts; + char **dicts; + int num_dicts, i; + struct t_aspell_speller_buffer *new_speller_buffer; + AspellSpeller *ptr_speller; + + if (!buffer) + return NULL; + + weechat_hashtable_remove (weechat_aspell_speller_buffer, buffer); + + new_speller_buffer = malloc (sizeof (*new_speller_buffer)); + if (!new_speller_buffer) + return NULL; + + new_speller_buffer->spellers = NULL; + new_speller_buffer->modifier_string = NULL; + new_speller_buffer->input_pos = -1; + new_speller_buffer->modifier_result = NULL; + + buffer_dicts = weechat_aspell_get_dict (buffer); + if (buffer_dicts) + { + dicts = weechat_string_split (buffer_dicts, ",", 0, 0, &num_dicts); + if (dicts && (num_dicts > 0)) + { + new_speller_buffer->spellers = + malloc ((num_dicts + 1) * sizeof (AspellSpeller *)); + if (new_speller_buffer->spellers) + { + for (i = 0; i < num_dicts; i++) + { + ptr_speller = weechat_hashtable_get (weechat_aspell_spellers, + dicts[i]); + if (!ptr_speller) + ptr_speller = weechat_aspell_speller_new (dicts[i]); + new_speller_buffer->spellers[i] = ptr_speller; + } + new_speller_buffer->spellers[num_dicts] = NULL; + } + } + if (dicts) + weechat_string_free_split (dicts); + } + + weechat_hashtable_set (weechat_aspell_speller_buffer, + buffer, + new_speller_buffer); + + weechat_bar_item_update ("aspell_dict"); + + return new_speller_buffer; +} + +/* + * Callback called when a key is removed in hashtable + * "weechat_aspell_speller_buffer". */ void -weechat_aspell_speller_free_all () +weechat_aspell_speller_buffer_free_value_cb (struct t_hashtable *hashtable, + const void *key, void *value) { - while (weechat_aspell_spellers) - { - weechat_aspell_speller_free (weechat_aspell_spellers); - } + struct t_aspell_speller_buffer *ptr_speller_buffer; + + /* make C compiler happy */ + (void) hashtable; + (void) key; + + ptr_speller_buffer = (struct t_aspell_speller_buffer *)value; + + if (ptr_speller_buffer->spellers) + free (ptr_speller_buffer->spellers); + if (ptr_speller_buffer->modifier_string) + free (ptr_speller_buffer->modifier_string); + if (ptr_speller_buffer->modifier_result) + free (ptr_speller_buffer->modifier_result); + + free (ptr_speller_buffer); +} + +/* + * Initializes spellers (creates hashtables). + * + * Returns: + * 1: OK (hashtables created) + * 0: error (not enough memory) + */ + +int +weechat_aspell_speller_init () +{ + weechat_aspell_spellers = weechat_hashtable_new (32, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_POINTER, + NULL, + NULL); + if (!weechat_aspell_spellers) + return 0; + weechat_hashtable_set_pointer (weechat_aspell_spellers, + "callback_free_value", + &weechat_aspell_speller_free_value_cb); + + weechat_aspell_speller_buffer = weechat_hashtable_new (32, + WEECHAT_HASHTABLE_POINTER, + WEECHAT_HASHTABLE_POINTER, + NULL, + NULL); + if (!weechat_aspell_speller_buffer) + { + weechat_hashtable_free (weechat_aspell_spellers); + return 0; + } + weechat_hashtable_set_pointer (weechat_aspell_speller_buffer, + "callback_free_value", + &weechat_aspell_speller_buffer_free_value_cb); + + return 1; +} + +/* + * Ends spellers (removes hashtables). + */ + +void +weechat_aspell_speller_end () +{ + weechat_hashtable_free (weechat_aspell_spellers); + weechat_hashtable_free (weechat_aspell_speller_buffer); } diff --git a/src/plugins/aspell/weechat-aspell-speller.h b/src/plugins/aspell/weechat-aspell-speller.h index 212be88b0..15c67564a 100644 --- a/src/plugins/aspell/weechat-aspell-speller.h +++ b/src/plugins/aspell/weechat-aspell-speller.h @@ -21,22 +21,23 @@ #ifndef __WEECHAT_ASPELL_SPELLER_H #define __WEECHAT_ASPELL_SPELLER_H 1 -struct t_aspell_speller +struct t_aspell_speller_buffer { - AspellSpeller *speller; /* aspell speller */ - char *lang; /* language */ - - struct t_aspell_speller *prev_speller; /* pointer to next speller */ - struct t_aspell_speller *next_speller; /* pointer to previous speller */ + AspellSpeller **spellers; /* pointer to spellers for buf. */ + char *modifier_string; /* last modifier string */ + int input_pos; /* position of cursor in input */ + char *modifier_result; /* last modifier result */ }; -extern struct t_aspell_speller *weechat_aspell_spellers; +extern struct t_hashtable *weechat_aspell_spellers; +extern struct t_hashtable *weechat_aspell_speller_buffer; -extern int weechat_aspell_speller_exists (const char *lang); -extern struct t_aspell_speller *weechat_aspell_speller_search (const char *lang); +extern int weechat_aspell_speller_dict_supported (const char *lang); extern void weechat_aspell_speller_check_dictionaries (const char *dict_list); -extern struct t_aspell_speller *weechat_aspell_speller_new (const char *lang); -extern void weechat_aspell_speller_free (struct t_aspell_speller *speller); -extern void weechat_aspell_speller_free_all (); +extern AspellSpeller *weechat_aspell_speller_new (const char *lang); +extern void weechat_aspell_speller_remove_unused (); +extern struct t_aspell_speller_buffer *weechat_aspell_speller_buffer_new (struct t_gui_buffer *buffer); +extern int weechat_aspell_speller_init (); +extern void weechat_aspell_speller_end (); #endif /* __WEECHAT_ASPELL_SPELLER_H */ diff --git a/src/plugins/aspell/weechat-aspell.c b/src/plugins/aspell/weechat-aspell.c index 9dd03f3a0..df50ffd92 100644 --- a/src/plugins/aspell/weechat-aspell.c +++ b/src/plugins/aspell/weechat-aspell.c @@ -30,7 +30,10 @@ #include "../weechat-plugin.h" #include "weechat-aspell.h" #include "weechat-aspell-bar-item.h" +#include "weechat-aspell-command.h" +#include "weechat-aspell-completion.h" #include "weechat-aspell-config.h" +#include "weechat-aspell-info.h" #include "weechat-aspell-speller.h" @@ -43,18 +46,13 @@ WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); struct t_weechat_plugin *weechat_aspell_plugin = NULL; int aspell_enabled = 0; -struct t_gui_buffer *aspell_buffer_spellers = NULL; - -char *aspell_last_modifier_string = NULL; /* last str. received by modifier */ -int aspell_last_buffer_input_pos = -1; /* last cursor position */ -char *aspell_last_modifier_result = NULL; /* last str. built by modifier */ /* - * aspell supported langs, updated on 2012-07-05 + * aspell supported languages, updated on 2012-07-05 * URL: ftp://ftp.gnu.org/gnu/aspell/dict/0index.html */ -struct t_aspell_code aspell_langs_avail[] = +struct t_aspell_code aspell_langs[] = { { "af", "Afrikaans" }, { "am", "Amharic" }, @@ -150,7 +148,7 @@ struct t_aspell_code aspell_langs_avail[] = { NULL, NULL} }; -struct t_aspell_code aspell_countries_avail[] = +struct t_aspell_code aspell_countries[] = { { "AT", "Austria" }, { "BR", "Brazil" }, @@ -201,19 +199,18 @@ weechat_aspell_build_option_name (struct t_gui_buffer *buffer) } /* - * Gets dictionary list for a buffer. + * Gets dictionary list for a name of buffer. * * First tries with all arguments, then removes one by one to find dict (from * specific to general dict). */ const char * -weechat_aspell_get_dict (struct t_gui_buffer *buffer) +weechat_aspell_get_dict_with_buffer_name (const char *name) { - char *name, *option_name, *ptr_end; + char *option_name, *ptr_end; struct t_config_option *ptr_option; - name = weechat_aspell_build_option_name (buffer); if (!name) return NULL; @@ -227,7 +224,6 @@ weechat_aspell_get_dict (struct t_gui_buffer *buffer) if (ptr_option) { free (option_name); - free (name); return weechat_config_string (ptr_option); } ptr_end--; @@ -241,297 +237,44 @@ weechat_aspell_get_dict (struct t_gui_buffer *buffer) ptr_option = weechat_aspell_config_get_dict (option_name); free (option_name); - free (name); if (ptr_option) return weechat_config_string (ptr_option); } - else - free (name); /* nothing found => return default dictionary (if set) */ if (weechat_config_string (weechat_aspell_config_check_default_dict) && weechat_config_string (weechat_aspell_config_check_default_dict)[0]) + { return weechat_config_string (weechat_aspell_config_check_default_dict); + } /* no default dictionary set */ return NULL; } /* - * Sets a list of dictionaries for a buffer. + * Gets dictionary list for a buffer. + * + * First tries with all arguments, then removes one by one to find dict (from + * specific to general dict). */ -void -weechat_aspell_set_dict (struct t_gui_buffer *buffer, const char *value) +const char * +weechat_aspell_get_dict (struct t_gui_buffer *buffer) { char *name; + const char *dict; name = weechat_aspell_build_option_name (buffer); if (!name) - return; + return NULL; - if (weechat_aspell_config_set_dict (name, value) > 0) - { - if (value && value[0]) - weechat_printf (NULL, "%s: \"%s\" => %s", - ASPELL_PLUGIN_NAME, name, value); - else - weechat_printf (NULL, _("%s: \"%s\" removed"), - ASPELL_PLUGIN_NAME, name); - } + dict = weechat_aspell_get_dict_with_buffer_name (name); free (name); -} -/* - * Checks if current spellers are already OK. - * - * Returns: - * 1: already OK - * 0: spellers must be changed - */ - -int -weechat_aspell_spellers_already_ok (const char *dict_list) -{ - char **argv; - int argc, rc, i; - struct t_aspell_speller *ptr_speller; - - if (!dict_list && !weechat_aspell_spellers) - return 1; - - if (!dict_list || !weechat_aspell_spellers) - return 0; - - rc = 1; - - argv = weechat_string_split (dict_list, ",", 0, 0, &argc); - if (argv) - { - ptr_speller = weechat_aspell_spellers; - for (i = 0; i < argc; i++) - { - if (!ptr_speller) - { - rc = 0; - break; - } - if (strcmp (ptr_speller->lang, argv[i]) != 0) - { - rc = 0; - break; - } - ptr_speller = ptr_speller->next_speller; - } - if (ptr_speller) - rc = 0; - weechat_string_free_split (argv); - } - - return rc; -} - -/* - * Creates spellers for a buffer. - */ - -void -weechat_aspell_create_spellers (struct t_gui_buffer *buffer) -{ - const char *dict_list; - char **argv; - int argc, i; - - if (!buffer) - return; - - dict_list = weechat_aspell_get_dict (buffer); - if (!weechat_aspell_spellers_already_ok (dict_list)) - { - weechat_aspell_speller_free_all (); - if (dict_list) - { - argv = weechat_string_split (dict_list, ",", 0, 0, &argc); - if (argv) - { - for (i = 0; i < argc; i++) - { - weechat_aspell_speller_new (argv[i]); - } - weechat_string_free_split (argv); - } - } - weechat_bar_item_update ("aspell_dict"); - } -} - -/* - * Converts an aspell ISO lang code in its English full name. - * - * Note: result must be freed after use. - */ - -char * -weechat_aspell_iso_to_lang (const char *code) -{ - int i; - - for (i = 0; aspell_langs_avail[i].code; i++) - { - if (strcmp (aspell_langs_avail[i].code, code) == 0) - return strdup (aspell_langs_avail[i].name); - } - - /* lang code not found */ - return strdup ("Unknown"); -} - -/* - * Converts an aspell ISO country code in its English full name. - * - * Note: result must be freed after use. - */ - -char * -weechat_aspell_iso_to_country (const char *code) -{ - int i; - - for (i = 0; aspell_countries_avail[i].code; i++) - { - if (strcmp (aspell_countries_avail[i].code, code) == 0) - return strdup (aspell_countries_avail[i].name); - } - - /* country code not found */ - return strdup ("Unknown"); -} - -/* - * Displays list of aspell dictionaries installed on system. - */ - -void -weechat_aspell_speller_list_dicts () -{ - char *country, *lang, *pos; - char buffer[192]; - struct AspellConfig *config; - AspellDictInfoList *list; - AspellDictInfoEnumeration *elements; - const AspellDictInfo *dict; - - config = new_aspell_config(); - list = get_aspell_dict_info_list (config); - elements = aspell_dict_info_list_elements (list); - - weechat_printf (NULL, ""); - weechat_printf (NULL, - /* TRANSLATORS: "%s" is "aspell" */ - _( "%s dictionaries list:"), - ASPELL_PLUGIN_NAME); - - while ((dict = aspell_dict_info_enumeration_next (elements)) != NULL) - { - country = NULL; - pos = strchr (dict->code, '_'); - - if (pos) - { - pos[0] = '\0'; - lang = weechat_aspell_iso_to_lang ((char*)dict->code); - pos[0] = '_'; - country = weechat_aspell_iso_to_country (pos + 1); - } - else - lang = weechat_aspell_iso_to_lang ((char*)dict->code); - - if (strlen (dict->jargon) == 0) - { - if (pos) - { - snprintf (buffer, sizeof (buffer), "%-22s %s (%s)", - dict->name, lang, country); - } - else - { - snprintf (buffer, sizeof (buffer), "%-22s %s", - dict->name, lang); - } - } - else - { - if (pos) - { - snprintf (buffer, sizeof (buffer), "%-22s %s (%s - %s)", - dict->name, lang, country, dict->jargon); - } - else - { - snprintf (buffer, sizeof (buffer), "%-22s %s (%s)", - dict->name, lang, dict->jargon); - } - } - - weechat_printf (NULL, " %s", buffer); - - if (lang) - free (lang); - if (country) - free (country); - } - - delete_aspell_dict_info_enumeration (elements); - delete_aspell_config (config); -} - -/* - * Adds a word in personal dictionary. - */ - -void -weechat_aspell_add_word (const char *lang, const char *word) -{ - struct t_aspell_speller *new_speller, *ptr_speller; - - new_speller = NULL; - ptr_speller = weechat_aspell_speller_search (lang); - if (!ptr_speller) - { - if (!weechat_aspell_speller_exists (lang)) - { - weechat_printf (NULL, - _("%s: error: dictionary \"%s\" is not " - "available on your system"), - ASPELL_PLUGIN_NAME, lang); - return; - } - new_speller = weechat_aspell_speller_new (lang); - if (!new_speller) - return; - ptr_speller = new_speller; - } - - if (aspell_speller_add_to_personal (ptr_speller->speller, - word, - strlen (word)) == 1) - { - weechat_printf (NULL, - _("%s: word \"%s\" added to personal dictionary"), - ASPELL_PLUGIN_NAME, word); - } - else - { - weechat_printf (NULL, - _("%s%s: failed to add word to personal " - "dictionary"), - weechat_prefix ("error"), ASPELL_PLUGIN_NAME); - } - - if (new_speller) - weechat_aspell_speller_free (new_speller); + return dict; } /* @@ -628,10 +371,12 @@ weechat_aspell_string_is_simili_number (const char *word) */ int -weechat_aspell_check_word (struct t_gui_buffer *buffer, const char *word) +weechat_aspell_check_word (struct t_gui_buffer *buffer, + struct t_aspell_speller_buffer *speller_buffer, + const char *word) { const char *buffer_type, *buffer_nick, *buffer_channel; - struct t_aspell_speller *ptr_speller; + int i; /* word too small? then do not check word */ if ((weechat_config_integer (weechat_aspell_config_check_word_min_length) > 0) @@ -661,12 +406,12 @@ weechat_aspell_check_word (struct t_gui_buffer *buffer, const char *word) } /* check word with all spellers for this buffer (order is important) */ - for (ptr_speller = weechat_aspell_spellers; ptr_speller; - ptr_speller = ptr_speller->next_speller) + if (speller_buffer->spellers) { - if (aspell_speller_check (ptr_speller->speller, word, -1) == 1) + for (i = 0; speller_buffer->spellers[i]; i++) { - return 1; + if (aspell_speller_check (speller_buffer->spellers[i], word, -1) == 1) + return 1; } } @@ -683,10 +428,10 @@ weechat_aspell_check_word (struct t_gui_buffer *buffer, const char *word) */ char * -weechat_aspell_get_suggestions (const char *word) +weechat_aspell_get_suggestions (struct t_aspell_speller_buffer *speller_buffer, + const char *word) { - struct t_aspell_speller *ptr_speller; - int size, max_suggestions, num_suggestions; + int i, size, max_suggestions, num_suggestions; char *suggestions, *suggestions2; const char *ptr_word; const AspellWordList *list; @@ -702,33 +447,35 @@ weechat_aspell_get_suggestions (const char *word) return NULL; suggestions[0] = '\0'; - for (ptr_speller = weechat_aspell_spellers; ptr_speller; - ptr_speller = ptr_speller->next_speller) + if (speller_buffer->spellers) { - list = aspell_speller_suggest (ptr_speller->speller, word, -1); - if (list) + for (i = 0; speller_buffer->spellers[i]; i++) { - elements = aspell_word_list_elements (list); - num_suggestions = 0; - while ((ptr_word = aspell_string_enumeration_next (elements)) != NULL) + list = aspell_speller_suggest (speller_buffer->spellers[i], word, -1); + if (list) { - size += strlen (ptr_word) + ((suggestions[0]) ? 1 : 0); - suggestions2 = realloc (suggestions, size); - if (!suggestions2) + elements = aspell_word_list_elements (list); + num_suggestions = 0; + while ((ptr_word = aspell_string_enumeration_next (elements)) != NULL) { - free (suggestions); - delete_aspell_string_enumeration (elements); - return NULL; + size += strlen (ptr_word) + ((suggestions[0]) ? 1 : 0); + suggestions2 = realloc (suggestions, size); + if (!suggestions2) + { + free (suggestions); + delete_aspell_string_enumeration (elements); + return NULL; + } + suggestions = suggestions2; + if (suggestions[0]) + strcat (suggestions, (num_suggestions == 0) ? "/" : ","); + strcat (suggestions, ptr_word); + num_suggestions++; + if ((max_suggestions >= 0) && (num_suggestions == max_suggestions)) + break; } - suggestions = suggestions2; - if (suggestions[0]) - strcat (suggestions, (num_suggestions == 0) ? "/" : ","); - strcat (suggestions, ptr_word); - num_suggestions++; - if ((max_suggestions >= 0) && (num_suggestions == max_suggestions)) - break; + delete_aspell_string_enumeration (elements); } - delete_aspell_string_enumeration (elements); } } @@ -752,11 +499,12 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, { long unsigned int value; struct t_gui_buffer *buffer; + struct t_aspell_speller_buffer *ptr_speller_buffer; char *result, *ptr_string, *pos_space, *ptr_end, save_end; char *word_for_suggestions, *old_suggestions, *suggestions; char *word_and_suggestions; const char *color_normal, *color_error, *ptr_suggestions; - int buffer_has_changed, utf8_char_int, char_size; + int utf8_char_int, char_size; int length, index_result, length_word, word_ok; int length_color_normal, length_color_error, rc; int input_pos, current_pos, word_start_pos, word_end_pos; @@ -777,54 +525,54 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, buffer = (struct t_gui_buffer *)value; - buffer_has_changed = 0; - if (buffer != aspell_buffer_spellers) - { - weechat_aspell_create_spellers (buffer); - aspell_buffer_spellers = buffer; - buffer_has_changed = 1; - } - - if (!weechat_aspell_spellers) - return NULL; - - /* check text search only if option is enabled */ + /* check text during search only if option is enabled */ if (weechat_buffer_get_integer (buffer, "text_search") && !weechat_config_boolean (weechat_aspell_config_check_during_search)) return NULL; + /* get structure with speller info for buffer */ + ptr_speller_buffer = weechat_hashtable_get (weechat_aspell_speller_buffer, + buffer); + if (!ptr_speller_buffer) + { + ptr_speller_buffer = weechat_aspell_speller_buffer_new (buffer); + if (!ptr_speller_buffer) + return NULL; + } + if (!ptr_speller_buffer->spellers) + return NULL; + /* * for performance: return last string built if input string is the - * same and cursor position is the same (only if suggestions are enabled) + * same (and cursor position is the same, if suggestions are enabled) */ input_pos = weechat_buffer_get_integer (buffer, "input_pos"); - if (!buffer_has_changed - && aspell_last_modifier_string - && (strcmp (string, aspell_last_modifier_string) == 0) + if (ptr_speller_buffer->modifier_string + && (strcmp (string, ptr_speller_buffer->modifier_string) == 0) && ((weechat_config_integer (weechat_aspell_config_check_suggestions) < 0) - || (input_pos == aspell_last_buffer_input_pos))) + || (input_pos == ptr_speller_buffer->input_pos))) { - return (aspell_last_modifier_result) ? - strdup (aspell_last_modifier_result) : NULL; + return (ptr_speller_buffer->modifier_result) ? + strdup (ptr_speller_buffer->modifier_result) : NULL; } /* free last modifier string and result */ - if (aspell_last_modifier_string) + if (ptr_speller_buffer->modifier_string) { - free (aspell_last_modifier_string); - aspell_last_modifier_string = NULL; + free (ptr_speller_buffer->modifier_string); + ptr_speller_buffer->modifier_string = NULL; } - if (aspell_last_modifier_result) + if (ptr_speller_buffer->modifier_result) { - free (aspell_last_modifier_result); - aspell_last_modifier_result = NULL; + free (ptr_speller_buffer->modifier_result); + ptr_speller_buffer->modifier_result = NULL; } word_for_suggestions = NULL; /* save last modifier string received */ - aspell_last_modifier_string = strdup (string); - aspell_last_buffer_input_pos = input_pos; + ptr_speller_buffer->modifier_string = strdup (string); + ptr_speller_buffer->input_pos = input_pos; color_normal = weechat_color ("bar_fg"); length_color_normal = strlen (color_normal); @@ -838,7 +586,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, { result[0] = '\0'; - ptr_string = aspell_last_modifier_string; + ptr_string = ptr_speller_buffer->modifier_string; index_result = 0; /* check if string is a command */ @@ -865,7 +613,9 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, free (result); return NULL; } - memcpy (result + index_result, aspell_last_modifier_string, char_size); + memcpy (result + index_result, + ptr_speller_buffer->modifier_string, + char_size); index_result += char_size; strcpy (result + index_result, ptr_string); index_result += strlen (ptr_string); @@ -939,7 +689,9 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, if ((save_end != '\0') || (weechat_config_integer (weechat_aspell_config_check_real_time))) { - word_ok = weechat_aspell_check_word (buffer, ptr_string); + word_ok = weechat_aspell_check_word (buffer, + ptr_speller_buffer, + ptr_string); if (!word_ok && (input_pos >= word_start_pos)) { /* @@ -992,7 +744,8 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, /* if there is a misspelled word, get suggestions and set them in buffer */ if (word_for_suggestions) { - suggestions = weechat_aspell_get_suggestions (word_for_suggestions); + suggestions = weechat_aspell_get_suggestions (ptr_speller_buffer, + word_for_suggestions); if (suggestions) { length = strlen (word_for_suggestions) + 1 /* ":" */ @@ -1044,176 +797,11 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, if (!result) return NULL; - aspell_last_modifier_result = strdup (result); + ptr_speller_buffer->modifier_result = strdup (result); return result; } -/* - * Callback for command "/aspell". - */ - -int -weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer, - int argc, char **argv, char **argv_eol) -{ - char *dicts; - const char *default_dict; - struct t_infolist *infolist; - int number; - - /* make C compiler happy */ - (void) data; - - if (argc == 1) - { - /* display aspell status */ - weechat_printf (NULL, ""); - weechat_printf (NULL, "%s", - (aspell_enabled) ? - _("Aspell is enabled") : _("Aspell is disabled")); - default_dict = weechat_config_string (weechat_aspell_config_check_default_dict); - weechat_printf (NULL, - _("Default dictionary: %s"), - (default_dict && default_dict[0]) ? - default_dict : _("(not set)")); - number = 0; - infolist = weechat_infolist_get ("option", NULL, "aspell.dict.*"); - if (infolist) - { - while (weechat_infolist_next (infolist)) - { - if (number == 0) - weechat_printf (NULL, _("Specific dictionaries on buffers:")); - number++; - weechat_printf (NULL, " %s: %s", - weechat_infolist_string (infolist, "option_name"), - weechat_infolist_string (infolist, "value")); - } - weechat_infolist_free (infolist); - } - return WEECHAT_RC_OK; - } - - /* enable aspell */ - if (weechat_strcasecmp (argv[1], "enable") == 0) - { - weechat_config_option_set (weechat_aspell_config_check_enabled, "1", 1); - weechat_printf (NULL, _("Aspell enabled")); - return WEECHAT_RC_OK; - } - - /* disable aspell */ - if (weechat_strcasecmp (argv[1], "disable") == 0) - { - weechat_config_option_set (weechat_aspell_config_check_enabled, "0", 1); - weechat_printf (NULL, _("Aspell disabled")); - return WEECHAT_RC_OK; - } - - /* toggle aspell */ - if (weechat_strcasecmp (argv[1], "toggle") == 0) - { - if (aspell_enabled) - { - weechat_config_option_set (weechat_aspell_config_check_enabled, "0", 1); - weechat_printf (NULL, _("Aspell disabled")); - } - else - { - weechat_config_option_set (weechat_aspell_config_check_enabled, "1", 1); - weechat_printf (NULL, _("Aspell enabled")); - } - return WEECHAT_RC_OK; - } - - /* list of dictionaries */ - if (weechat_strcasecmp (argv[1], "listdict") == 0) - { - weechat_aspell_speller_list_dicts (); - return WEECHAT_RC_OK; - } - - /* set dictionary for current buffer */ - if (weechat_strcasecmp (argv[1], "setdict") == 0) - { - if (argc > 2) - { - dicts = weechat_string_replace (argv_eol[2], " ", ""); - weechat_aspell_set_dict (buffer, - (dicts) ? dicts : argv[2]); - if (dicts) - free (dicts); - } - return WEECHAT_RC_OK; - } - - /* delete dictionary used on current buffer */ - if (weechat_strcasecmp (argv[1], "deldict") == 0) - { - weechat_aspell_set_dict (buffer, NULL); - return WEECHAT_RC_OK; - } - - /* add word to personal dictionary */ - if (weechat_strcasecmp (argv[1], "addword") == 0) - { - if (argc > 3) - weechat_aspell_add_word (argv[2], argv_eol[3]); - else - { - if (!weechat_aspell_spellers) - { - weechat_printf (NULL, - _("%s%s: no dictionary on this buffer for " - "adding word"), - weechat_prefix ("error"), - ASPELL_PLUGIN_NAME); - } - else if (weechat_aspell_spellers->next_speller) - { - weechat_printf (NULL, - _("%s%s: many dictionaries are defined for " - "this buffer, please specify dictionary"), - weechat_prefix ("error"), - ASPELL_PLUGIN_NAME); - } - else - weechat_aspell_add_word (weechat_aspell_spellers->lang, - argv_eol[2]); - } - return WEECHAT_RC_OK; - } - - return WEECHAT_RC_ERROR; -} - -/* - * Adds aspell langs to completion list. - */ - -int -weechat_aspell_completion_langs_cb (void *data, const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - int i; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (i = 0; aspell_langs_avail[i].code; i++) - { - weechat_hook_completion_list_add (completion, - aspell_langs_avail[i].code, - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - /* * Refreshes bar items on signal "buffer_switch". */ @@ -1256,6 +844,25 @@ weechat_aspell_window_switch_cb (void *data, const char *signal, return WEECHAT_RC_OK; } +/* + * Removes struct for buffer in hashtable "weechat_aspell_speller_buffer" on + * signal "buffer_closed". + */ + +int +weechat_aspell_buffer_closed_cb (void *data, const char *signal, + const char *type_data, void *signal_data) +{ + /* make C compiler happy */ + (void) data; + (void) signal; + (void) type_data; + + weechat_hashtable_remove (weechat_aspell_speller_buffer, signal_data); + + return WEECHAT_RC_OK; +} + /* * Initializes aspell plugin. */ @@ -1269,50 +876,18 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) weechat_plugin = plugin; + if (!weechat_aspell_speller_init ()) + return WEECHAT_RC_ERROR; + if (!weechat_aspell_config_init ()) return WEECHAT_RC_ERROR; if (weechat_aspell_config_read () < 0) return WEECHAT_RC_ERROR; - /* command /aspell */ - weechat_hook_command ("aspell", - N_("aspell plugin configuration"), - N_("enable|disable|toggle" - " || listdict" - " || setdict " - " || deldict" - " || addword [] "), - N_(" enable: enable aspell\n" - " disable: disable aspell\n" - " toggle: toggle aspell\n" - "listdict: show installed dictionaries\n" - " setdict: set dictionary for current buffer\n" - " deldict: delete dictionary used on current " - "buffer\n" - " addword: add a word in personal aspell " - "dictionary\n" - "\n" - "Input line beginning with a '/' is not checked, " - "except for some commands (see /set " - "aspell.check.commands).\n\n" - "To enable aspell on all buffers, use option " - "\"default_dict\", then enable aspell, for " - "example:\n" - " /set aspell.check.default_dict \"en\"\n" - " /aspell enable\n\n" - "Default key to toggle aspell is alt-s."), - "enable" - " || disable" - " || toggle" - " || listdict" - " || setdict %(aspell_langs)" - " || deldict" - " || addword", - &weechat_aspell_command_cb, NULL); - weechat_hook_completion ("aspell_langs", - N_("list of supported langs for aspell"), - &weechat_aspell_completion_langs_cb, NULL); + weechat_aspell_command_init (); + + weechat_aspell_completion_init (); /* * callback for spell checking input text @@ -1324,10 +899,14 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) weechat_aspell_bar_item_init (); + weechat_aspell_info_init (); + weechat_hook_signal ("buffer_switch", &weechat_aspell_buffer_switch_cb, NULL); weechat_hook_signal ("window_switch", &weechat_aspell_window_switch_cb, NULL); + weechat_hook_signal ("buffer_closed", + &weechat_aspell_buffer_closed_cb, NULL); return WEECHAT_RC_OK; } @@ -1343,15 +922,9 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) (void) plugin; weechat_aspell_config_write (); - - weechat_aspell_speller_free_all (); - - if (aspell_last_modifier_string) - free (aspell_last_modifier_string); - if (aspell_last_modifier_result) - free (aspell_last_modifier_result); - weechat_aspell_config_free (); + weechat_aspell_speller_end (); + return WEECHAT_RC_OK; } diff --git a/src/plugins/aspell/weechat-aspell.h b/src/plugins/aspell/weechat-aspell.h index 072818103..7f26608fd 100644 --- a/src/plugins/aspell/weechat-aspell.h +++ b/src/plugins/aspell/weechat-aspell.h @@ -34,8 +34,11 @@ struct t_aspell_code extern struct t_weechat_plugin *weechat_aspell_plugin; extern int aspell_enabled; +extern struct t_aspell_code aspell_langs[]; +extern struct t_aspell_code aspell_countries[]; -extern void weechat_aspell_create_spellers (struct t_gui_buffer *buffer); +extern char *weechat_aspell_build_option_name (struct t_gui_buffer *buffer); +extern const char *weechat_aspell_get_dict_with_buffer_name (const char *name); extern const char *weechat_aspell_get_dict (struct t_gui_buffer *buffer); #endif /* __WEECHAT_ASPELL_H */