rpms/gnome-translate/devel gnome-translate-0.99-enchant.patch, NONE, 1.1 gnome-translate.spec, 1.15, 1.16
Dmitry Butskoy
buc at fedoraproject.org
Mon Jul 13 15:34:52 UTC 2009
Author: buc
Update of /cvs/extras/rpms/gnome-translate/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19053
Modified Files:
gnome-translate.spec
Added Files:
gnome-translate-0.99-enchant.patch
Log Message:
gnome-translate-0.99-enchant.patch:
--- NEW FILE gnome-translate-0.99-enchant.patch ---
diff -ru gnome-translate-0.99.orig/configure.ac gnome-translate-0.99/configure.ac
--- gnome-translate-0.99.orig/configure.ac 2009-06-29 11:16:34.000000000 +0100
+++ gnome-translate-0.99/configure.ac 2009-06-29 12:42:31.000000000 +0100
@@ -56,7 +56,7 @@
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
if GT_FEATURE_ENABLED(language-detection); then
- AM_PATH_ASPELL(, [GT_FEATURE_DISABLE(language-detection, [Aspell not found])])
+ PKG_CHECK_MODULES(ENCHANT, [enchant],, [AC_MSG_ERROR([unable to find enchant])])
fi
### Automake conditionals
@@ -74,7 +74,6 @@
data/Makefile
help/Makefile
help/C/Makefile
- m4/Makefile
po/Makefile.in
src/Makefile
ui/Makefile)
diff -ru gnome-translate-0.99.orig/INSTALL gnome-translate-0.99/INSTALL
--- gnome-translate-0.99.orig/INSTALL 2009-06-29 11:16:34.000000000 +0100
+++ gnome-translate-0.99/INSTALL 2009-06-29 12:42:31.000000000 +0100
@@ -35,8 +35,8 @@
* for language detection:
- GNU Aspell
- http://aspell.sourceforge.net/
+ enchant
+ http://www.abisource.com/projects/enchant/
2. Instructions
diff -ru gnome-translate-0.99.orig/Makefile.am gnome-translate-0.99/Makefile.am
--- gnome-translate-0.99.orig/Makefile.am 2009-06-29 11:16:34.000000000 +0100
+++ gnome-translate-0.99/Makefile.am 2009-06-29 12:42:31.000000000 +0100
@@ -1,4 +1,4 @@
-SUBDIRS = art data help m4 po src ui
+SUBDIRS = art data help po src ui
EXTRA_DIST = \
autogen.sh \
diff -ru gnome-translate-0.99.orig/src/gt-language-detection.c gnome-translate-0.99/src/gt-language-detection.c
--- gnome-translate-0.99.orig/src/gt-language-detection.c 2009-06-29 11:16:34.000000000 +0100
+++ gnome-translate-0.99/src/gt-language-detection.c 2009-06-29 21:13:39.000000000 +0100
@@ -21,7 +21,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <translate.h>
-#include <aspell.h>
+#include <enchant.h>
#include "gt-language-detection.h"
#include "gt-app.h"
#include "gt-util.h"
@@ -32,7 +32,7 @@
{
int ref_count;
char *tag;
- AspellSpeller *speller;
+ EnchantDict *speller;
int score;
} Speller;
@@ -51,6 +51,7 @@
G_LOCK_DEFINE_STATIC(self);
+static EnchantBroker *broker = NULL;
static GSList *spellers = NULL;
static GAsyncQueue *detect_queue = NULL;
@@ -71,7 +72,7 @@
static void gt_language_detection_enable (void);
static void gt_language_detection_disable (void);
-static Speller *gt_language_detection_speller_new (const char *tag, GError **err);
+static Speller *gt_language_detection_speller_new (const char *tag);
static Speller *gt_language_detection_speller_ref (Speller *speller);
static void gt_language_detection_speller_unref (Speller *speller);
@@ -115,6 +116,9 @@
{
TranslateSession *session;
+ if (!broker)
+ broker = enchant_broker_init();
+
session = gt_shell_get_translate_session(gt_shell);
gt_thread_create(gt_app_window, gt_language_detection_create_spellers_thread, g_object_ref(session));
}
@@ -123,54 +127,34 @@
gt_language_detection_create_spellers_thread (gpointer data)
{
TranslateSession *session = data;
- AspellConfig *config;
- AspellDictInfoList *dict_list;
- AspellDictInfoEnumeration *dict_enum;
+ GSList *next;
GSList *pairs;
- const AspellDictInfo *dict_info;
GSList *new_spellers = NULL;
+ GHashTable *from_targets;
- config = new_aspell_config();
- dict_list = get_aspell_dict_info_list(config);
- delete_aspell_config(config);
+ from_targets = g_hash_table_new(g_str_hash, g_str_equal);
- dict_enum = aspell_dict_info_list_elements(dict_list);
pairs = translate_session_get_pairs(session);
- while ((dict_info = aspell_dict_info_enumeration_next(dict_enum)))
+ for (next = g_slist_next(pairs); next != NULL; next = g_slist_next (next))
{
- TranslatePair *pair = translate_pairs_find(pairs, dict_info->code, NULL);
+ TranslatePair *pair = next->data;
+ const char *lang_code;
+
+ lang_code = pair ? translate_pair_get_from(pair) : NULL;
- if (pair
- && translate_pair_get_flags(pair) & TRANSLATE_PAIR_TEXT
- && ! g_slist_find_custom(new_spellers,
- dict_info->code,
- (GCompareFunc) gt_language_detection_speller_compare_tag))
+ if (lang_code
+ && (translate_pair_get_flags(pair) & TRANSLATE_PAIR_TEXT)
+ && ! g_hash_table_lookup(from_targets, lang_code))
{
- Speller *speller;
- GError *err = NULL;
-
- speller = gt_language_detection_speller_new(dict_info->code, &err);
+ Speller *speller = gt_language_detection_speller_new(lang_code);
if (speller)
new_spellers = g_slist_append(new_spellers, speller);
- else
- {
- char *primary;
-
- primary = g_strdup_printf(_("Unable to use %s dictionary"), translate_get_language_name(dict_info->code));
-
- GDK_THREADS_ENTER();
- gt_error_dialog(gt_app_window, primary, "%s", err->message);
- gdk_flush();
- GDK_THREADS_LEAVE();
-
- g_free(primary);
- g_error_free(err);
- }
+ g_hash_table_insert(from_targets, (gpointer) lang_code, (gpointer)1);
}
}
- delete_aspell_dict_info_enumeration(dict_enum);
+ g_hash_table_destroy(from_targets);
gt_g_object_slist_free(pairs);
G_LOCK(self);
@@ -185,7 +169,7 @@
GDK_THREADS_ENTER();
gt_error_dialog(gt_app_window,
_("Language detection not available"),
- _("Less than two languages or Aspell dictionaries are available."));
+ _("Less than two languages or spelling dictionaries are available."));
gdk_flush();
GDK_THREADS_LEAVE();
@@ -236,37 +220,27 @@
detect_queue = NULL; /* unreffed by thread */
eel_g_slist_free_deep_custom(spellers, (GFunc) gt_language_detection_speller_unref, NULL);
spellers = NULL;
+ if (broker)
+ {
+ enchant_broker_free(broker);
+ broker = NULL;
+ }
}
}
static Speller *
-gt_language_detection_speller_new (const char *tag, GError **err)
+gt_language_detection_speller_new (const char *tag)
{
- AspellConfig *config;
Speller *speller = NULL;
+ EnchantDict *dict;
- config = new_aspell_config();
-
- if (aspell_config_replace(config, "encoding", "utf-8")
- && aspell_config_replace(config, "master", tag))
+ if ((dict = enchant_broker_request_dict(broker, tag)))
{
- AspellCanHaveError *possible_err;
-
- possible_err = new_aspell_speller(config);
- if (aspell_error_number(possible_err) == 0)
- {
- speller = g_new0(Speller, 1);
- speller->ref_count = 1;
- speller->tag = g_strdup(tag);
- speller->speller = to_aspell_speller(possible_err);
- }
- else
- g_set_error(err, 0, 0, "%s", aspell_error_message(possible_err));
+ speller = g_new0(Speller, 1);
+ speller->ref_count = 1;
+ speller->tag = g_strdup(tag);
+ speller->speller = dict;
}
- else
- g_set_error(err, 0, 0, "%s", aspell_config_error_message(config));
-
- delete_aspell_config(config);
return speller;
}
@@ -289,7 +263,7 @@
if (g_atomic_int_dec_and_test(&speller->ref_count))
{
g_free(speller->tag);
- delete_aspell_speller(speller->speller);
+ enchant_broker_free_dict(broker, speller->speller);
g_free(speller);
}
}
@@ -368,7 +342,7 @@
request = g_async_queue_pop(queue);
start:
- if (request->type == REQUEST_DETECT_LANGUAGE)
+ if (request->type == REQUEST_DETECT_LANGUAGE && request->spellers)
{
GSList *l;
Speller *speller1;
@@ -397,7 +371,7 @@
goto start;
}
- if (aspell_speller_check(speller->speller, word, -1) == 1)
+ if (enchant_dict_check(speller->speller, word, strlen(word)) == 0)
speller->score++;
}
@@ -414,7 +388,7 @@
if (speller1->score - speller2->score >= 10)
break;
}
-
+
/* we only give an opinion if there is no tie */
if (speller1->score != speller2->score)
result_func(speller1->tag, result_user_data);
@@ -443,12 +417,6 @@
}
static int
-gt_language_detection_speller_compare_tag (const Speller *a, const char *tag)
-{
- return g_ascii_strcasecmp(a->tag, tag);
-}
-
-static int
gt_language_detection_speller_compare_score (const Speller *a, const Speller *b)
{
return a->score - b->score;
diff -ru gnome-translate-0.99.orig/src/Makefile.am gnome-translate-0.99/src/Makefile.am
--- gnome-translate-0.99.orig/src/Makefile.am 2009-06-29 11:16:34.000000000 +0100
+++ gnome-translate-0.99/src/Makefile.am 2009-06-29 12:42:31.000000000 +0100
@@ -37,7 +37,7 @@
gt-util.c \
gt-util.h
-AM_CPPFLAGS = $(WARN_CFLAGS) $(GNOME_CFLAGS) $(LIBTRANSLATE_CFLAGS) $(ASPELL_CFLAGS) \
+AM_CPPFLAGS = $(WARN_CFLAGS) $(GNOME_CFLAGS) $(LIBTRANSLATE_CFLAGS) $(ENCHANT_CFLAGS) \
-I$(top_srcdir) \
-DPREFIX="\"$(prefix)\"" \
-DSYSCONFDIR="\"$(sysconfdir)\"" \
@@ -46,7 +46,7 @@
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DUIDIR="\"$(pkgdatadir)/ui\"" \
-DG_LOG_DOMAIN="\"$(PACKAGE)\""
-AM_LDFLAGS = $(INTLLIBS) $(GNOME_LIBS) $(LIBTRANSLATE_LIBS) $(ASPELL_LIBS)
+AM_LDFLAGS = $(INTLLIBS) $(GNOME_LIBS) $(LIBTRANSLATE_LIBS) $(ENCHANT_LIBS)
EXTRA_DIST = eggmarshalers.list
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
Index: gnome-translate.spec
===================================================================
RCS file: /cvs/extras/rpms/gnome-translate/devel/gnome-translate.spec,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -p -r1.15 -r1.16
--- gnome-translate.spec 24 Feb 2009 23:35:00 -0000 1.15
+++ gnome-translate.spec 13 Jul 2009 15:34:51 -0000 1.16
@@ -1,19 +1,20 @@
Name: gnome-translate
Summary: GNOME interface to libtranslate -- Natural language translator
Version: 0.99
-Release: 13%{?dist}
+Release: 14%{?dist}
Group: User Interface/Desktops
License: GPLv2+
URL: http://www.nongnu.org/libtranslate/gnome-translate
Source: http://savannah.nongnu.org/download/libtranslate/gnome-translate-%{version}.tar.gz
Patch0: gnome-translate-0.99-eel2.patch
Patch1: gnome-translate-0.99-selected_tag.patch
+Patch2: gnome-translate-0.99-enchant.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: gtk2 >= 2.4.0, GConf2 >= 2.4.0, eel2 >= 2.6.0, pango >= 1.2.0
BuildRequires: gtk2-devel >= 2.4.0, GConf2-devel >= 2.4.0
-BuildRequires: eel2-devel >= 2.13.0, libtranslate-devel, aspell-devel
+BuildRequires: eel2-devel >= 2.13.0, libtranslate-devel, enchant-devel
BuildRequires: desktop-file-utils >= 0.2.90
BuildRequires: startup-notification-devel >= 0.5
@@ -38,6 +39,7 @@ and it can automatically detect the sour
%setup -q
%patch0 -p1
%patch1 -p1
+%patch2 -p1
%build
@@ -119,6 +121,10 @@ scrollkeeper-update -q || :
%changelog
+* Mon Jul 13 2009 Dmitry Butskoy <Dmitry at Butskoy.name> - 0.99-14
+- Use enchant instead of aspell for language autodetection
+ (#477274, patch by Caolan McNamara <caolanm at redhat.com>)
+
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.99-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
More information about the fedora-extras-commits
mailing list