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:
authorStefan Gartner <stefang@aon.at>2003-05-10 00:20:40 +0400
committerStefan Gartner <stefang@aon.at>2003-05-10 00:20:40 +0400
commit99bd02a98bcde69de1dfe535144e2594240591b7 (patch)
tree15f7c042c6e425fd7e8c8a42a9e2533d473fd61a /source/blender/ftfont/intern/FTF_TTFont.cpp
parent229265812433b0af48ac6892762f1df194df2805 (diff)
store message catalogs in Resources folder of the application bundle on OS
X. Opening a file selector is no longer needed in order to switch the language for the first time; apparently gettext wasn't too happy about relative paths.
Diffstat (limited to 'source/blender/ftfont/intern/FTF_TTFont.cpp')
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp
index 761f301b448..315de817831 100644
--- a/source/blender/ftfont/intern/FTF_TTFont.cpp
+++ b/source/blender/ftfont/intern/FTF_TTFont.cpp
@@ -39,6 +39,11 @@
#include <string.h>
#include <locale.h>
#include "libintl.h"
+
+#ifdef __APPLE__
+#include <libgen.h>
+#endif
+
#include "../FTF_Settings.h"
#include "FTF_TTFont.h"
@@ -52,6 +57,7 @@
#define FTF_MAX_STR_SIZE 256
+extern char bprogname[];
int utf8towchar(wchar_t *w, char *c)
{
@@ -136,6 +142,11 @@ int FTF_TTFont::SetFont(char* str, int size)
void FTF_TTFont::SetLanguage(char* str)
{
+#ifdef __APPLE__
+ char tmp[1024];
+ char msgpath[1024];
+#endif
+
#if defined (_WIN32) || defined(__APPLE__)
char envstr[12];
@@ -157,10 +168,18 @@ void FTF_TTFont::SetLanguage(char* str)
setlocale(LC_NUMERIC, "C");
#endif
-
+
+#ifdef __APPLE__
+ /* message catalogs are stored inside the application bundle */
+ strcpy(tmp, dirname(bprogname));
+ strcat(tmp, "/../Resources/message");
+ realpath(tmp, msgpath);
+ bindtextdomain(DOMAIN_NAME, msgpath);
+ textdomain(DOMAIN_NAME);
+#else
bindtextdomain(DOMAIN_NAME, MESSAGE_FILE);
textdomain(DOMAIN_NAME);
-
+#endif
strcpy(language, str);
}