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:
authorCampbell Barton <ideasman42@gmail.com>2009-09-24 11:03:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-09-24 11:03:18 +0400
commitb94ed5d7e469c6c3ea421919138da8c04a3f01e3 (patch)
treef431fba46204e332d5627c65ab8c25e5cbe9ce33
parent20998fdcfa6e7dd74adc0f38af6135fdddbefdc0 (diff)
- cmake/make/scons didnt define INTERNATIONAL when buidling blenfont
- BLF_lang_init used confusing IFDEF's, unlikely this was well tested. Split this into 3 functions for Apple/Win32/Unix, Unix uses BLI_gethome_folder(), cant test others, ideally they should use BLI_gethome_folder too but needs testing. Possibly each os cant be made to use BLI_gethome_folder and the separate func's can be removed (please test). - units, hectometers were displayed wrong.
-rw-r--r--source/blender/blenfont/CMakeLists.txt1
-rw-r--r--source/blender/blenfont/Makefile4
-rw-r--r--source/blender/blenfont/SConscript8
-rw-r--r--source/blender/blenfont/intern/blf_lang.c55
-rw-r--r--source/blender/blenkernel/intern/unit.c4
5 files changed, 43 insertions, 29 deletions
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
index 844a6899bf5..9b7e950526d 100644
--- a/source/blender/blenfont/CMakeLists.txt
+++ b/source/blender/blenfont/CMakeLists.txt
@@ -32,6 +32,7 @@ SET(INC
IF(WITH_INTERNATIONAL)
SET(INC ${INC} ${GETTEXT_INC})
+ ADD_DEFINITIONS(-DINTERNATIONAL)
ENDIF(WITH_INTERNATIONAL)
IF(WIN32)
diff --git a/source/blender/blenfont/Makefile b/source/blender/blenfont/Makefile
index 70dd2e5052b..be62c87cbf4 100644
--- a/source/blender/blenfont/Makefile
+++ b/source/blender/blenfont/Makefile
@@ -28,3 +28,7 @@ SOURCEDIR = source/blender/blenfont
DIRS = intern
include nan_subdirs.mk
+
+ifeq ($(INTERNATIONAL), true)
+ CPPFLAGS += -DINTERNATIONAL
+endif
diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript
index d070d985247..91edc46ba8b 100644
--- a/source/blender/blenfont/SConscript
+++ b/source/blender/blenfont/SConscript
@@ -9,9 +9,13 @@ incs += ' #/extern/glew/include'
incs += ' ' + env['BF_FREETYPE_INC']
incs += ' ' + env['BF_GETTEXT_INC']
-defs = ''
+defs = []
if sys.platform == 'win32':
- defs += ' _WIN32 USE_GETTEXT_DLL'
+ defs.append('_WIN32')
+ defs.append('USE_GETTEXT_DLL')
+
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('INTERNATIONAL')
env.BlenderLib ( 'bf_blenfont', sources, Split(incs), Split(defs), libtype=['core','player'], priority=[210,210] )
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) {
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index f8e3b3c5ad2..1f72c894cc8 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -75,7 +75,7 @@ static struct bUnitCollection buDummyCollecton = {buDummyDef, 0, 0, sizeof(buDum
/* Lengths */
static struct bUnitDef buMetricLenDef[] = {
{"kilometer", "kilometers", "km", NULL, "Kilometers", 1000.0, 0.0, B_UNIT_DEF_NONE},
- {"hectometer", "hectometers", "hm", NULL, "10 Meters", 100.0, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"hectometer", "hectometers", "hm", NULL, "100 Meters", 100.0, 0.0, B_UNIT_DEF_SUPPRESS},
{"dekameter", "dekameters", "dkm",NULL, "10 Meters", 10.0, 0.0, B_UNIT_DEF_SUPPRESS},
{"meter", "meters", "m", NULL, "Meters", 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"decimetre", "decimetres", "dm", NULL, "10 Centimeters", 0.1, 0.0, B_UNIT_DEF_SUPPRESS},
@@ -485,7 +485,7 @@ int bUnit_ReplaceString(char *str, int len_max, char *str_prev, double scale_pre
if(unit==NULL)
unit= unit_default(usys);
- /* add the unit prefic and re-run, use brackets incase there was an expression given */
+ /* add the unit prefix and re-run, use brackets incase there was an expression given */
if(snprintf(str_tmp, sizeof(str_tmp), "(%s)%s", str, unit->name) < sizeof(str_tmp)) {
strncpy(str, str_tmp, len_max);
return bUnit_ReplaceString(str, len_max, NULL, scale_pref, system, type);