intl patches (10)

Bruno Haible bruno@clisp.org
Mon Apr 28 11:13:00 GMT 2003


gettext-0.12 introduces some kind of logging of untranslated messages that
can be used by translators to determine priorities. Inside libintl, it
means to invoke some logging code. Inside libc, only the code is rearranged -
no functional changes.


2003-02-16  Bruno Haible  <bruno@clisp.org>

	* intl/dcigettext.c (DCIGETTEXT) [!_LIBC]: Before returning the
	untranslated string, call _nl_log_untranslated.

diff -r -c3 glibc-20030425.orig/intl/dcigettext.c glibc-20030425/intl/dcigettext.c
--- glibc-20030425.orig/intl/dcigettext.c	Mon Dec 16 12:45:53 2002
+++ glibc-20030425/intl/dcigettext.c	Sun Apr 27 13:07:10 2003
@@ -505,17 +524,9 @@
 	}
 
       if (ret == NULL)
-	{
-	  /* We cannot get the current working directory.  Don't signal an
-	     error but simply return the default string.  */
-	  FREE_BLOCKS (block_list);
-	  __libc_rwlock_unlock (_nl_state_lock);
-	  __set_errno (saved_errno);
-	  return (plural == 0
-		  ? (char *) msgid1
-		  /* Use the Germanic plural rule.  */
-		  : n == 1 ? (char *) msgid1 : (char *) msgid2);
-	}
+	/* We cannot get the current working directory.  Don't signal an
+	   error but simply return the default string.  */
+	goto return_untranslated;
 
       stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
     }
@@ -572,16 +583,7 @@
 	 domain.  Return the MSGID.  */
       if (strcmp (single_locale, "C") == 0
 	  || strcmp (single_locale, "POSIX") == 0)
-	{
-	  FREE_BLOCKS (block_list);
-	  __libc_rwlock_unlock (_nl_state_lock);
-	  __set_errno (saved_errno);
-	  return (plural == 0
-		  ? (char *) msgid1
-		  /* Use the Germanic plural rule.  */
-		  : n == 1 ? (char *) msgid1 : (char *) msgid2);
-	}
-
+	break;
 
       /* Find structure describing the message catalog matching the
 	 DOMAINNAME and CATEGORY.  */
@@ -662,7 +664,30 @@
 	    }
 	}
     }
-  /* NOTREACHED */
+
+ return_untranslated:
+  /* Return the untranslated MSGID.  */
+  FREE_BLOCKS (block_list);
+  __libc_rwlock_unlock (_nl_state_lock);
+#ifndef _LIBC
+  if (!ENABLE_SECURE)
+    {
+      extern void _nl_log_untranslated PARAMS ((const char *logfilename,
+						const char *domainname,
+						const char *msgid1,
+						const char *msgid2,
+						int plural));
+      const char *logfilename = getenv ("GETTEXT_LOG_UNTRANSLATED");
+
+      if (logfilename != NULL && logfilename[0] != '\0')
+	_nl_log_untranslated (logfilename, domainname, msgid1, msgid2, plural);
+    }
+#endif
+  __set_errno (saved_errno);
+  return (plural == 0
+	  ? (char *) msgid1
+	  /* Use the Germanic plural rule.  */
+	  : n == 1 ? (char *) msgid1 : (char *) msgid2);
 }
 
 



More information about the Libc-alpha mailing list