added routine that checks for LOCALE/message directory.
This commit is contained in:
@@ -42,7 +42,7 @@ RSC=rc.exe
|
|||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
LINK32=link.exe -lib
|
LINK32=link.exe -lib
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||||
# ADD CPP /nologo /W3 /GX /O2 /I "../../../source\blender\makesdna" /I "../../../source\blender\blenloader" /I "../../../../lib/windows/ftgl/include" /I "../../../../lib/windows/freetype/include" /I "../../../lib/windows/iconv/include" /I "../../../../lib/windows/gettext/include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "WCHAR_T16" /D "HAVE_LC_MESSAGES" /YX /FD /c
|
# ADD CPP /nologo /W3 /GX /O2 /I "../../../source\blender\makesdna" /I "../../../source\blender\blenloader" /I "../../../source\blender\blenlib" /I "../../../../lib/windows/ftgl/include" /I "../../../../lib/windows/freetype/include" /I "../../../lib/windows/iconv/include" /I "../../../../lib/windows/gettext/include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "WCHAR_T16" /D "HAVE_LC_MESSAGES" /YX /FD /c
|
||||||
# ADD BASE RSC /l 0x411 /d "NDEBUG"
|
# ADD BASE RSC /l 0x411 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x411 /d "NDEBUG"
|
# ADD RSC /l 0x411 /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include "libintl.h"
|
#include "libintl.h"
|
||||||
|
#include "BLI_blenlib.h"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
@@ -49,7 +50,6 @@
|
|||||||
#include "FTF_TTFont.h"
|
#include "FTF_TTFont.h"
|
||||||
|
|
||||||
#define DOMAIN_NAME "blender"
|
#define DOMAIN_NAME "blender"
|
||||||
#define MESSAGE_FILE "message"
|
|
||||||
|
|
||||||
#define SYSTEM_ENCODING_DEFAULT "UTF-8"
|
#define SYSTEM_ENCODING_DEFAULT "UTF-8"
|
||||||
#define FONT_SIZE_DEFAULT 12
|
#define FONT_SIZE_DEFAULT 12
|
||||||
@@ -103,9 +103,50 @@ int utf8towchar(wchar_t *w, char *c)
|
|||||||
|
|
||||||
FTF_TTFont::FTF_TTFont(void)
|
FTF_TTFont::FTF_TTFont(void)
|
||||||
{
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
|
char tmp[1024];
|
||||||
|
#endif
|
||||||
|
|
||||||
font=NULL;
|
font=NULL;
|
||||||
font_size=FONT_SIZE_DEFAULT;
|
font_size=FONT_SIZE_DEFAULT;
|
||||||
strcpy(encoding_name, SYSTEM_ENCODING_DEFAULT);
|
strcpy(encoding_name, SYSTEM_ENCODING_DEFAULT);
|
||||||
|
|
||||||
|
//set messagepath directory
|
||||||
|
|
||||||
|
#ifndef LOCALEDIR
|
||||||
|
#define LOCALEDIR "/usr/share/locale"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BLI_make_file_string("/", messagepath, BLI_gethome(), ".blender/locale");
|
||||||
|
printf("1. %s\n", messagepath);
|
||||||
|
if (BLI_exist(messagepath) == NULL) { // locale not in home dir
|
||||||
|
|
||||||
|
strcpy(messagepath, ".blender/locale");
|
||||||
|
printf("2. %s\n", messagepath);
|
||||||
|
if(BLI_exist(messagepath) == NULL) { // locale not in current dir
|
||||||
|
|
||||||
|
strcpy(messagepath, LOCALEDIR);
|
||||||
|
printf("3. %s\n", messagepath);
|
||||||
|
if(BLI_exist(messagepath) == NULL) { // locale not in LOCALEDIR
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
/* message catalogs are stored inside the application bundle */
|
||||||
|
strcpy(tmp, dirname(bprogname));
|
||||||
|
strcat(tmp, "/../Resources/message");
|
||||||
|
realpath(tmp, messagepath);
|
||||||
|
printf("4. %s\n", messagepath);
|
||||||
|
if(BLI_exist(messagepath) == NULL) { // locale not in bundle dir
|
||||||
|
#endif
|
||||||
|
|
||||||
|
strcpy(messagepath, "message"); // old compatibility as last
|
||||||
|
printf("5. %s\n", messagepath);
|
||||||
|
}
|
||||||
|
#ifdef __APPLE__
|
||||||
|
} // heh
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -142,10 +183,6 @@ int FTF_TTFont::SetFont(char* str, int size)
|
|||||||
|
|
||||||
void FTF_TTFont::SetLanguage(char* str)
|
void FTF_TTFont::SetLanguage(char* str)
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
|
||||||
char tmp[1024];
|
|
||||||
char msgpath[1024];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (_WIN32) || defined(__APPLE__)
|
#if defined (_WIN32) || defined(__APPLE__)
|
||||||
char envstr[12];
|
char envstr[12];
|
||||||
@@ -169,17 +206,10 @@ void FTF_TTFont::SetLanguage(char* str)
|
|||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
/* message catalogs are stored inside the application bundle */
|
bindtextdomain(DOMAIN_NAME, messagepath);
|
||||||
strcpy(tmp, dirname(bprogname));
|
|
||||||
strcat(tmp, "/../Resources/message");
|
|
||||||
realpath(tmp, msgpath);
|
|
||||||
bindtextdomain(DOMAIN_NAME, msgpath);
|
|
||||||
textdomain(DOMAIN_NAME);
|
textdomain(DOMAIN_NAME);
|
||||||
#else
|
|
||||||
bindtextdomain(DOMAIN_NAME, MESSAGE_FILE);
|
|
||||||
textdomain(DOMAIN_NAME);
|
|
||||||
#endif
|
|
||||||
strcpy(language, str);
|
strcpy(language, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,6 +91,8 @@ public:
|
|||||||
void SetEncoding(char* str);
|
void SetEncoding(char* str);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
char messagepath[1024];
|
||||||
|
|
||||||
char language[32];
|
char language[32];
|
||||||
char encoding_name[32];
|
char encoding_name[32];
|
||||||
char font_name[128];
|
char font_name[128];
|
||||||
|
Reference in New Issue
Block a user