[pango] coretext: handle locale set through environment variables
- From: Kristian Rietveld <kristian src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango] coretext: handle locale set through environment variables
- Date: Sat, 30 May 2015 20:06:19 +0000 (UTC)
commit 5ff42dc22274177321ccc698d9388460a2628d2a
Author: Kristian Rietveld <kris loopnest org>
Date: Fri May 29 22:12:27 2015 +0200
coretext: handle locale set through environment variables
pango/pango-language.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/pango/pango-language.c b/pango/pango-language.c
index 1247ae7..725559f 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]