call g_i18n_init() in gettext_initialization(). do gettext_initialization

2008-05-11  Yair Hershkovitz  <yairhr@gmail.com>

        * gtk/gtkmain.c: call g_i18n_init() in gettext_initialization(). do
        gettext_initialization only once.

        *  gtk/gtkbuilderparser.c: use glib i18n api. removed dpgettext() as it
        duplicates g_dpgettext() and added _g_dpgettext() to wrap g_dpgettext 
        with the extended functionality that was in the removed dpgettext().

        * gtk/gtkaccellabelc:
        * gtk/gtkstock.c:
        * gtk/gtkimmulticontext.c:
        * gtk/gtkactiongroup.c:
        * gtk/gtkintl.h: use glib i18n api.


svn path=/trunk/; revision=20091
This commit is contained in:
Yair Hershkovitz
2008-05-11 09:49:30 +00:00
committed by Yair Hershkovitz
parent 1103d790b1
commit 670775d8d8
8 changed files with 34 additions and 28 deletions

View File

@ -755,13 +755,10 @@ 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)
_g_dpgettext (const char *domain,
const char *msgctxt,
const char *msgid)
{
size_t msgctxt_len = strlen (msgctxt) + 1;
size_t msgid_len = strlen (msgid) + 1;
@ -771,22 +768,10 @@ dpgettext (const char *domain,
msg_ctxt_id = g_alloca (msgctxt_len + msgid_len);
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
msg_ctxt_id[msgctxt_len - 1] = '\004';
msg_ctxt_id[msgctxt_len - 1] = '|';
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
translation = 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 = dgettext (domain, msg_ctxt_id);
if (translation == msg_ctxt_id)
return msgid;
}
return translation;
return g_dpgettext (domain, msg_ctxt_id, 0);
}
gchar *
@ -797,9 +782,9 @@ _gtk_builder_parser_translate (const gchar *domain,
const char *s;
if (context)
s = dpgettext (domain, context, text);
s = _g_dpgettext (domain, context, text);
else
s = dgettext (domain, text);
s = g_dgettext (domain, text);
return g_strdup (s);
}