Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Verwiebe <info@jensverwiebe.de>2013-03-03 02:50:46 +0400
committerJens Verwiebe <info@jensverwiebe.de>2013-03-03 02:50:46 +0400
commit1c5f18f42b4de1dcd90dcb134105db9e11d14d5a (patch)
tree1f5c836c6620d005e378433df282268ff46164a5 /intern/locale
parentb74c686c66f5b18f454422e1af2fed726ad4570f (diff)
OSX: Get the current locale in objC-style
Diffstat (limited to 'intern/locale')
-rw-r--r--intern/locale/boost_locale_wrapper.cpp23
-rw-r--r--intern/locale/boost_locale_wrapper.h6
2 files changed, 6 insertions, 23 deletions
diff --git a/intern/locale/boost_locale_wrapper.cpp b/intern/locale/boost_locale_wrapper.cpp
index ebd2dd652c7..ef22e31e3cf 100644
--- a/intern/locale/boost_locale_wrapper.cpp
+++ b/intern/locale/boost_locale_wrapper.cpp
@@ -66,28 +66,7 @@ void bl_locale_set(const char *locale)
}
else {
#ifdef __APPLE__
- // workaround to get osx system locale from user defaults
- FILE *fp;
- std::string locale_osx = "";
- char result[16];
- int result_len = 0;
-
- fp = popen("defaults read .GlobalPreferences AppleLocale", "r");
-
- if (fp) {
- result_len = fread(result, 1, sizeof(result) - 1, fp);
-
- if (result_len > 0) {
- result[result_len - 1] = '\0'; // \0 terminate and remove \n
- locale_osx = std::string(result) + std::string(".UTF-8");
- }
-
- pclose(fp);
- }
-
- if (locale_osx == "")
- fprintf(stderr, "Locale set: failed to read AppleLocale read from defaults\n");
-
+ std::string locale_osx = user_locale + std::string(".UTF-8");
_locale = gen(locale_osx.c_str());
std::locale::global(_locale);
#else
diff --git a/intern/locale/boost_locale_wrapper.h b/intern/locale/boost_locale_wrapper.h
index 4e3a1f848d2..22f3793ae67 100644
--- a/intern/locale/boost_locale_wrapper.h
+++ b/intern/locale/boost_locale_wrapper.h
@@ -42,7 +42,11 @@ void bl_locale_init(const char *messages_path, const char *default_domain);
void bl_locale_set(const char *locale);
const char *bl_locale_get(void);
const char *bl_locale_pgettext(const char *msgctxt, const char *msgid);
-
+
+#ifdef __APPLE__
+extern const char *user_locale; // pulled from Ghost_SystemCocoa
+#endif
+
#ifdef __cplusplus
}
#endif