]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Support for determining the user's language preferences on MacOS X.
authorBruno Haible <bruno@clisp.org>
Mon, 6 Sep 2004 10:34:00 +0000 (10:34 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:11:54 +0000 (12:11 +0200)
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/Makefile.in
gettext-runtime/intl/Makefile.msvc
gettext-runtime/intl/Makefile.vms
gettext-runtime/intl/dcigettext.c
gettext-runtime/intl/gettextP.h
gettext-runtime/m4/ChangeLog
gettext-runtime/m4/gettext.m4

index 1111b9ddbddfa79d8e941092f6a3b39c2373541e..b1d6f98bdfe93e4ba0db30f37f74deda949cbb3f 100644 (file)
@@ -1,3 +1,17 @@
+2004-09-05  Bruno Haible  <bruno@clisp.org>
+
+       * langprefs.c: New file.
+       * gettextP.h (_nl_language_preferences): New declaration.
+       * dcigettext.c (guess_category_value) [!_LIBC]: Use
+       _nl_language_preferences.
+       * Makefile.in (SOURCES): Add langprefs.c.
+       (OBJECTS): Add langprefs.$lo.
+       (langprefs.lo): New rule.
+       * Makefile.msvc (OBJECTS): Add langprefs.obj.
+       (langprefs.obj): New rule.
+       * Makefile.vms (OBJECTS): Add langprefs.obj.
+       (langprefs.obj): New rule.
+
 2004-09-03  Bruno Haible  <bruno@clisp.org>
 
        * localename.c (_nl_locale_name): Use a more intelligent fallback on
index 4a9f2bbd021d454d9f63eafaf3ad12be33371727..71596178268369321b6d07500c8991404d491333 100644 (file)
@@ -98,6 +98,7 @@ SOURCES = \
   plural-exp.c \
   localcharset.c \
   relocatable.c \
+  langprefs.c \
   localename.c \
   log.c \
   printf.c \
@@ -123,6 +124,7 @@ OBJECTS = \
   plural-exp.$lo \
   localcharset.$lo \
   relocatable.$lo \
+  langprefs.$lo \
   localename.$lo \
   log.$lo \
   printf.$lo \
@@ -212,6 +214,8 @@ localcharset.lo: $(srcdir)/localcharset.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localcharset.c
 relocatable.lo: $(srcdir)/relocatable.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/relocatable.c
+langprefs.lo: $(srcdir)/langprefs.c
+       $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/langprefs.c
 localename.lo: $(srcdir)/localename.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localename.c
 log.lo: $(srcdir)/log.c
index 7fbb2f75cf0cdd5df4c53ad90ebd32e455c2a242..038321ee2ae7ac8f58dfa6ada508ab20ef6ea95e 100644 (file)
@@ -99,7 +99,7 @@ INSTALL_DATA = copy
 
 SHELL = /bin/sh
 
-OBJECTS = bindtextdom.obj dcgettext.obj dgettext.obj gettext.obj finddomain.obj loadmsgcat.obj localealias.obj textdomain.obj l10nflist.obj explodename.obj dcigettext.obj dcngettext.obj dngettext.obj ngettext.obj plural.obj plural-exp.obj localcharset.obj relocatable.obj localename.obj log.obj printf.obj osdep.obj intl-compat.obj
+OBJECTS = bindtextdom.obj dcgettext.obj dgettext.obj gettext.obj finddomain.obj loadmsgcat.obj localealias.obj textdomain.obj l10nflist.obj explodename.obj dcigettext.obj dcngettext.obj dngettext.obj ngettext.obj plural.obj plural-exp.obj localcharset.obj relocatable.obj langprefs.obj localename.obj log.obj printf.obj osdep.obj intl-compat.obj
 
 RESOURCES = intl.res
 
@@ -166,6 +166,9 @@ localcharset.obj : $(srcdir)\localcharset.c libgnuintl.h $(srcdir)\localcharset.
 relocatable.obj : $(srcdir)\relocatable.c libgnuintl.h $(srcdir)\relocatable.h
        $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c $(srcdir)\relocatable.c
 
+langprefs.obj : $(srcdir)\langprefs.c libgnuintl.h
+       $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c $(srcdir)\langprefs.c
+
 localename.obj : $(srcdir)\localename.c libgnuintl.h
        $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c $(srcdir)\localename.c
 
index 97ab0112994a78b4b3e9f509b8e58b7ff7d6d104..aa5be49d81a73c097b867f5207417076b2d10cd8 100644 (file)
@@ -45,7 +45,7 @@ INSTALL_DATA = copy
 
 #### End of system configuration section. ####
 
-OBJECTS = bindtextdom.obj,dcgettext.obj,dgettext.obj,gettext.obj,finddomain.obj,loadmsgcat.obj,localealias.obj,textdomain.obj,l10nflist.obj,explodename.obj,dcigettext.obj,dcngettext.obj,dngettext.obj,ngettext.obj,plural-parse.obj,plural-exp.obj,localcharset.obj,relocatable.obj,localename.obj,log.obj,osdep.obj,intl-compat.obj
+OBJECTS = bindtextdom.obj,dcgettext.obj,dgettext.obj,gettext.obj,finddomain.obj,loadmsgcat.obj,localealias.obj,textdomain.obj,l10nflist.obj,explodename.obj,dcigettext.obj,dcngettext.obj,dngettext.obj,ngettext.obj,plural-parse.obj,plural-exp.obj,localcharset.obj,relocatable.obj,langprefs.obj,localename.obj,log.obj,osdep.obj,intl-compat.obj
 
 all : intl.olb,libintl.h
        write sys$output "Nothing else to be done for 'all'."
@@ -107,6 +107,9 @@ localcharset.obj : $(srcdir)localcharset.c,libgnuintl.h,$(srcdir)localcharset.h,
 relocatable.obj : $(srcdir)relocatable.c,libgnuintl.h,$(srcdir)relocatable.h
        $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) $(srcdir)relocatable.c
 
+langprefs.obj : $(srcdir)langprefs.c,libgnuintl.h
+       $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) $(srcdir)langprefs.c
+
 localename.obj : $(srcdir)localename.c,libgnuintl.h
        $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) $(srcdir)localename.c
 
index 43765ab5eeb04e7dba34ae7fe5c004f7883b5573..ed455b9d5a141c1c3cf7e234de04b2939d6c455f 100644 (file)
@@ -1133,9 +1133,13 @@ guess_category_value (int category, const char *categoryname)
   /* The highest priority value is the `LANGUAGE' environment
      variable.  But we don't use the value if the currently selected
      locale is the C locale.  This is a GNU extension.  */
+#ifdef _LIBC
   language = getenv ("LANGUAGE");
   if (language != NULL && language[0] == '\0')
     language = NULL;
+#else
+  language = _nl_language_preferences ();
+#endif
 
   /* We have to proceed with the POSIX methods of looking to `LC_ALL',
      `LC_xxx', and `LANG'.  On some systems this can be done by the
index 4d66c3de3145e4b62ed17f09f029379e4b779236..956f817e356e3a8225cea1ef1de624304aee9642 100644 (file)
@@ -1,5 +1,5 @@
 /* Header describing internals of libintl library.
-   Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000-2004 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
 
    This program is free software; you can redistribute it and/or modify it
@@ -151,6 +151,7 @@ struct binding
 extern int _nl_msg_cat_cntr;
 
 #ifndef _LIBC
+const char *_nl_language_preferences (void);
 const char *_nl_locale_name (int category, const char *categoryname);
 #endif
 
index e25651e73a8481bad7ad3bdffca3fb286b472722..da472d859e90d87849e4c3391b4b7f8935cf1727 100644 (file)
@@ -1,3 +1,7 @@
+2004-09-05  Bruno Haible  <bruno@clisp.org>
+
+       * gettext.m4 (AM_INTL_SUBDIR): Test for CFPreferencesCopyAppValue.
+
 2004-09-03  Bruno Haible  <bruno@clisp.org>
 
        * gettext.m4 (AM_INTL_SUBDIR): Add a test for CFLocaleCopyCurrent.
index 3d19644b56c9b9ff5590fda7f7662d68ac30fa10..d27e52ab2b53955467e5d7ff6b4c9f58bb2666d7 100644 (file)
@@ -431,6 +431,23 @@ __fsetlocking])
     gt_LC_MESSAGES
   fi
 
+  dnl Check for API introduced in MacOS X 10.2.
+  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
+    gt_cv_func_CFPreferencesCopyAppValue,
+    [gt_save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
+     gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -framework CoreFoundation"
+     AC_TRY_LINK([#include <CFPreferences.h>],
+       [CFPreferencesCopyAppValue(NULL, NULL)],
+       [gt_cv_func_CFPreferencesCopyAppValue=yes],
+       [gt_cv_func_CFPreferencesCopyAppValue=no])
+     CPPFLAGS="$gt_save_CPPFLAGS"
+     LIBS="$gt_save_LIBS"])
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
+      [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
+  fi
   dnl Check for API introduced in MacOS X 10.3.
   AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
     [gt_save_CPPFLAGS="$CPPFLAGS"
@@ -438,16 +455,18 @@ __fsetlocking])
      gt_save_LIBS="$LIBS"
      LIBS="$LIBS -framework CoreFoundation"
      AC_TRY_LINK([#include <CFLocale.h>], [CFLocaleCopyCurrent();],
-       [gt_cv_func_CFLocaleCopyCurrent=yes], [gt_cv_func_CFLocaleCopyCurrent=no])
+       [gt_cv_func_CFLocaleCopyCurrent=yes],
+       [gt_cv_func_CFLocaleCopyCurrent=no])
      CPPFLAGS="$gt_save_CPPFLAGS"
      LIBS="$gt_save_LIBS"])
   if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
     AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
       [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
+  fi
+  INTL_MACOSX_LDFLAGS=
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
     CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
     INTL_MACOSX_LDFLAGS="-Wl,-framework -Wl,CoreFoundation"
-  else
-    INTL_MACOSX_LDFLAGS=
   fi
   AC_SUBST([INTL_MACOSX_LDFLAGS])