This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

support for %I format directive flag in gettext


msgfmt has been extended to allow an 'I' flag in format directives, that
can be used by translators for locales containing an 'outdigits' specification,
e.g. Farsi (Persian).

Since this flag is not portable, it has to be dropped by the gettext()
function on non-glibc platforms, and therefore requires additional
processing when a message catalog is loaded, in intl/loadmsgcat.c.

This patch does it. It will also be released as part of gettext-0.14.
For the reasons explained in http://sources.redhat.com/ml/libc-alpha/2004-01/msg00154.html,
.mo files using this feature need to have a new major revision.


2004-01-09  Bruno Haible  <bruno@clisp.org>

	* intl/gmo.h (MO_REVISION_NUMBER_WITH_SYSDEP_I): New definition.
	* intl/loadmsgcat.c (get_sysdep_segment_value): Handle "I".
	(_nl_load_domain): Treat major revision 1 like major revision 0.

--- glibc-20031205/intl/gmo.h.bak	2002-12-11 23:58:23.000000000 +0100
+++ glibc-20031205/intl/gmo.h	2004-01-11 23:35:04.000000000 +0100
@@ -1,5 +1,5 @@
 /* Internal header for GNU gettext internationalization functions.
-   Copyright (C) 1995, 1997, 2000-2002 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1997, 2000-2002, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,6 +30,7 @@
 
 /* Revision number of the currently used .mo (binary) file format.  */
 #define MO_REVISION_NUMBER 0
+#define MO_REVISION_NUMBER_WITH_SYSDEP_I 1
 
 /* The following contortions are an attempt to use the C preprocessor
    to determine an unsigned integral type that is 32 bits wide.  An
@@ -77,7 +78,7 @@
   /* The revision number of the file format.  */
   nls_uint32 revision;
 
-  /* The following are only used in .mo files with major revision 0.  */
+  /* The following are only used in .mo files with major revision 0 or 1.  */
 
   /* The number of strings pairs.  */
   nls_uint32 nstrings;
--- glibc-20031205/intl/loadmsgcat.c.bak	2004-01-11 21:00:55.000000000 +0100
+++ glibc-20031205/intl/loadmsgcat.c	2004-01-11 23:34:45.000000000 +0100
@@ -735,6 +735,18 @@
 	    }
 	}
     }
+  /* Test for a glibc specific printf() format directive flag.  */
+  if (name[0] == 'I' && name[1] == '\0')
+    {
+#if defined _LIBC || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+      /* The 'I' flag, in numeric format directives, replaces ASCII digits
+	 with the 'outdigits' defined in the LC_CTYPE locale facet.  This is
+	 used for Farsi (Persian) and maybe Arabic.  */
+      return "I";
+#else
+      return "";
+#endif
+    }
   /* Other system dependent strings are not valid.  */
   return NULL;
 }
@@ -1009,10 +1021,11 @@
 
   /* Fill in the information about the available tables.  */
   revision = W (domain->must_swap, data->revision);
-  /* We support only the major revision 0.  */
+  /* We support only the major revisions 0 and 1.  */
   switch (revision >> 16)
     {
     case 0:
+    case 1:
       domain->nstrings = W (domain->must_swap, data->nstrings);
       domain->orig_tab = (const struct string_desc *)
 	((char *) data + W (domain->must_swap, data->orig_tab_offset));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]