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:
Diffstat (limited to 'source/blender/blenfont/intern/blf_lang.c')
-rw-r--r--source/blender/blenfont/intern/blf_lang.c55
1 files changed, 30 insertions, 25 deletions
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index 024172d6db4..ed684eda46f 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -60,17 +60,14 @@ char global_messagepath[1024];
char global_language[32];
char global_encoding_name[32];
-
-void BLF_lang_init(void)
+#if defined(__APPLE__)
+void BLF_lang_init(void) /* Apple Only, todo - use BLI_gethome_folder */
{
-#ifdef __APPLE__
char *bundlepath;
-#endif
strcpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT);
/* set messagepath directory */
-
#ifndef LOCALEDIR
#define LOCALEDIR "/usr/share/locale"
#endif
@@ -81,44 +78,52 @@ void BLF_lang_init(void)
BLI_make_file_string("/", global_messagepath, BLI_gethome(), ".blender/locale");
if (!BLI_exist(global_messagepath)) { /* locale not in home dir */
-#ifdef WIN32
- BLI_make_file_string("/", global_messagepath, BLI_gethome(), "/locale");
- if (!BLI_exist(global_messagepath)) {
-#endif
-#ifdef __APPLE__
/* message catalogs are stored inside the application bundle */
bundlepath= BLI_getbundle();
strcpy(global_messagepath, bundlepath);
strcat(global_messagepath, "/Contents/Resources/locale");
if (!BLI_exist(global_messagepath)) { /* locale not in bundle (now that's odd..) */
-#endif
strcpy(global_messagepath, LOCALEDIR);
if (!BLI_exist(global_messagepath)) { /* locale not in LOCALEDIR */
strcpy(global_messagepath, "message"); /* old compatibility as last */
}
-#ifdef WIN32
}
-#endif
-#ifdef __APPLE__
- }
-#endif
}
}
}
-
-void BLF_lang_set(const char *str)
+#elif defined(_WIN32)
+void BLF_lang_init(void) /* Windows Only, todo - use BLI_gethome_folder */
{
-#if defined (_WIN32) || defined(__APPLE__)
- char envstr[12];
+ strcpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT);
+
+ strcpy(global_messagepath, ".blender/locale");
+
+ if (!BLI_exist(global_messagepath)) { /* locale not in current dir */
+ BLI_make_file_string("/", global_messagepath, BLI_gethome(), ".blender/locale");
- sprintf(envstr, "LANG=%s", str);
- envstr[strlen(envstr)]= '\0';
-#ifdef _WIN32
- gettext_putenv(envstr);
+ if (!BLI_exist(global_messagepath)) { /* locale not in home dir */
+ BLI_make_file_string("/", global_messagepath, BLI_gethome(), "/locale");
+ }
+ }
+}
#else
- putenv(envstr);
+void BLF_lang_init(void) /* not win or mac */
+{
+ char *messagepath= BLI_gethome_folder("locale", BLI_GETHOME_ALL);
+
+ if(messagepath)
+ strncpy(global_messagepath, messagepath, sizeof(global_messagepath));
+ else
+ global_messagepath[0]= '\0';
+
+}
#endif
+
+void BLF_lang_set(const char *str)
+{
+#if defined (_WIN32) || defined(__APPLE__)
+ BLI_setenv("LANG", str);
#else
char *locreturn= setlocale(LC_ALL, str);
if (locreturn == NULL) {