summaryrefslogtreecommitdiff
path: root/pango/pango-language.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@lanedo.com>2011-09-23 13:50:25 +0200
committerKristian Rietveld <kris@lanedo.com>2011-11-14 10:54:05 +0100
commitc21b1bfe1278de08673c495ba398fbdee874a778 (patch)
tree050f8aa49deb6835db130a15d213ae00e550e488 /pango/pango-language.c
parent6dc1e34f5910fbfc1b62fdf83eeda67edc25bc91 (diff)
downloadpango-c21b1bfe1278de08673c495ba398fbdee874a778.tar.gz
Get _pango_get_lc_ctype from system prefs on Mac OS X
Diffstat (limited to 'pango/pango-language.c')
-rw-r--r--pango/pango-language.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/pango/pango-language.c b/pango/pango-language.c
index 5b8583e9..1cdc4f0c 100644
--- a/pango/pango-language.c
+++ b/pango/pango-language.c
@@ -29,6 +29,10 @@
#include "pango-language.h"
#include "pango-impl-utils.h"
+#ifdef HAVE_CORE_TEXT
+#include <CoreFoundation/CoreFoundation.h>
+#endif /* HAVE_CORE_TEXT */
+
/* We embed a private struct right *before* a where a PangoLanguage *
* points to.
@@ -188,6 +192,23 @@ _pango_get_lc_ctype (void)
return g_strdup (p);
return g_win32_getlocale ();
+#elif HAVE_CORE_TEXT
+ CFArrayRef languages;
+ CFStringRef language;
+ gchar ret[16];
+
+ languages = CFLocaleCopyPreferredLanguages ();
+ language = CFArrayGetValueAtIndex (languages, 0);
+
+ if (!CFStringGetCString (language, ret, 16, kCFStringEncodingUTF8))
+ {
+ CFRelease (languages);
+ return g_strdup (setlocale (LC_CTYPE, NULL));
+ }
+
+ CFRelease (languages);
+
+ return g_strdup (ret);
#else
return g_strdup (setlocale (LC_CTYPE, NULL));
#endif