summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixInit.c
diff options
context:
space:
mode:
authordas <das>2006-09-10 17:04:40 (GMT)
committerdas <das>2006-09-10 17:04:40 (GMT)
commite14e8f4fa399e18ca5749dd5484d5080cbac9b1f (patch)
tree14386549e4ac29f29ddb85a1d1e1b03bbcef3ba5 /unix/tclUnixInit.c
parent609385ccb9bbf225a216eca52a988116f59dc44f (diff)
downloadtcl-e14e8f4fa399e18ca5749dd5484d5080cbac9b1f.zip
tcl-e14e8f4fa399e18ca5749dd5484d5080cbac9b1f.tar.gz
tcl-e14e8f4fa399e18ca5749dd5484d5080cbac9b1f.tar.bz2
* library/msgcat/msgcat.tcl (msgcat::Init): on Darwin, add fallback of
* tests/msgcat.test: default msgcat locale to * unix/tclUnixInit.c (TclpSetVariables): current CFLocale identifier if available (via private ::tcl::mac::locale global, set at interp init when on Mac OS X 10.3 or later with CoreFoundation). * unix/tcl.m4: add caching to new SC_TCL_* macros for MT-safe wrappers. * unix/configure: autoconf-2.13
Diffstat (limited to 'unix/tclUnixInit.c')
-rw-r--r--unix/tclUnixInit.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 1c1f8fc..d36dfd5 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclUnixInit.c,v 1.34.2.13 2006/07/20 06:21:46 das Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.34.2.14 2006/09/10 17:04:42 das Exp $
*/
#if defined(HAVE_COREFOUNDATION)
@@ -783,6 +783,30 @@ TclpSetVariables(interp)
#ifdef HAVE_COREFOUNDATION
char tclLibPath[MAXPATHLEN + 1];
+#if MAC_OS_X_VERSION_MAX_ALLOWED > 1020
+ /*
+ * Set msgcat fallback locale to current CFLocale identifier.
+ */
+ CFLocaleRef localeRef;
+
+ if (CFLocaleCopyCurrent != NULL && CFLocaleGetIdentifier != NULL &&
+ (localeRef = CFLocaleCopyCurrent())) {
+ CFStringRef locale = CFLocaleGetIdentifier(localeRef);
+
+ if (locale) {
+ char loc[256];
+
+ if (CFStringGetCString(locale, loc, 256, kCFStringEncodingUTF8)) {
+ if (!Tcl_CreateNamespace(interp, "::tcl::mac", NULL, NULL)) {
+ Tcl_ResetResult(interp);
+ }
+ Tcl_SetVar(interp, "::tcl::mac::locale", loc, TCL_GLOBAL_ONLY);
+ }
+ }
+ CFRelease(localeRef);
+ }
+#endif
+
if (MacOSXGetLibraryPath(interp, MAXPATHLEN, tclLibPath) == TCL_OK) {
CONST char *str;
Tcl_DString ds;