[gtranslator] Don't normalize translations stored in the translation memory
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Don't normalize translations stored in the translation memory
- Date: Wed, 12 Oct 2011 14:31:50 +0000 (UTC)
commit c1c77f1328ba0376f5e024800e13b4116016db95
Author: Neil Roberts <neil linux intel com>
Date: Wed Oct 12 11:32:56 2011 +0100
Don't normalize translations stored in the translation memory
The normalization mode previously used by gtranslator when adding to
the translation memory decomposes accented characters into separate
combining characters. This can cause problems where some fonts render
the decomposed characters differently. In particular Cantarell has
problems rendering circumflex accents.
As far as I can see the only reason you might want to normalize the
strings would be when comparing them. However the only place I can see
where the translations are compared is when the translation is
removed. In this case the string compared against is directly taken
from the same database so it should always be exactly the same.
This patch therefore just removes the normalization altogether. If we
did want to compare strings for any other reason I think we should
either store both versions of the translation or try to do the
normalization immediately before the comparison. Modifying the strings
coming from other .po files at all seems like a bad idea.
https://bugzilla.gnome.org/show_bug.cgi?id=660813
src/translation-memory/gda/gtr-gda.c | 17 +++--------------
1 files changed, 3 insertions(+), 14 deletions(-)
---
diff --git a/src/translation-memory/gda/gtr-gda.c b/src/translation-memory/gda/gtr-gda.c
index 9a31481..009662f 100644
--- a/src/translation-memory/gda/gtr-gda.c
+++ b/src/translation-memory/gda/gtr-gda.c
@@ -253,7 +253,6 @@ gtr_gda_store_impl (GtrGda *self,
{
gint orig_id;
gboolean found_translation = FALSE;
- gchar *norm_translation = NULL;
gchar **words = NULL;
GError *inner_error;
@@ -270,9 +269,6 @@ gtr_gda_store_impl (GtrGda *self,
return FALSE;
}
- norm_translation = g_utf8_normalize (translation, -1,
- G_NORMALIZE_DEFAULT);
-
if (orig_id == 0)
{
gsize sz, i;
@@ -314,7 +310,7 @@ gtr_gda_store_impl (GtrGda *self,
orig_id,
"value",
G_TYPE_STRING,
- norm_translation),
+ translation),
&inner_error);
if (inner_error)
goto error;
@@ -329,17 +325,15 @@ gtr_gda_store_impl (GtrGda *self,
"orig_id", G_TYPE_INT,
orig_id,
"value", G_TYPE_STRING,
- norm_translation),
+ translation),
&inner_error);
if (inner_error)
goto error;
}
- g_free (norm_translation);
return TRUE;
error:
- g_free (norm_translation);
g_strfreev (words);
g_propagate_error (error, inner_error);
return FALSE;
@@ -440,16 +434,12 @@ gtr_gda_remove (GtrTranslationMemory *tm,
const gchar *translation)
{
GtrGda *self = GTR_GDA (tm);
- gchar *norm_translation;
GdaSet *params;
GError *error;
- norm_translation = g_utf8_normalize (translation, -1,
- G_NORMALIZE_DEFAULT);
-
params = gda_set_new_inline (2,
"original", G_TYPE_STRING, original,
- "value", G_TYPE_STRING, norm_translation);
+ "value", G_TYPE_STRING, translation);
error = NULL;
gda_connection_statement_execute_non_select (self->priv->db,
@@ -464,7 +454,6 @@ gtr_gda_remove (GtrTranslationMemory *tm,
}
g_object_unref (params);
- g_free (norm_translation);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]