Index: utils.c
===================================================================
--- utils.c	(revision 3573)
+++ utils.c	(working copy)
@@ -30,6 +30,77 @@
 #include <glade/glade.h>
 #include <gtk/gtk.h>
 
+static gchar *
+create_word_from_positions (const gchar *string,
+			    gint start,
+			    gint end)
+{
+	gchar toret[end+1 - start];
+	gint i = start;
+	gint j = 0;
+	
+	while (i <= end)
+	{
+		toret[j] = string[i];
+		j++;
+		i++;
+	}
+	toret[j] = '\0';
+	
+	return g_strdup (toret);
+}
+
+/**
+ * gtranslator_utils_split_string_in_words:
+ * @string: the text to process
+ *
+ * Process a text and split it in words using pango.
+ * 
+ * Returns: an array of words of the processed text
+ */
+gchar **
+gtranslator_utils_split_string_in_words (const gchar *string)
+{
+	//FIXME: We shouldn't use the default language
+	PangoLanguage *lang = pango_language_get_default ();
+	PangoLogAttr *attrs;
+	GPtrArray *array;
+	gint char_len;
+	gint i = 0;
+	gint start;
+	
+	char_len = g_utf8_strlen (string, -1);
+	attrs = g_new (PangoLogAttr, char_len + 1);
+	
+	pango_get_log_attrs (string,
+			     strlen (string),
+			     -1,
+			     lang,
+			     attrs,
+			     char_len + 1);
+
+	array = g_ptr_array_new ();
+	
+	while (i <= char_len)
+	{
+		if (attrs[i].is_word_start)
+		{
+			start = i;
+		}
+		else if (attrs[i].is_word_end)
+		{
+			gchar *word = create_word_from_positions (string, start, i);
+			g_ptr_array_add (array, word);
+		}
+		i++;
+	}
+	
+	g_free (attrs);
+	g_ptr_array_add (array, NULL);
+	
+	return (gchar **)g_ptr_array_free (array, FALSE);
+}
+
 xmlDocPtr 
 gtranslator_xml_new_doc (const gchar *name) 
 {
Index: utils.h
===================================================================
--- utils.h	(revision 3573)
+++ utils.h	(working copy)
@@ -26,6 +26,8 @@
 #include <gtk/gtkwindow.h>
 #include <libxml/tree.h>
 
+gchar **       gtranslator_utils_split_string_in_words (const gchar *string);
+
 xmlDocPtr      gtranslator_xml_new_doc (const gchar *name);
 
 xmlDocPtr      gtranslator_xml_open_file (const gchar *filename);
