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:
committed by
Yair Hershkovitz
parent
1103d790b1
commit
670775d8d8
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2008-05-08 Richard Hult <richard@imendio.com>
|
2008-05-08 Richard Hult <richard@imendio.com>
|
||||||
|
|
||||||
* gdk/quartz/gdkgeometry-quartz.c (gdk_window_scroll): Move the
|
* gdk/quartz/gdkgeometry-quartz.c (gdk_window_scroll): Move the
|
||||||
|
|||||||
@ -646,7 +646,7 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
|
|||||||
|
|
||||||
strcpy (msg, "keyboard label|");
|
strcpy (msg, "keyboard label|");
|
||||||
g_strlcat (msg, tmp, 128);
|
g_strlcat (msg, tmp, 128);
|
||||||
str = dgettext (GETTEXT_PACKAGE, msg);
|
str = g_dgettext (GETTEXT_PACKAGE, msg);
|
||||||
if (str == msg)
|
if (str == msg)
|
||||||
{
|
{
|
||||||
g_string_append (gstring, tmp);
|
g_string_append (gstring, tmp);
|
||||||
|
|||||||
@ -1280,7 +1280,7 @@ dgettext_swapped (const gchar *msgid,
|
|||||||
{
|
{
|
||||||
/* Pass through dgettext if and only if msgid is nonempty. */
|
/* Pass through dgettext if and only if msgid is nonempty. */
|
||||||
if (msgid && *msgid)
|
if (msgid && *msgid)
|
||||||
return dgettext (domainname, msgid);
|
return g_dgettext (domainname, msgid);
|
||||||
else
|
else
|
||||||
return (gchar*) msgid;
|
return (gchar*) msgid;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -755,11 +755,8 @@ start_element (GMarkupParseContext *context,
|
|||||||
element_name);
|
element_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is taken from gettext.h
|
|
||||||
* GNU gettext uses '\004' to separate context and msgid in .mo files.
|
|
||||||
*/
|
|
||||||
static const char *
|
static const char *
|
||||||
dpgettext (const char *domain,
|
_g_dpgettext (const char *domain,
|
||||||
const char *msgctxt,
|
const char *msgctxt,
|
||||||
const char *msgid)
|
const char *msgid)
|
||||||
{
|
{
|
||||||
@ -771,22 +768,10 @@ dpgettext (const char *domain,
|
|||||||
msg_ctxt_id = g_alloca (msgctxt_len + msgid_len);
|
msg_ctxt_id = g_alloca (msgctxt_len + msgid_len);
|
||||||
|
|
||||||
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
|
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);
|
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
|
||||||
|
|
||||||
translation = dgettext (domain, msg_ctxt_id);
|
return g_dpgettext (domain, msg_ctxt_id, 0);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
@ -797,9 +782,9 @@ _gtk_builder_parser_translate (const gchar *domain,
|
|||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
if (context)
|
if (context)
|
||||||
s = dpgettext (domain, context, text);
|
s = _g_dpgettext (domain, context, text);
|
||||||
else
|
else
|
||||||
s = dgettext (domain, text);
|
s = g_dgettext (domain, text);
|
||||||
|
|
||||||
return g_strdup (s);
|
return g_strdup (s);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -590,7 +590,7 @@ gtk_im_multicontext_append_menuitems (GtkIMMulticontext *context,
|
|||||||
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
|
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
|
||||||
bind_textdomain_codeset (contexts[i]->domain, "UTF-8");
|
bind_textdomain_codeset (contexts[i]->domain, "UTF-8");
|
||||||
#endif
|
#endif
|
||||||
translated_name = dgettext (contexts[i]->domain, contexts[i]->context_name);
|
translated_name = g_dgettext (contexts[i]->domain, contexts[i]->context_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
#define P_(String) dgettext(GETTEXT_PACKAGE "-properties",String)
|
#define P_(String) g_dgettext(GETTEXT_PACKAGE "-properties",String)
|
||||||
#else
|
#else
|
||||||
#define P_(String) (String)
|
#define P_(String) (String)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -177,6 +177,7 @@ const guint gtk_interface_age = GTK_INTERFACE_AGE;
|
|||||||
static guint gtk_main_loop_level = 0;
|
static guint gtk_main_loop_level = 0;
|
||||||
static gint pre_initialized = FALSE;
|
static gint pre_initialized = FALSE;
|
||||||
static gint gtk_initialized = FALSE;
|
static gint gtk_initialized = FALSE;
|
||||||
|
static gint gettext_initialized = FALSE;
|
||||||
static GList *current_events = NULL;
|
static GList *current_events = NULL;
|
||||||
|
|
||||||
static GSList *main_loops = NULL; /* stack of currently executing main loops */
|
static GSList *main_loops = NULL; /* stack of currently executing main loops */
|
||||||
@ -630,6 +631,10 @@ do_pre_parse_initialization (int *argc,
|
|||||||
static void
|
static void
|
||||||
gettext_initialization (void)
|
gettext_initialization (void)
|
||||||
{
|
{
|
||||||
|
if (gettext_initialized)
|
||||||
|
return;
|
||||||
|
gettext_initialized = TRUE;
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
bindtextdomain (GETTEXT_PACKAGE, GTK_LOCALEDIR);
|
bindtextdomain (GETTEXT_PACKAGE, GTK_LOCALEDIR);
|
||||||
bindtextdomain (GETTEXT_PACKAGE "-properties", GTK_LOCALEDIR);
|
bindtextdomain (GETTEXT_PACKAGE "-properties", GTK_LOCALEDIR);
|
||||||
@ -637,6 +642,7 @@ gettext_initialization (void)
|
|||||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||||
bind_textdomain_codeset (GETTEXT_PACKAGE "-properties", "UTF-8");
|
bind_textdomain_codeset (GETTEXT_PACKAGE "-properties", "UTF-8");
|
||||||
# endif
|
# endif
|
||||||
|
g_i18n_init();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -176,7 +176,7 @@ gtk_stock_lookup (const gchar *stock_id,
|
|||||||
if (translate != NULL && translate->func != NULL)
|
if (translate != NULL && translate->func != NULL)
|
||||||
item->label = (* translate->func) (item->label, translate->data);
|
item->label = (* translate->func) (item->label, translate->data);
|
||||||
else
|
else
|
||||||
item->label = dgettext (item->translation_domain, item->label);
|
item->label = g_dgettext (item->translation_domain, item->label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,7 +457,7 @@ sgettext_swapped (const gchar *msgid,
|
|||||||
{
|
{
|
||||||
gchar *domainname = data;
|
gchar *domainname = data;
|
||||||
|
|
||||||
return (gchar *)g_strip_context (msgid, dgettext (domainname, msgid));
|
return (gchar *)g_strip_context (msgid, g_dgettext (domainname, msgid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user