aspell: add support of enchant library (patch #6858)

Enchant is enabled only if the new option for cmake (or configure) is enabled:
- for cmake: cmake -DENABLE_ENCHANT=ON
- for configure: ./configure --enable-enchant
This commit is contained in:
Sebastien Helleu 2013-06-07 21:01:48 +02:00
parent 4080047da0
commit fb7edb3518
30 changed files with 596 additions and 167 deletions

View File

@ -69,6 +69,7 @@ OPTION(ENABLE_GNUTLS "Enable SSLv3/TLS support" ON)
OPTION(ENABLE_LARGEFILE "Enable Large File Support" ON)
OPTION(ENABLE_ALIAS "Enable Alias plugin" ON)
OPTION(ENABLE_ASPELL "Enable Aspell plugin" ON)
OPTION(ENABLE_ENCHANT "Enable Enchant lib for Aspell plugin" OFF)
OPTION(ENABLE_CHARSET "Enable Charset plugin" ON)
OPTION(ENABLE_DEMO "Enable Demo plugin" OFF)
OPTION(ENABLE_FIFO "Enable FIFO plugin" ON)

View File

@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.2-dev, 2013-06-05
v0.4.2-dev, 2013-06-07
This document lists all changes for each version.
@ -21,6 +21,7 @@ Version 0.4.2 (under dev!)
"layout_window"
* core: fix line alignment when option weechat.look.buffer_time_format is set
to empty string
* aspell: add support of enchant library (patch #6858)
* irc: add support of special variables $nick/$channel/$server in commands
/allchan and /allserv
* irc: add option irc.look.nick_color_hash: hash algorithm to find nick color

View File

@ -39,6 +39,7 @@ EXTRA_DIST = CMakeLists.txt \
cmake/CMakeParseArguments.cmake \
cmake/FindAsciidoc.cmake \
cmake/FindAspell.cmake \
cmake/FindENCHANT.cmake \
cmake/FindGCRYPT.cmake \
cmake/FindGettext.cmake \
cmake/FindGnuTLS.cmake \

44
cmake/FindENCHANT.cmake Normal file
View File

@ -0,0 +1,44 @@
# - Try to find the Enchant spell checker
# Once done this will define
#
# ENCHANT_FOUND - system has ENCHANT
# ENCHANT_INCLUDE_DIR - the ENCHANT include directory
# ENCHANT_LIBRARIES - Link these to use ENCHANT
# ENCHANT_DEFINITIONS - Compiler switches required for using ENCHANT
# Copyright (c) 2006, Zack Rusin, <zack@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES)
# in cache already
set(ENCHANT_FOUND TRUE)
else (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES)
if (NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
pkg_check_modules(PC_ENCHANT enchant)
set(ENCHANT_DEFINITIONS ${PC_ENCHANT_CFLAGS_OTHER})
endif (NOT WIN32)
find_path(ENCHANT_INCLUDE_DIR
NAMES enchant++.h
HINTS ${PC_ENCHANT_INCLUDEDIR}
${PC_ENCHANT_INCLUDE_DIRS}
PATH_SUFFIXES enchant )
find_library(ENCHANT_LIBRARIES NAMES enchant
HINTS ${PC_ENCHANT_LIBDIR}
${PC_ENCHANT_LIBRARY_DIRS} )
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ENCHANT DEFAULT_MSG ENCHANT_INCLUDE_DIR ENCHANT_LIBRARIES )
mark_as_advanced(ENCHANT_INCLUDE_DIR ENCHANT_LIBRARIES)
endif (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES)

View File

@ -128,6 +128,7 @@ AC_ARG_ENABLE(gnutls, [ --disable-gnutls turn off gnutls support (
AC_ARG_ENABLE(largefile, [ --disable-largefile turn off Large File Support (default=on)],enable_largefile=$enableval,enable_largefile=yes)
AC_ARG_ENABLE(alias, [ --disable-alias turn off Alias plugin (default=compiled)],enable_alias=$enableval,enable_alias=yes)
AC_ARG_ENABLE(aspell, [ --disable-aspell turn off Aspell plugin (default=compiled)],enable_aspell=$enableval,enable_aspell=yes)
AC_ARG_ENABLE(enchant, [ --enable-enchant turn on Enchant lib for Aspell plugin (default=off)],enable_enchant=$enableval,enable_enchant=no)
AC_ARG_ENABLE(charset, [ --disable-charset turn off Charset plugin (default=compiled if found)],enable_charset=$enableval,enable_charset=yes)
AC_ARG_ENABLE(demo, [ --enable-demo turn on Demo plugin (default=off)],enable_demo=$enableval,enable_demo=no)
AC_ARG_ENABLE(fifo, [ --disable-fifo turn off Fifo plugin (default=compiled)],enable_fifo=$enableval,enable_fifo=yes)
@ -275,24 +276,35 @@ fi
# ---------------------------------- aspell ------------------------------------
if test "x$enable_aspell" = "xyes" ; then
ASPELL_CFLAGS=""
ASPELL_LFLAGS=""
ac_found_enchant_lib="no"
if test "x$enable_enchant" = "xyes" ; then
#PKG_CHECK_MODULES(ENCHANT, [enchant], [CFLAGS="$CFLAGS -DUSE_ENCHANT"],
PKG_CHECK_MODULES(ENCHANT, [enchant], ac_found_enchant_lib="yes", ac_found_enchant_lib="no")
fi
if test "x$ac_found_enchant_lib" = "xyes" ; then
CFLAGS="$CFLAGS -DUSE_ENCHANT"
ASPELL_LIB_USED="enchant"
else
ASPELL_CFLAGS=""
ASPELL_LFLAGS=""
AC_CHECK_HEADER(aspell.h,ac_found_aspell_header="yes",ac_found_aspell_header="no")
AC_CHECK_LIB(aspell,new_aspell_speller,ac_found_aspell_lib="yes",ac_found_aspell_lib="no")
AC_CHECK_HEADER(aspell.h,ac_found_aspell_header="yes",ac_found_aspell_header="no")
AC_CHECK_LIB(aspell,new_aspell_speller,ac_found_aspell_lib="yes",ac_found_aspell_lib="no")
AC_MSG_CHECKING(for aspell headers and librairies)
if test "x$ac_found_aspell_header" = "xno" -o "x$ac_found_aspell_lib" = "xno" ; then
AC_MSG_RESULT(no)
AC_MSG_WARN([
AC_MSG_CHECKING(for aspell headers and librairies)
if test "x$ac_found_aspell_header" = "xno" -o "x$ac_found_aspell_lib" = "xno" ; then
AC_MSG_RESULT(no)
AC_MSG_WARN([
*** Aspell headers and/or libraries couldn't be found on your system.
*** Try to install them with your software package manager.
*** WeeChat will be built without Aspell support.])
enable_aspell="no"
not_found="$not_found aspell"
else
AC_MSG_RESULT(yes)
ASPELL_LFLAGS="$ASPELL_LFLAGS -laspell"
enable_aspell="no"
not_found="$not_found aspell"
else
AC_MSG_RESULT(yes)
ASPELL_LFLAGS="$ASPELL_LFLAGS -laspell"
ASPELL_LIB_USED="aspell"
fi
fi
else
not_asked="$not_asked aspell"
@ -1127,7 +1139,7 @@ if test "x$enable_alias" = "xyes"; then
listplugins="$listplugins alias"
fi
if test "x$enable_aspell" = "xyes"; then
listplugins="$listplugins aspell"
listplugins="$listplugins aspell($ASPELL_LIB_USED)"
fi
if test "x$enable_charset" = "xyes"; then
listplugins="$listplugins charset"

View File

@ -86,24 +86,24 @@ welche Pakete optional genutzt werden können.
[width="100%",cols="5,^3,^3,13",options="header"]
|========================================
| Paket ^(1)^ | Version | benötigt | Funktion
| cmake | | *ja* | zum kompilieren (autotools ist möglich. cmake wird aber empfohlen)
| libncursesw5-dev ^(2)^ | | *ja* | ncurses Oberfläche
| libcurl4-gnutls-dev | | *ja* | URL Transfer
| zlib1g-dev | | *ja* | Kompression für Pakete, die mittels Relay- (WeeChat Protokoll), Script-Erweiterung übertragen werden
| libgcrypt11-dev | | *ja* | IRC SASL Authentifikation (DH-BLOWFISH/DH-AES), Skript-Erweiterung
| libgnutls-dev | ≥ 2.2.0 | | SSL Verbindung zu einem IRC Server, Unterstützung von SSL in der Relay-Erweiterung
| gettext | | | Internationalisierung (Übersetzung der Mitteilungen; Hauptsprache ist englisch)
| ca-certificates | | | Zertifikate für SSL Verbindungen
| libaspell-dev | | | aspell Erweiterung
| python-dev | ≥ 2.5 ^(3)^ | | python Erweiterung
| libperl-dev | | | perl Erweiterung
| ruby1.9.1-dev | ≥ 1.8 | | ruby Erweiterung
| liblua5.1-0-dev | | | lua Erweiterung
| tcl-dev | ≥ 8.5 | | tcl Erweiterung
| guile-2.0-dev | ≥ 2.0 | | guile (scheme) Erweiterung
| asciidoc | ≥ 8.5.0 | | erstellt Dokumentation (HTML Dateien)
| source-highlight | | | Syntax Highlight für Quelltext in HTML Dokumentation
| Paket ^(1)^ | Version | benötigt | Funktion
| cmake | | *ja* | zum kompilieren (autotools ist möglich. cmake wird aber empfohlen)
| libncursesw5-dev ^(2)^ | | *ja* | ncurses Oberfläche
| libcurl4-gnutls-dev | | *ja* | URL Transfer
| zlib1g-dev | | *ja* | Kompression für Pakete, die mittels Relay- (WeeChat Protokoll), Script-Erweiterung übertragen werden
| libgcrypt11-dev | | *ja* | IRC SASL Authentifikation (DH-BLOWFISH/DH-AES), Skript-Erweiterung
| libgnutls-dev | ≥ 2.2.0 | | SSL Verbindung zu einem IRC Server, Unterstützung von SSL in der Relay-Erweiterung
| gettext | | | Internationalisierung (Übersetzung der Mitteilungen; Hauptsprache ist englisch)
| ca-certificates | | | Zertifikate für SSL Verbindungen
| libaspell-dev oder libenchant-dev | | | aspell Erweiterung
| python-dev | ≥ 2.5 ^(3)^ | | python Erweiterung
| libperl-dev | | | perl Erweiterung
| ruby1.9.1-dev | ≥ 1.8 | | ruby Erweiterung
| liblua5.1-0-dev | | | lua Erweiterung
| tcl-dev | ≥ 8.5 | | tcl Erweiterung
| guile-2.0-dev | ≥ 2.0 | | guile (scheme) Erweiterung
| asciidoc | ≥ 8.5.0 | | erstellt Dokumentation (HTML Dateien)
| source-highlight | | | Syntax Highlight für Quelltext in HTML Dokumentation
|========================================
[NOTE]

View File

@ -86,24 +86,24 @@ compile WeeChat.
[width="100%",cols="5,^3,^3,13",options="header"]
|========================================
| Package ^(1)^ | Version | Required | Feature
| cmake | | *yes* | build (autotools still possible, but cmake is recommended)
| libncursesw5-dev ^(2)^ | | *yes* | ncurses interface
| libcurl4-gnutls-dev | | *yes* | URL transfer
| zlib1g-dev | | *yes* | compression of packets in relay plugin (weechat protocol), script plugin
| libgcrypt11-dev | | *yes* | IRC SASL authentication (DH-BLOWFISH/DH-AES), script plugin
| libgnutls-dev | ≥ 2.2.0 | | SSL connection to IRC server, support of SSL in relay plugin
| gettext | | | internationalization (translation of messages; base language is English)
| ca-certificates | | | certificates for SSL connections
| libaspell-dev | | | aspell plugin
| python-dev | ≥ 2.5 ^(3)^ | | python plugin
| libperl-dev | | | perl plugin
| ruby1.9.1-dev | ≥ 1.8 | | ruby plugin
| liblua5.1-0-dev | | | lua plugin
| tcl-dev | ≥ 8.5 | | tcl plugin
| guile-2.0-dev | ≥ 2.0 | | guile (scheme) plugin
| asciidoc | ≥ 8.5.0 | | build documentation (HTML files)
| source-highlight | | | syntax highlight for sources in HTML documentation
| Package ^(1)^ | Version | Required | Feature
| cmake | | *yes* | build (autotools still possible, but cmake is recommended)
| libncursesw5-dev ^(2)^ | | *yes* | ncurses interface
| libcurl4-gnutls-dev | | *yes* | URL transfer
| zlib1g-dev | | *yes* | compression of packets in relay plugin (weechat protocol), script plugin
| libgcrypt11-dev | | *yes* | IRC SASL authentication (DH-BLOWFISH/DH-AES), script plugin
| libgnutls-dev | ≥ 2.2.0 | | SSL connection to IRC server, support of SSL in relay plugin
| gettext | | | internationalization (translation of messages; base language is English)
| ca-certificates | | | certificates for SSL connections
| libaspell-dev or libenchant-dev | | | aspell plugin
| python-dev | ≥ 2.5 ^(3)^ | | python plugin
| libperl-dev | | | perl plugin
| ruby1.9.1-dev | ≥ 1.8 | | ruby plugin
| liblua5.1-0-dev | | | lua plugin
| tcl-dev | ≥ 8.5 | | tcl plugin
| guile-2.0-dev | ≥ 2.0 | | guile (scheme) plugin
| asciidoc | ≥ 8.5.0 | | build documentation (HTML files)
| source-highlight | | | syntax highlight for sources in HTML documentation
|========================================
[NOTE]

View File

@ -88,24 +88,24 @@ compiler WeeChat.
[width="100%",cols="5,^3,^3,13",options="header"]
|========================================
| Paquet ^(1)^ | Version | Requis | Fonctionnalité
| cmake | | *oui* | construction (autotools toujours possible, mais cmake est recommandé)
| libncursesw5-dev ^(2)^ | | *oui* | interface ncurses
| libcurl4-gnutls-dev | | *oui* | transfert d'URL
| zlib1g-dev | | *oui* | compression des paquets dans l'extension relay (protocole weechat), extension script
| libgcrypt11-dev | | *oui* | authentification IRC SASL (DH-BLOWFISH/DH-AES), extension script
| libgnutls-dev | ≥ 2.2.0 | | connexion SSL au serveur IRC, support SSL dans l'extension relay
| gettext | | | internationalisation (traduction des messages; la langue de base est l'anglais)
| ca-certificates | | | certificats pour les connexions SSL
| libaspell-dev | | | extension aspell
| python-dev | ≥ 2.5 ^(3)^ | | extension python
| libperl-dev | | | extension perl
| ruby1.9.1-dev | ≥ 1.8 | | extension ruby
| liblua5.1-0-dev | | | extension lua
| tcl-dev | ≥ 8.5 | | extension tcl
| guile-2.0-dev | ≥ 2.0 | | extension guile (scheme)
| asciidoc | ≥ 8.5.0 | | construction de la documentation (fichiers HTML)
| source-highlight | | | coloration des sources dans la documentation HTML
| Paquet ^(1)^ | Version | Requis | Fonctionnalité
| cmake | | *oui* | construction (autotools toujours possible, mais cmake est recommandé)
| libncursesw5-dev ^(2)^ | | *oui* | interface ncurses
| libcurl4-gnutls-dev | | *oui* | transfert d'URL
| zlib1g-dev | | *oui* | compression des paquets dans l'extension relay (protocole weechat), extension script
| libgcrypt11-dev | | *oui* | authentification IRC SASL (DH-BLOWFISH/DH-AES), extension script
| libgnutls-dev | ≥ 2.2.0 | | connexion SSL au serveur IRC, support SSL dans l'extension relay
| gettext | | | internationalisation (traduction des messages; la langue de base est l'anglais)
| ca-certificates | | | certificats pour les connexions SSL
| libaspell-dev ou libenchant-dev | | | extension aspell
| python-dev | ≥ 2.5 ^(3)^ | | extension python
| libperl-dev | | | extension perl
| ruby1.9.1-dev | ≥ 1.8 | | extension ruby
| liblua5.1-0-dev | | | extension lua
| tcl-dev | ≥ 8.5 | | extension tcl
| guile-2.0-dev | ≥ 2.0 | | extension guile (scheme)
| asciidoc | ≥ 8.5.0 | | construction de la documentation (fichiers HTML)
| source-highlight | | | coloration des sources dans la documentation HTML
|========================================
[NOTE]

View File

@ -90,27 +90,27 @@ compilare WeeChat.
[width="100%",cols="5,^3,^3,13",options="header"]
|========================================
| Pacchetto ^(1)^ | Versione | Richiesto | Caratteristica
| cmake | | *sì* | compilazione (ancora possibile con autotools, ma si raccomanda cmake)
| libncursesw5-dev ^(2)^ | | *sì* | interfaccia ncurses
| libcurl4-gnutls-dev | | *sì* | trasferimento URL
| Pacchetto ^(1)^ | Versione | Richiesto | Caratteristica
| cmake | | *sì* | compilazione (ancora possibile con autotools, ma si raccomanda cmake)
| libncursesw5-dev ^(2)^ | | *sì* | interfaccia ncurses
| libcurl4-gnutls-dev | | *sì* | trasferimento URL
// TRANSLATION MISSING
| zlib1g-dev | | *sì* | compression of packets in relay plugin (weechat protocol), script plugin
| zlib1g-dev | | *sì* | compression of packets in relay plugin (weechat protocol), script plugin
// TRANSLATION MISSING
| libgcrypt11-dev | | *sì* | IRC SASL authentication (DH-BLOWFISH/DH-AES), script plugin
| libgcrypt11-dev | | *sì* | IRC SASL authentication (DH-BLOWFISH/DH-AES), script plugin
// TRANSLATION MISSING
| libgnutls-dev | ≥ 2.2.0 | | connessione SSL al server IRC, support of SSL in relay plugin
| gettext | | | internazionalizzazione (traduzione dei messaggi; la lingua base è l'inglese)
| ca-certificates | | | certificati per le connessioni SSL
| libaspell-dev | | | plugin aspell
| python-dev | ≥ 2.5 ^(3)^ | | plugin python
| libperl-dev | | | plugin perl
| ruby1.9.1-dev | ≥ 1.8 | | plugin ruby
| liblua5.1-0-dev | | | plugin lua
| tcl-dev | ≥ 8.5 | | plugin tcl
| guile-2.0-dev | ≥ 2.0 | | plugin guile (scheme)
| asciidoc | ≥ 8.5.0 | | compilazione della documentazione (file HTML)
| source-highlight | | | evidenziazione della sintassi per i sorgenti nella documentazione HTML
| libgnutls-dev | ≥ 2.2.0 | | connessione SSL al server IRC, support of SSL in relay plugin
| gettext | | | internazionalizzazione (traduzione dei messaggi; la lingua base è l'inglese)
| ca-certificates | | | certificati per le connessioni SSL
| libaspell-dev o libenchant-dev | | | plugin aspell
| python-dev | ≥ 2.5 ^(3)^ | | plugin python
| libperl-dev | | | plugin perl
| ruby1.9.1-dev | ≥ 1.8 | | plugin ruby
| liblua5.1-0-dev | | | plugin lua
| tcl-dev | ≥ 8.5 | | plugin tcl
| guile-2.0-dev | ≥ 2.0 | | plugin guile (scheme)
| asciidoc | ≥ 8.5.0 | | compilazione della documentazione (file HTML)
| source-highlight | | | evidenziazione della sintassi per i sorgenti nella documentazione HTML
|========================================
[NOTE]

View File

@ -78,24 +78,25 @@ WeeChat は cmake または autotools を使ってコンパイルできます (c
[width="100%",cols="5,^3,^3,13",options="header"]
|========================================
| パッケージ ^(1)^ | バージョン | 必須 | 機能
| cmake | | *yes* | ビルド (autotools でも可能ですが、cmake を推奨します)
| libncursesw5-dev ^(2)^ | | *yes* | ncurses インターフェイス
| libcurl4-gnutls-dev | | *yes* | URL 転送
| zlib1g-dev | | *yes* | relay プラグインでパケットを圧縮 (weechat プロトコル)、スクリプトプラグイン
| libgcrypt11-dev | | *yes* | IRC SASL 認証 (DH-BLOWFISH/DH-AES)、スクリプトプラグイン
| libgnutls-dev | ≥ 2.2.0 | | IRC サーバへの SSL 接続
| gettext | | | 国際化 (メッセージの翻訳; ベース言語は英語です)
| ca-certificates | | | SSL 接続に必要な証明書、relay プラグインで SSL サポート
| libaspell-dev | | | aspell プラグイン
| python-dev | ≥ 2.5 ^(3)^ | | python プラグイン
| libperl-dev | | | perl プラグイン
| ruby1.9.1-dev | ≥ 1.8 | | ruby プラグイン
| liblua5.1-0-dev | | | lua プラグイン
| tcl-dev | ≥ 8.5 | | tcl プラグイン
| guile-2.0-dev | ≥ 2.0 | | guile (scheme) プラグイン
| asciidoc | ≥ 8.5.0 | | 文書の生成 (HTML ファイル)
| source-highlight | | | HTML 文書に含まれるソースコードのシンタックスハイライト
| パッケージ ^(1)^ | バージョン | 必須 | 機能
| cmake | | *yes* | ビルド (autotools でも可能ですが、cmake を推奨します)
| libncursesw5-dev ^(2)^ | | *yes* | ncurses インターフェイス
| libcurl4-gnutls-dev | | *yes* | URL 転送
| zlib1g-dev | | *yes* | relay プラグインでパケットを圧縮 (weechat プロトコル)、スクリプトプラグイン
| libgcrypt11-dev | | *yes* | IRC SASL 認証 (DH-BLOWFISH/DH-AES)、スクリプトプラグイン
| libgnutls-dev | ≥ 2.2.0 | | IRC サーバへの SSL 接続
| gettext | | | 国際化 (メッセージの翻訳; ベース言語は英語です)
| ca-certificates | | | SSL 接続に必要な証明書、relay プラグインで SSL サポート
// TRANSLATION MISSING
| libaspell-dev or libenchant-dev | | | aspell プラグイン
| python-dev | ≥ 2.5 ^(3)^ | | python プラグイン
| libperl-dev | | | perl プラグイン
| ruby1.9.1-dev | ≥ 1.8 | | ruby プラグイン
| liblua5.1-0-dev | | | lua プラグイン
| tcl-dev | ≥ 8.5 | | tcl プラグイン
| guile-2.0-dev | ≥ 2.0 | | guile (scheme) プラグイン
| asciidoc | ≥ 8.5.0 | | 文書の生成 (HTML ファイル)
| source-highlight | | | HTML 文書に含まれるソースコードのシンタックスハイライト
|========================================
[NOTE]

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-05 10:12+0200\n"
"POT-Creation-Date: 2013-06-07 20:09+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3841,12 +3841,17 @@ msgstr "%s: slovo \"%s\" přidáno do soukromého slovníku"
msgid "%s%s: failed to add word to personal dictionary"
msgstr "%s%s: selhalo přidání slova do vlastního slovníku"
#. TRANSLATORS: second "%s" is "aspell" or "enchant"
#, fuzzy, c-format
msgid "%s (using %s)"
msgstr " %s (plugin: %s)"
#, fuzzy
msgid "Aspell is enabled"
msgid "Spell checking is enabled"
msgstr "1 pokud jsou filtry povoleny"
#, fuzzy
msgid "Aspell is disabled"
msgid "Spell checking is disabled"
msgstr "Filtrování zpráv zakázáno"
#, fuzzy, c-format
@ -3987,6 +3992,10 @@ msgstr ""
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"
#, fuzzy, c-format
msgid "%s%s: error: unable to create speller for lang \"%s\""
msgstr "%s%s: nemohu vytvořit server \"%s\""
#, fuzzy
msgid "Charset conversions"
msgstr "verze WeeChat"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-05 10:12+0200\n"
"POT-Creation-Date: 2013-06-07 20:09+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@ -4296,10 +4296,17 @@ msgid "%s%s: failed to add word to personal dictionary"
msgstr ""
"%s%s: Es kann kein Wort zum persönlichen Wörterbuch hinzugefügt werden."
msgid "Aspell is enabled"
#. TRANSLATORS: second "%s" is "aspell" or "enchant"
#, fuzzy, c-format
msgid "%s (using %s)"
msgstr " %s (Erweiterung: %s)"
#, fuzzy
msgid "Spell checking is enabled"
msgstr "Aspell ist aktiviert"
msgid "Aspell is disabled"
#, fuzzy
msgid "Spell checking is disabled"
msgstr "Aspell ist deaktiviert"
#, c-format
@ -4464,6 +4471,10 @@ msgstr ""
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"
#, fuzzy, c-format
msgid "%s%s: error: unable to create speller for lang \"%s\""
msgstr "%s%s: Der Server \"%s\" kann nicht anlegt werden"
msgid "Charset conversions"
msgstr "Zeichensatzkonvertierung"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-05 10:12+0200\n"
"POT-Creation-Date: 2013-06-07 20:09+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4038,10 +4038,17 @@ msgstr "%s: palabra \"%s\" agregada al diccionario personal"
msgid "%s%s: failed to add word to personal dictionary"
msgstr "%s%s: no se pudo agregar una palabra al diccionario personal"
msgid "Aspell is enabled"
#. TRANSLATORS: second "%s" is "aspell" or "enchant"
#, fuzzy, c-format
msgid "%s (using %s)"
msgstr " %s (plugin: %s)"
#, fuzzy
msgid "Spell checking is enabled"
msgstr "Aspell activado"
msgid "Aspell is disabled"
#, fuzzy
msgid "Spell checking is disabled"
msgstr "Aspell desactivado"
#, c-format
@ -4188,6 +4195,10 @@ msgstr ""
msgid "%s: warning: dictionary \"%s\" is not available on your system"
msgstr "%s: atención: diccionario \"%s\" no está disponible en su sistema"
#, fuzzy, c-format
msgid "%s%s: error: unable to create speller for lang \"%s\""
msgstr "%s%s: no es posible crear el servidor \"%s\""
msgid "Charset conversions"
msgstr "Conversiones de mapa de caracteres"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-05 10:12+0200\n"
"PO-Revision-Date: 2013-06-05 10:14+0200\n"
"POT-Creation-Date: 2013-06-07 20:09+0200\n"
"PO-Revision-Date: 2013-06-07 20:48+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -4175,11 +4175,16 @@ msgstr "%s: mot \"%s\" ajouté dans le dictionnaire personnel"
msgid "%s%s: failed to add word to personal dictionary"
msgstr "%s%s: impossible d'ajouter le mot dans le dictionnaire personnel"
msgid "Aspell is enabled"
msgstr "Aspell est activé"
#. TRANSLATORS: second "%s" is "aspell" or "enchant"
#, c-format
msgid "%s (using %s)"
msgstr "%s (en utilisant %s)"
msgid "Aspell is disabled"
msgstr "Aspell est désactivé"
msgid "Spell checking is enabled"
msgstr "La vérification orthographique est activée"
msgid "Spell checking is disabled"
msgstr "La vérification orthographique est désactivée"
#, c-format
msgid "Default dictionary: %s"
@ -4337,6 +4342,11 @@ msgstr ""
"%s: attention: le dictionnaire \\\"%s\\\" n'est pas disponible sur votre "
"système"
#, c-format
msgid "%s%s: error: unable to create speller for lang \"%s\""
msgstr ""
"%s%s: impossible de créer le correcteur orthographique pour la langue \"%s\""
msgid "Charset conversions"
msgstr "Conversions de charset"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-05 10:12+0200\n"
"POT-Creation-Date: 2013-06-07 20:09+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3465,12 +3465,17 @@ msgstr ""
msgid "%s%s: failed to add word to personal dictionary"
msgstr ""
#. TRANSLATORS: second "%s" is "aspell" or "enchant"
#, fuzzy, c-format
msgid "%s (using %s)"
msgstr " (nem található bővítőmodul)\n"
#, fuzzy
msgid "Aspell is enabled"
msgid "Spell checking is enabled"
msgstr "a felhasználók le lettek tiltva"
#, fuzzy
msgid "Aspell is disabled"
msgid "Spell checking is disabled"
msgstr "Nincs aliasz definiálva.\n"
#, fuzzy, c-format
@ -3591,6 +3596,10 @@ msgstr ""
msgid "%s: warning: dictionary \"%s\" is not available on your system"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error: unable to create speller for lang \"%s\""
msgstr "%s nem sikerült a szervert létrehozni\n"
#, fuzzy
msgid "Charset conversions"
msgstr "WeeChat szlogen"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-05 10:12+0200\n"
"POT-Creation-Date: 2013-06-07 20:09+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4099,10 +4099,17 @@ msgstr "%s: la parola \"%s\" è stata aggiunta al dizionario personale"
msgid "%s%s: failed to add word to personal dictionary"
msgstr "%s%s: impossibile aggiungere la parola al dizionario personale"
msgid "Aspell is enabled"
#. TRANSLATORS: second "%s" is "aspell" or "enchant"
#, fuzzy, c-format
msgid "%s (using %s)"
msgstr " %s (plugin: %s)"
#, fuzzy
msgid "Spell checking is enabled"
msgstr "Aspell è abilitato"
msgid "Aspell is disabled"
#, fuzzy
msgid "Spell checking is disabled"
msgstr "Aspell è disabilitato"
#, c-format
@ -4256,6 +4263,10 @@ msgid "%s: warning: dictionary \"%s\" is not available on your system"
msgstr ""
"%s: attenzione: il dizionario \"%s\" non è disponibile su questo sistema"
#, fuzzy, c-format
msgid "%s%s: error: unable to create speller for lang \"%s\""
msgstr "%s%s: impossibile creare il server \"%s\""
msgid "Charset conversions"
msgstr "Conversione del set caratteri"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-05 10:12+0200\n"
"POT-Creation-Date: 2013-06-07 20:09+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@ -4017,10 +4017,17 @@ msgstr "%s: 単語 \"%s\" を個人辞書に追加"
msgid "%s%s: failed to add word to personal dictionary"
msgstr "%s%s: 単語の個人辞書への登録に失敗"
msgid "Aspell is enabled"
#. TRANSLATORS: second "%s" is "aspell" or "enchant"
#, fuzzy, c-format
msgid "%s (using %s)"
msgstr " %s (プラグイン: %s)"
#, fuzzy
msgid "Spell checking is enabled"
msgstr "Aspell を有効化します"
msgid "Aspell is disabled"
#, fuzzy
msgid "Spell checking is disabled"
msgstr "Aspell を無効化します"
#, c-format
@ -4171,6 +4178,10 @@ msgstr ""
msgid "%s: warning: dictionary \"%s\" is not available on your system"
msgstr "%s: 警告: 辞書 \"%s\" がこのシステム上では利用できません"
#, fuzzy, c-format
msgid "%s%s: error: unable to create speller for lang \"%s\""
msgstr "%s%s: サーバ \"%s\" に接続できません"
msgid "Charset conversions"
msgstr "文字コード変換"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-05 10:12+0200\n"
"POT-Creation-Date: 2013-06-07 20:09+0200\n"
"PO-Revision-Date: 2013-05-20 16:54+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4108,10 +4108,17 @@ msgstr "%s: słowo \"%s\" dodane do osobistego słownika"
msgid "%s%s: failed to add word to personal dictionary"
msgstr "%s%s: nie udało się dodać słowa do osobistego słownika"
msgid "Aspell is enabled"
#. TRANSLATORS: second "%s" is "aspell" or "enchant"
#, fuzzy, c-format
msgid "%s (using %s)"
msgstr " %s (wtyczka: %s)"
#, fuzzy
msgid "Spell checking is enabled"
msgstr "Aspell jest włączony"
msgid "Aspell is disabled"
#, fuzzy
msgid "Spell checking is disabled"
msgstr "Aspell jest wyłączony"
#, c-format
@ -4263,6 +4270,10 @@ msgstr ""
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"
#, fuzzy, c-format
msgid "%s%s: error: unable to create speller for lang \"%s\""
msgstr "%s%s: nie można utworzyć serwera \"%s\""
msgid "Charset conversions"
msgstr "Konwersja kodowania"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-05 10:12+0200\n"
"POT-Creation-Date: 2013-06-07 20:09+0200\n"
"PO-Revision-Date: 2013-05-20 16:55+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3900,12 +3900,17 @@ msgstr "%s: palavra \"%s\" adicionada ao dicionário pessoal"
msgid "%s%s: failed to add word to personal dictionary"
msgstr "%s%s: falha ao adicionar palavra no dicionário pessoal"
#. TRANSLATORS: second "%s" is "aspell" or "enchant"
#, fuzzy, c-format
msgid "%s (using %s)"
msgstr " %s (plugin: %s)"
#, fuzzy
msgid "Aspell is enabled"
msgid "Spell checking is enabled"
msgstr "Mouse está habilitado"
#, fuzzy
msgid "Aspell is disabled"
msgid "Spell checking is disabled"
msgstr "Mouse está desabilitado"
#, fuzzy, c-format
@ -4041,6 +4046,10 @@ msgstr ""
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"
#, fuzzy, c-format
msgid "%s%s: error: unable to create speller for lang \"%s\""
msgstr "%s%s: não foi possível criar diretório para registros (\"%s\")"
#, fuzzy
msgid "Charset conversions"
msgstr "versão do WeeChat"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-05 10:12+0200\n"
"POT-Creation-Date: 2013-06-07 20:09+0200\n"
"PO-Revision-Date: 2013-05-20 16:55+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3497,12 +3497,17 @@ msgstr ""
msgid "%s%s: failed to add word to personal dictionary"
msgstr ""
#. TRANSLATORS: second "%s" is "aspell" or "enchant"
#, fuzzy, c-format
msgid "%s (using %s)"
msgstr " (нет pluginа)\n"
#, fuzzy
msgid "Aspell is enabled"
msgid "Spell checking is enabled"
msgstr "команда users отключена"
#, fuzzy
msgid "Aspell is disabled"
msgid "Spell checking is disabled"
msgstr "Сокращения не заданы.\n"
#, fuzzy, c-format
@ -3623,6 +3628,10 @@ msgstr ""
msgid "%s: warning: dictionary \"%s\" is not available on your system"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error: unable to create speller for lang \"%s\""
msgstr "%s не могу создать сервер \"%s\"\n"
#, fuzzy
msgid "Charset conversions"
msgstr "слоган WeeChat"

View File

@ -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-06-05 10:12+0200\n"
"POT-Creation-Date: 2013-06-07 20:09+0200\n"
"PO-Revision-Date: 2013-02-14 18:20+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3085,10 +3085,15 @@ msgstr ""
msgid "%s%s: failed to add word to personal dictionary"
msgstr ""
msgid "Aspell is enabled"
#. TRANSLATORS: second "%s" is "aspell" or "enchant"
#, c-format
msgid "%s (using %s)"
msgstr ""
msgid "Aspell is disabled"
msgid "Spell checking is enabled"
msgstr ""
msgid "Spell checking is disabled"
msgstr ""
#, c-format
@ -3205,6 +3210,10 @@ msgstr ""
msgid "%s: warning: dictionary \"%s\" is not available on your system"
msgstr ""
#, c-format
msgid "%s%s: error: unable to create speller for lang \"%s\""
msgstr ""
msgid "Charset conversions"
msgstr ""

View File

@ -44,11 +44,25 @@ IF(ENABLE_ALIAS)
ENDIF(ENABLE_ALIAS)
IF(ENABLE_ASPELL)
# Check for aspell libraries
FIND_PACKAGE(Aspell)
IF(ASPELL_FOUND)
ADD_SUBDIRECTORY( aspell )
ENDIF(ASPELL_FOUND)
IF(ENABLE_ENCHANT)
# Check for enchant libraries
FIND_PACKAGE(ENCHANT)
IF(ENCHANT_FOUND)
ADD_SUBDIRECTORY( aspell )
ELSE(ENCHANT_FOUND)
# Check for aspell libraries
FIND_PACKAGE(Aspell)
IF(ASPELL_FOUND)
ADD_SUBDIRECTORY( aspell )
ENDIF(ASPELL_FOUND)
ENDIF(ENCHANT_FOUND)
ELSE(ENABLE_ENCHANT)
# Check for aspell libraries
FIND_PACKAGE(Aspell)
IF(ASPELL_FOUND)
ADD_SUBDIRECTORY( aspell )
ENDIF(ASPELL_FOUND)
ENDIF(ENABLE_ENCHANT)
ENDIF(ENABLE_ASPELL)
IF(ENABLE_CHARSET)

View File

@ -28,9 +28,15 @@ weechat-aspell-info.c weechat-aspell-info.h
weechat-aspell-speller.c weechat-aspell-speller.h)
SET_TARGET_PROPERTIES(aspell PROPERTIES PREFIX "")
IF(ASPELL_FOUND)
INCLUDE_DIRECTORIES(${ASPELL_INCLUDE_PATH})
TARGET_LINK_LIBRARIES(aspell ${ASPELL_LIBRARY})
ENDIF(ASPELL_FOUND)
IF(ENCHANT_FOUND)
INCLUDE_DIRECTORIES(${ENCHANT_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(aspell ${ENCHANT_LIBRARIES})
ADD_DEFINITIONS(-DUSE_ENCHANT)
ELSE(ENCHANT_FOUND)
IF(ASPELL_FOUND)
INCLUDE_DIRECTORIES(${ASPELL_INCLUDE_PATH})
TARGET_LINK_LIBRARIES(aspell ${ASPELL_LIBRARY})
ENDIF(ASPELL_FOUND)
ENDIF(ENCHANT_FOUND)
INSTALL(TARGETS aspell LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -18,7 +18,7 @@
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
#
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(ASPELL_CFLAGS)
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(ASPELL_CFLAGS) $(ENCHANT_CFLAGS)
libdir = ${weechat_libdir}/plugins
@ -39,6 +39,6 @@ aspell_la_SOURCES = weechat-aspell.c \
weechat-aspell-speller.c \
weechat-aspell-speller.h
aspell_la_LDFLAGS = -module
aspell_la_LIBADD = $(ASPELL_LFLAGS)
aspell_la_LIBADD = $(ASPELL_LFLAGS) $(ENCHANT_LIBS)
EXTRA_DIST = CMakeLists.txt

View File

@ -71,6 +71,67 @@ weechat_aspell_command_iso_to_country (const char *code)
return strdup ("Unknown");
}
/*
* Displays one dictionary when using enchant.
*/
#ifdef USE_ENCHANT
void
weechat_aspell_enchant_dict_describe_cb (const char *lang_tag,
const char *provider_name,
const char *provider_desc,
const char *provider_file,
void *user_data)
{
char *country, *lang, *pos, *iso;
char str_dict[256];
/* make C compiler happy */
(void) provider_name;
(void) provider_desc;
(void) provider_file;
(void) user_data;
lang = NULL;
country = NULL;
pos = strchr (lang_tag, '_');
if (pos)
{
iso = weechat_strndup (lang_tag, pos - lang_tag);
if (iso)
{
lang = weechat_aspell_command_iso_to_lang (iso);
country = weechat_aspell_command_iso_to_country (pos + 1);
free (iso);
}
}
else
lang = weechat_aspell_command_iso_to_lang ((char *)lang_tag);
if (lang)
{
if (country)
{
snprintf (str_dict, sizeof (str_dict), "%-22s %s (%s)",
lang_tag, lang, country);
}
else
{
snprintf (str_dict, sizeof (str_dict), "%-22s %s",
lang_tag, lang);
}
weechat_printf (NULL, " %s", str_dict);
}
if (lang)
free (lang);
if (country)
free (country);
}
#endif
/*
* Displays list of aspell dictionaries installed on system.
*/
@ -78,16 +139,14 @@ weechat_aspell_command_iso_to_country (const char *code)
void
weechat_aspell_command_speller_list_dicts ()
{
char *country, *lang, *pos;
#ifndef USE_ENCHANT
char *country, *lang, *pos, *iso;
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);
#endif
weechat_printf (NULL, "");
weechat_printf (NULL,
@ -95,6 +154,14 @@ weechat_aspell_command_speller_list_dicts ()
_( "%s dictionaries list:"),
ASPELL_PLUGIN_NAME);
#ifdef USE_ENCHANT
enchant_broker_list_dicts (broker, weechat_aspell_enchant_dict_describe_cb,
NULL);
#else
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)
{
country = NULL;
@ -102,10 +169,13 @@ weechat_aspell_command_speller_list_dicts ()
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);
iso = weechat_strndup (dict->code, pos - dict->code);
if (iso)
{
lang = weechat_aspell_command_iso_to_lang (iso);
country = weechat_aspell_command_iso_to_country (pos + 1);
free (iso);
}
}
else
lang = weechat_aspell_command_iso_to_lang ((char*)dict->code);
@ -132,6 +202,7 @@ weechat_aspell_command_speller_list_dicts ()
delete_aspell_dict_info_enumeration (elements);
delete_aspell_config (config);
#endif
}
/*
@ -169,7 +240,11 @@ weechat_aspell_command_add_word (struct t_gui_buffer *buffer, const char *dict,
const char *word)
{
struct t_aspell_speller_buffer *ptr_speller_buffer;
#ifdef USE_ENCHANT
EnchantDict *new_speller, *ptr_speller;
#else
AspellSpeller *new_speller, *ptr_speller;
#endif
new_speller = NULL;
@ -221,6 +296,9 @@ weechat_aspell_command_add_word (struct t_gui_buffer *buffer, const char *dict,
ptr_speller = ptr_speller_buffer->spellers[0];
}
#ifdef USE_ENCHANT
enchant_dict_add (ptr_speller, word, strlen (word));
#else
if (aspell_speller_add_to_personal (ptr_speller,
word,
strlen (word)) == 1)
@ -231,6 +309,7 @@ weechat_aspell_command_add_word (struct t_gui_buffer *buffer, const char *dict,
}
else
goto error;
#endif
goto end;
@ -265,9 +344,16 @@ weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer,
{
/* display aspell status */
weechat_printf (NULL, "");
weechat_printf (NULL, "%s",
(aspell_enabled) ?
_("Aspell is enabled") : _("Aspell is disabled"));
weechat_printf (NULL,
/* TRANSLATORS: second "%s" is "aspell" or "enchant" */
_("%s (using %s)"),
(aspell_enabled) ? _("Spell checking is enabled") : _("Spell checking is disabled"),
#ifdef USE_ENCHANT
"enchant"
#else
"aspell"
#endif
);
default_dict = weechat_config_string (weechat_aspell_config_check_default_dict);
weechat_printf (NULL,
_("Default dictionary: %s"),

View File

@ -54,6 +54,28 @@ weechat_aspell_completion_langs_cb (void *data, const char *completion_item,
return WEECHAT_RC_OK;
}
/*
* Adds a dictionary to completion when using enchant.
*/
#ifdef USE_ENCHANT
void
weechat_aspell_completion_enchant_add_dict_cb (const char *lang_tag,
const char *provider_name,
const char *provider_desc,
const char *provider_file,
void *user_data)
{
/* make C compiler happy */
(void) provider_name;
(void) provider_desc;
(void) provider_file;
weechat_hook_completion_list_add ((struct t_gui_completion *)user_data,
lang_tag, 0, WEECHAT_LIST_POS_SORT);
}
#endif
/*
* Adds aspell dictionaries (only installed dictionaries) to completion list.
*/
@ -64,16 +86,23 @@ weechat_aspell_completion_dicts_cb (void *data,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
#ifndef USE_ENCHANT
struct AspellConfig *config;
AspellDictInfoList *list;
AspellDictInfoEnumeration *elements;
const AspellDictInfo *dict;
#endif
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
#ifdef USE_ENCHANT
enchant_broker_list_dicts (broker,
weechat_aspell_completion_enchant_add_dict_cb,
completion);
#else
config = new_aspell_config ();
list = get_aspell_dict_info_list (config);
elements = aspell_dict_info_list_elements (list);
@ -86,6 +115,7 @@ weechat_aspell_completion_dicts_cb (void *data,
delete_aspell_dict_info_enumeration (elements);
delete_aspell_config (config);
#endif
return WEECHAT_RC_OK;
}

View File

@ -53,6 +53,9 @@ struct t_hashtable *weechat_aspell_speller_buffer = NULL;
int
weechat_aspell_speller_dict_supported (const char *lang)
{
#ifdef USE_ENCHANT
return enchant_broker_dict_exists (broker, lang);
#else
struct AspellConfig *config;
AspellDictInfoList *list;
AspellDictInfoEnumeration *elements;
@ -78,6 +81,7 @@ weechat_aspell_speller_dict_supported (const char *lang)
delete_aspell_config (config);
return rc;
#endif
}
/*
@ -119,12 +123,20 @@ weechat_aspell_speller_check_dictionaries (const char *dict_list)
* Returns pointer to new aspell speller, NULL if error.
*/
#ifdef USE_ENCHANT
EnchantDict *
#else
AspellSpeller *
#endif
weechat_aspell_speller_new (const char *lang)
{
#ifdef USE_ENCHANT
EnchantDict *new_speller;
#else
AspellConfig *config;
AspellCanHaveError *ret;
AspellSpeller *new_speller;
#endif
struct t_infolist *infolist;
if (!lang)
@ -137,23 +149,40 @@ weechat_aspell_speller_new (const char *lang)
ASPELL_PLUGIN_NAME, lang);
}
#ifdef USE_ENCHANT
new_speller = enchant_broker_request_dict (broker, lang);
if (!new_speller)
{
weechat_printf (NULL,
_("%s%s: error: unable to create speller for lang \"%s\""),
weechat_prefix ("error"), ASPELL_PLUGIN_NAME,
lang);
return NULL;
}
#else
/* create a speller instance for the newly created cell */
config = new_aspell_config();
aspell_config_replace (config, "lang", lang);
#endif
/* apply all options on speller */
/* apply all options */
infolist = weechat_infolist_get ("option", NULL, "aspell.option.*");
if (infolist)
{
while (weechat_infolist_next (infolist))
{
#ifdef USE_ENCHANT
/* TODO: set option with enchant */
#else
aspell_config_replace (config,
weechat_infolist_string (infolist, "option_name"),
weechat_infolist_string (infolist, "value"));
#endif
}
weechat_infolist_free (infolist);
}
#ifndef USE_ENCHANT
ret = new_aspell_speller (config);
if (aspell_error (ret) != 0)
@ -168,10 +197,14 @@ weechat_aspell_speller_new (const char *lang)
}
new_speller = to_aspell_speller (ret);
#endif
weechat_hashtable_set (weechat_aspell_spellers, lang, new_speller);
#ifndef USE_ENCHANT
/* free configuration */
delete_aspell_config (config);
#endif
return new_speller;
}
@ -277,7 +310,11 @@ void
weechat_aspell_speller_free_value_cb (struct t_hashtable *hashtable,
const void *key, void *value)
{
#ifdef USE_ENCHANT
EnchantDict *ptr_speller;
#else
AspellSpeller *ptr_speller;
#endif
/* make C compiler happy */
(void) hashtable;
@ -289,10 +326,15 @@ weechat_aspell_speller_free_value_cb (struct t_hashtable *hashtable,
ASPELL_PLUGIN_NAME, (const char *)key);
}
/* free aspell data */
/* free speller */
#ifdef USE_ENCHANT
ptr_speller = (EnchantDict *)value;
enchant_broker_free_dict (broker, ptr_speller);
#else
ptr_speller = (AspellSpeller *)value;
aspell_speller_save_all_word_lists (ptr_speller);
delete_aspell_speller (ptr_speller);
#endif
}
/*
@ -307,7 +349,11 @@ weechat_aspell_speller_buffer_new (struct t_gui_buffer *buffer)
char **dicts;
int num_dicts, i;
struct t_aspell_speller_buffer *new_speller_buffer;
#ifdef USE_ENCHANT
EnchantDict *ptr_speller;
#else
AspellSpeller *ptr_speller;
#endif
if (!buffer)
return NULL;
@ -330,7 +376,11 @@ weechat_aspell_speller_buffer_new (struct t_gui_buffer *buffer)
if (dicts && (num_dicts > 0))
{
new_speller_buffer->spellers =
#ifdef USE_ENCHANT
malloc ((num_dicts + 1) * sizeof (EnchantDict *));
#else
malloc ((num_dicts + 1) * sizeof (AspellSpeller *));
#endif
if (new_speller_buffer->spellers)
{
for (i = 0; i < num_dicts; i++)

View File

@ -23,7 +23,11 @@
struct t_aspell_speller_buffer
{
AspellSpeller **spellers; /* pointer to spellers for buf. */
#ifdef USE_ENCHANT
EnchantDict **spellers; /* enchant spellers for buffer */
#else
AspellSpeller **spellers; /* aspell spellers for buffer */
#endif
char *modifier_string; /* last modifier string */
int input_pos; /* position of cursor in input */
char *modifier_result; /* last modifier result */
@ -34,7 +38,11 @@ extern struct t_hashtable *weechat_aspell_speller_buffer;
extern int weechat_aspell_speller_dict_supported (const char *lang);
extern void weechat_aspell_speller_check_dictionaries (const char *dict_list);
#ifdef USE_ENCHANT
extern EnchantDict *weechat_aspell_speller_new (const char *lang);
#else
extern AspellSpeller *weechat_aspell_speller_new (const char *lang);
#endif
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 ();

View File

@ -47,6 +47,10 @@ struct t_weechat_plugin *weechat_aspell_plugin = NULL;
int aspell_enabled = 0;
#ifdef USE_ENCHANT
EnchantBroker *broker = NULL;
#endif
/*
* aspell supported languages, updated on 2012-07-05
* URL: ftp://ftp.gnu.org/gnu/aspell/dict/0index.html
@ -410,7 +414,11 @@ weechat_aspell_check_word (struct t_gui_buffer *buffer,
{
for (i = 0; speller_buffer->spellers[i]; i++)
{
#ifdef USE_ENCHANT
if (enchant_dict_check (speller_buffer->spellers[i], word, strlen (word)) == 0)
#else
if (aspell_speller_check (speller_buffer->spellers[i], word, -1) == 1)
#endif
return 1;
}
}
@ -434,8 +442,13 @@ weechat_aspell_get_suggestions (struct t_aspell_speller_buffer *speller_buffer,
int i, size, max_suggestions, num_suggestions;
char *suggestions, *suggestions2;
const char *ptr_word;
#ifdef USE_ENCHANT
char **elements;
size_t num_elements;
#else
const AspellWordList *list;
AspellStringEnumeration *elements;
#endif
max_suggestions = weechat_config_integer (weechat_aspell_config_check_suggestions);
if (max_suggestions < 0)
@ -451,6 +464,37 @@ weechat_aspell_get_suggestions (struct t_aspell_speller_buffer *speller_buffer,
{
for (i = 0; speller_buffer->spellers[i]; i++)
{
#ifdef USE_ENCHANT
elements = enchant_dict_suggest (speller_buffer->spellers[i], word,
-1, &num_elements);
if (elements)
{
if (num_elements > 0)
{
num_suggestions = 0;
while ((ptr_word = elements[num_suggestions]) != NULL)
{
size += strlen (ptr_word) + ((suggestions[0]) ? 1 : 0);
suggestions2 = realloc (suggestions, size);
if (!suggestions2)
{
free (suggestions);
enchant_dict_free_string_list (speller_buffer->spellers[i],
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;
}
}
enchant_dict_free_string_list (speller_buffer->spellers[i], elements);
}
#else
list = aspell_speller_suggest (speller_buffer->spellers[i], word, -1);
if (list)
{
@ -476,6 +520,7 @@ weechat_aspell_get_suggestions (struct t_aspell_speller_buffer *speller_buffer,
}
delete_aspell_string_enumeration (elements);
}
#endif
}
}
@ -876,6 +921,13 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_plugin = plugin;
#ifdef USE_ENCHANT
/* acquire enchant broker */
broker = enchant_broker_init ();
if (!broker)
return WEECHAT_RC_ERROR;
#endif
if (!weechat_aspell_speller_init ())
return WEECHAT_RC_ERROR;
@ -926,5 +978,10 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
weechat_aspell_speller_end ();
#ifdef USE_ENCHANT
/* release enchant broker */
enchant_broker_free (broker);
#endif
return WEECHAT_RC_OK;
}

View File

@ -21,7 +21,11 @@
#ifndef __WEECHAT_ASPELL_H
#define __WEECHAT_ASPELL_H 1
#ifdef USE_ENCHANT
#include <enchant.h>
#else
#include <aspell.h>
#endif
#define weechat_plugin weechat_aspell_plugin
#define ASPELL_PLUGIN_NAME "aspell"
@ -32,6 +36,10 @@ struct t_aspell_code
char *name;
};
#ifdef USE_ENCHANT
extern EnchantBroker *broker;
#endif
extern struct t_weechat_plugin *weechat_aspell_plugin;
extern int aspell_enabled;
extern struct t_aspell_code aspell_langs[];