summaryrefslogtreecommitdiff
path: root/gtk/gtkbuilderparser.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2009-06-15 18:04:49 -0400
committerMatthias Clasen <mclasen@redhat.com>2009-06-15 18:25:04 -0400
commitde3cc277064937727e2f728113e0d63c64aa3bb8 (patch)
tree0c5da0a0d06130fd1eb412b8925bb4e21a998082 /gtk/gtkbuilderparser.c
parent362127c33c16b8626d4a4b8925bfb7b03bee0b6b (diff)
downloadgtk+-de3cc277064937727e2f728113e0d63c64aa3bb8.tar.gz
Cleanup some translation handling
Use g_*gettext functions in gdk-pixbuf instead direct gettext calls to benefit from the maybe-dont-translate functionality in GLib. Also, replace a hand-rolled version by g_dpgettext2 in gtkbuilderparser.c. Fixes bug 585791.
Diffstat (limited to 'gtk/gtkbuilderparser.c')
-rw-r--r--gtk/gtkbuilderparser.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index c5cb2d8938..f6f12a5bf6 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -893,40 +893,6 @@ start_element (GMarkupParseContext *context,
element_name);
}
-/* This function is taken from gettext.h
- * GNU gettext uses '\004' to separate context and msgid in .mo files.
- */
-static const char *
-_dpgettext (const char *domain,
- const char *msgctxt,
- const char *msgid)
-{
- size_t msgctxt_len = strlen (msgctxt) + 1;
- size_t msgid_len = strlen (msgid) + 1;
- const char *translation;
- char* msg_ctxt_id;
-
- msg_ctxt_id = g_alloca (msgctxt_len + msgid_len);
-
- memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
- msg_ctxt_id[msgctxt_len - 1] = '\004';
- memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
-
- translation = g_dgettext (domain, msg_ctxt_id);
-
- if (translation == msg_ctxt_id)
- {
- /* try the old way of doing message contexts, too */
- msg_ctxt_id[msgctxt_len - 1] = '|';
- translation = g_dgettext (domain, msg_ctxt_id);
-
- if (translation == msg_ctxt_id)
- return msgid;
- }
-
- return translation;
-}
-
gchar *
_gtk_builder_parser_translate (const gchar *domain,
const gchar *context,
@@ -935,7 +901,7 @@ _gtk_builder_parser_translate (const gchar *domain,
const char *s;
if (context)
- s = _dpgettext (domain, context, text);
+ s = g_dpgettext2 (domain, context, text);
else
s = g_dgettext (domain, text);