glib r6919 - in trunk: . glib



Author: timj
Date: Tue May 20 13:03:15 2008
New Revision: 6919
URL: http://svn.gnome.org/viewvc/glib?rev=6919&view=rev

Log:
2008-05-20 14:31:18  Tim Janik  <timj imendio com>

        * reverted recent unapproved changes by Yair Hershkovitz, regarding:
        Bug 503071 - Application direction changes to right to left even if theres no translation.




Removed:
   trunk/glib/gi18n.c
Modified:
   trunk/ChangeLog
   trunk/glib/Makefile.am
   trunk/glib/gi18n-lib.h
   trunk/glib/gi18n.h
   trunk/glib/glib.symbols
   trunk/glib/glibintl.h
   trunk/glib/gstrfuncs.c
   trunk/glib/gutils.c

Modified: trunk/glib/Makefile.am
==============================================================================
--- trunk/glib/Makefile.am	(original)
+++ trunk/glib/Makefile.am	Tue May 20 13:03:15 2008
@@ -164,8 +164,7 @@
 	gutils.c		\
 	gdebug.h		\
 	gprintf.c		\
-	gprintfint.h		\
-	gi18n.c
+	gprintfint.h
 
 EXTRA_libglib_2_0_la_SOURCES = \
 	giounix.c	\

Modified: trunk/glib/gi18n-lib.h
==============================================================================
--- trunk/glib/gi18n-lib.h	(original)
+++ trunk/glib/gi18n-lib.h	Tue May 20 13:03:15 2008
@@ -21,13 +21,14 @@
 #define __G_I18N_LIB_H__
 
 #include <glib.h>
-#include <glib/gi18n.h>
+
+#include <libintl.h>
 
 #ifndef GETTEXT_PACKAGE
 #error You must define GETTEXT_PACKAGE before including gi18n-lib.h.
 #endif
 
-#define  _(String) g_dgettext (GETTEXT_PACKAGE, String)
+#define  _(String) dgettext (GETTEXT_PACKAGE, String)
 #define Q_(String) g_dpgettext (GETTEXT_PACKAGE, String, 0)
 #define N_(String) (String)
 #define C_(Context,String) g_dpgettext (GETTEXT_PACKAGE, Context "\004" String, strlen (Context) + 1)

Modified: trunk/glib/gi18n.h
==============================================================================
--- trunk/glib/gi18n.h	(original)
+++ trunk/glib/gi18n.h	Tue May 20 13:03:15 2008
@@ -24,27 +24,9 @@
 
 #include <libintl.h>
 
-#if !defined(__G_I18N_LIB_H__) && !defined(__GLIBINTL_H__)
-#define  _(String) g_gettext (String)
+#define  _(String) gettext (String)
 #define Q_(String) g_dpgettext (NULL, String, 0)
 #define N_(String) (String)
 #define C_(Context,String) g_dpgettext (NULL, Context "\004" String, strlen (Context) + 1)
-#endif
-
-G_BEGIN_DECLS
-
-G_CONST_RETURN gchar *g_gettext        (const gchar *msgid);
-
-G_CONST_RETURN gchar *g_dgettext       (const gchar *domain,
-                                        const gchar *msgid);
-
-G_CONST_RETURN gchar *g_dpgettext      (const gchar *domain,
-                                        const gchar *msgctxtid,
-                                        gsize        msgidoffset);
-
-void		      g_i18n_init      		(void);
-void		      g_disable_setlocale	(void);
-
-G_END_DECLS
 
 #endif  /* __G_I18N_H__ */

Modified: trunk/glib/glib.symbols
==============================================================================
--- trunk/glib/glib.symbols	(original)
+++ trunk/glib/glib.symbols	Tue May 20 13:03:15 2008
@@ -1146,6 +1146,7 @@
 #endif
 g_strv_length
 g_strip_context
+g_dpgettext
 #endif
 #endif
 
@@ -1582,16 +1583,6 @@
 #endif
 #endif
 
-#if IN_HEADER(__G_I18N_H__)
-#if IN_FILE(__G_I18N_C__)
-g_i18n_init
-g_disable_setlocale
-g_gettext
-g_dgettext
-g_dpgettext
-#endif
-#endif
-
 #ifdef INCLUDE_VARIABLES
 g_ascii_table
 g_utf8_skip

Modified: trunk/glib/glibintl.h
==============================================================================
--- trunk/glib/glibintl.h	(original)
+++ trunk/glib/glibintl.h	Tue May 20 13:03:15 2008
@@ -1,8 +1,6 @@
 #ifndef __GLIBINTL_H__
 #define __GLIBINTL_H__
 
-#include <glib/gi18n.h>
-
 #ifndef SIZEOF_CHAR
 #error "config.h must be included prior to glibintl.h"
 #endif

Modified: trunk/glib/gstrfuncs.c
==============================================================================
--- trunk/glib/gstrfuncs.c	(original)
+++ trunk/glib/gstrfuncs.c	Tue May 20 13:03:15 2008
@@ -2844,5 +2844,66 @@
   return i;
 }
 
+
+/**
+ * g_dpgettext:
+ * @domain: the translation domain to use, or %NULL to use
+ *   the domain set with textdomain()
+ * @msgctxtid: a combined message context and message id, separated
+ *   by a \004 character
+ * @msgidoffset: the offset of the message id in @msgctxid
+ *
+ * This function is a variant of dgettext() which supports
+ * a disambiguating message context. GNU gettext uses the
+ * '\004' character to separate the message context and
+ * message id in @msgctxtid.
+ * If 0 is passed as @msgidoffset, this function will fall back to
+ * trying to use the deprecated convention of using "|" as a separation
+ * character.
+ *
+ * Applications should normally not use this function directly,
+ * but use the C_() macro for translations with context.
+ *
+ * Returns: The translated string
+ *
+ * Since: 2.16
+ */
+const gchar *
+g_dpgettext (const gchar *domain, 
+             const gchar *msgctxtid, 
+             gsize        msgidoffset)
+{
+  const gchar *translation;
+  gchar *sep;
+
+  translation = dgettext (domain, msgctxtid);
+
+  if (translation == msgctxtid)
+    {
+      if (msgidoffset > 0)
+        return msgctxtid + msgidoffset;
+
+      sep = strchr (msgctxtid, '|');
+ 
+      if (sep)
+        {
+          /* try with '\004' instead of '|', in case
+           * xgettext -kQ_:1g was used
+           */
+          gchar *tmp = g_alloca (strlen (msgctxtid) + 1);
+          strcpy (tmp, msgctxtid);
+          tmp[sep - msgctxtid] = '\004';
+
+          translation = dgettext (domain, tmp);
+   
+          if (translation == tmp)
+            return sep + 1; 
+        }
+    }
+
+  return translation;
+}
+
+
 #define __G_STRFUNCS_C__
 #include "galiasdef.c"

Modified: trunk/glib/gutils.c
==============================================================================
--- trunk/glib/gutils.c	(original)
+++ trunk/glib/gutils.c	Tue May 20 13:03:15 2008
@@ -3280,7 +3280,7 @@
       _glib_gettext_initialized = TRUE;
     }
   
-  return g_dgettext (GETTEXT_PACKAGE, str);
+  return dgettext (GETTEXT_PACKAGE, str);
 }
 
 #ifdef G_OS_WIN32



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]