summaryrefslogtreecommitdiff
path: root/pango/pango-language.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@loopnest.org>2015-05-29 22:12:27 +0200
committerKristian Rietveld <kris@loopnest.org>2015-05-29 22:16:18 +0200
commit5ff42dc22274177321ccc698d9388460a2628d2a (patch)
treecd735a94273377c082fa1572ac41a63808887af0 /pango/pango-language.c
parentea326fdf0d2c12ef0d4c58882b795caa3f0050bc (diff)
downloadpango-5ff42dc22274177321ccc698d9388460a2628d2a.tar.gz
coretext: handle locale set through environment variables
Diffstat (limited to 'pango/pango-language.c')
-rw-r--r--pango/pango-language.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/pango/pango-language.c b/pango/pango-language.c
index 1247ae72..725559fa 100644
--- a/pango/pango-language.c
+++ b/pango/pango-language.c
@@ -205,7 +205,26 @@ _pango_get_lc_ctype (void)
CFArrayRef languages;
CFStringRef language;
gchar ret[16];
+ gchar *p;
+
+ /* Take the same approach as done for Windows above. First we check
+ * if somebody tried to set the locale through environment variables.
+ */
+ p = getenv ("LC_ALL");
+ if (p != NULL)
+ return g_strdup (p);
+ p = getenv ("LC_CTYPE");
+ if (p != NULL)
+ return g_strdup (p);
+
+ p = getenv ("LANG");
+ if (p != NULL)
+ return g_strdup (p);
+
+ /* If the environment variables are not set, determine the locale
+ * through the platform-native API.
+ */
languages = CFLocaleCopyPreferredLanguages ();
language = CFArrayGetValueAtIndex (languages, 0);