[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40384] branches/soc-2011-garlic/source: i18n: code clean-up

Sergey Sharybin g.ulairi at gmail.com
Tue Sep 20 09:39:26 CEST 2011


Revision: 40384
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40384
Author:   nazgul
Date:     2011-09-20 07:39:25 +0000 (Tue, 20 Sep 2011)
Log Message:
-----------
i18n: code clean-up

- Move all translation-related declarations to BLF_translation.h
- Reverted some changes to match trunk svn rev40365

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40365

Modified Paths:
--------------
    branches/soc-2011-garlic/source/blender/blenfont/BLF_api.h
    branches/soc-2011-garlic/source/blender/blenfont/CMakeLists.txt
    branches/soc-2011-garlic/source/blender/blenfont/SConscript
    branches/soc-2011-garlic/source/blender/blenfont/intern/blf.c
    branches/soc-2011-garlic/source/blender/blenkernel/BKE_font.h
    branches/soc-2011-garlic/source/blender/blenkernel/CMakeLists.txt
    branches/soc-2011-garlic/source/blender/blenkernel/SConscript
    branches/soc-2011-garlic/source/blender/blenkernel/intern/font.c
    branches/soc-2011-garlic/source/blender/editors/armature/poselib.c
    branches/soc-2011-garlic/source/blender/editors/interface/interface.c
    branches/soc-2011-garlic/source/blender/editors/interface/interface_layout.c
    branches/soc-2011-garlic/source/blender/editors/interface/interface_panel.c
    branches/soc-2011-garlic/source/blender/editors/interface/interface_regions.c
    branches/soc-2011-garlic/source/blender/editors/interface/interface_style.c
    branches/soc-2011-garlic/source/blender/editors/interface/interface_templates.c
    branches/soc-2011-garlic/source/blender/editors/interface/interface_utils.c
    branches/soc-2011-garlic/source/blender/editors/interface/interface_widgets.c
    branches/soc-2011-garlic/source/blender/editors/screen/area.c
    branches/soc-2011-garlic/source/blender/editors/space_buttons/buttons_header.c
    branches/soc-2011-garlic/source/blender/editors/space_file/file_draw.c
    branches/soc-2011-garlic/source/blender/editors/space_file/file_panels.c
    branches/soc-2011-garlic/source/blender/editors/space_graph/graph_buttons.c
    branches/soc-2011-garlic/source/blender/editors/space_info/space_info.c
    branches/soc-2011-garlic/source/blender/editors/space_nla/nla_buttons.c
    branches/soc-2011-garlic/source/blender/editors/space_node/node_header.c
    branches/soc-2011-garlic/source/blender/editors/space_view3d/view3d_header.c
    branches/soc-2011-garlic/source/blender/editors/space_view3d/view3d_toolbar.c
    branches/soc-2011-garlic/source/blender/editors/transform/transform_orientations.c
    branches/soc-2011-garlic/source/blender/makesrna/RNA_access.h
    branches/soc-2011-garlic/source/blender/makesrna/intern/rna_access.c
    branches/soc-2011-garlic/source/blender/makesrna/intern/rna_userdef.c
    branches/soc-2011-garlic/source/blender/python/generic/blf_py_api.c
    branches/soc-2011-garlic/source/blender/windowmanager/intern/wm_files.c
    branches/soc-2011-garlic/source/blender/windowmanager/intern/wm_init_exit.c
    branches/soc-2011-garlic/source/blender/windowmanager/intern/wm_operators.c
    branches/soc-2011-garlic/source/blender/windowmanager/intern/wm_window.c
    branches/soc-2011-garlic/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp

Modified: branches/soc-2011-garlic/source/blender/blenfont/BLF_api.h
===================================================================
--- branches/soc-2011-garlic/source/blender/blenfont/BLF_api.h	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/blenfont/BLF_api.h	2011-09-20 07:39:25 UTC (rev 40384)
@@ -34,7 +34,6 @@
 #ifndef BLF_API_H
 #define BLF_API_H
 
-#include <stdlib.h>
 struct rctf;
 
 int BLF_init(int points, int dpi);
@@ -42,8 +41,6 @@
 
 void BLF_cache_clear(void);
 
-const char* BLF_gettext(const char *msgid);
-
 int BLF_load(const char *name);
 int BLF_load_mem(const char *name, unsigned char *mem, int mem_size);
 
@@ -181,20 +178,6 @@
  */
 void BLF_draw_buffer(int fontid, const char *str);
 
-/*
- * Search the path directory to the locale files, this try all
- * the case for Linux, Win and Mac.
- */
-void BLF_lang_init(void);
-
-/* Set the current locale. */
-void BLF_lang_set(const char *);
-
-/* Set the current encoding name. */
-void BLF_lang_encoding_name(const char *str);
-
-void BLF_lang_encoding(const char *str);
-
 /* Add a path to the font dir paths. */
 void BLF_dir_add(const char *path);
 
@@ -219,7 +202,4 @@
 extern int blf_mono_font;
 extern int blf_mono_font_render; // dont mess drawing with render threads.
 
-#define _(msgid) BLF_gettext(msgid)
-#define N_(msgid) msgid
-
 #endif /* BLF_API_H */

Modified: branches/soc-2011-garlic/source/blender/blenfont/CMakeLists.txt
===================================================================
--- branches/soc-2011-garlic/source/blender/blenfont/CMakeLists.txt	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/blenfont/CMakeLists.txt	2011-09-20 07:39:25 UTC (rev 40384)
@@ -42,9 +42,11 @@
 	intern/blf_font.c
 	intern/blf_glyph.c
 	intern/blf_lang.c
+	intern/blf_translation.c
 	intern/blf_util.c
 
 	BLF_api.h
+	BLF_translation.h
 	intern/blf_internal.h
 	intern/blf_internal_types.h
 )
@@ -56,9 +58,5 @@
 	add_definitions(-DINTERNATIONAL)
 endif()
 
-if(WIN32 AND NOT UNIX)
-	add_definitions(-DUSE_GETTEXT_DLL)
-endif()
-
 blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}")
 

Modified: branches/soc-2011-garlic/source/blender/blenfont/SConscript
===================================================================
--- branches/soc-2011-garlic/source/blender/blenfont/SConscript	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/blenfont/SConscript	2011-09-20 07:39:25 UTC (rev 40384)
@@ -13,7 +13,6 @@
 
 if sys.platform == 'win32' or env['OURPLATFORM'] == 'linuxcross':
     defs.append('_WIN32')
-    defs.append('USE_GETTEXT_DLL')
 
 if env['WITH_BF_INTERNATIONAL']:
     defs.append('INTERNATIONAL')

Modified: branches/soc-2011-garlic/source/blender/blenfont/intern/blf.c
===================================================================
--- branches/soc-2011-garlic/source/blender/blenfont/intern/blf.c	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/blenfont/intern/blf.c	2011-09-20 07:39:25 UTC (rev 40384)
@@ -34,11 +34,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
-#ifdef INTERNATIONAL
-#include <libintl.h>
-#endif
-
 #include <math.h>
 
 #include <ft2build.h>
@@ -304,17 +299,6 @@
 	}
 }
 
-const char* BLF_gettext(const char *msgid)
-{
-#ifdef INTERNATIONAL
-	if( msgid[0] )
-		return gettext( msgid );
-	return "";
-#else
-	return msgid;
-#endif
-}
-
 void BLF_disable(int fontid, int option)
 {
 	FontBLF *font= BLF_get(fontid);

Modified: branches/soc-2011-garlic/source/blender/blenkernel/BKE_font.h
===================================================================
--- branches/soc-2011-garlic/source/blender/blenkernel/BKE_font.h	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/blenkernel/BKE_font.h	2011-09-20 07:39:25 UTC (rev 40384)
@@ -89,10 +89,6 @@
 size_t wcsleninu8(wchar_t *src);
 size_t utf8towchar(wchar_t *w, const char *c);
 
-#ifdef INTERNATIONAL
-unsigned char *BKE_font_get_unifont(int *unifont_size);
-#endif
-
 #ifdef __cplusplus
 }
 #endif

Modified: branches/soc-2011-garlic/source/blender/blenkernel/CMakeLists.txt
===================================================================
--- branches/soc-2011-garlic/source/blender/blenkernel/CMakeLists.txt	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/blenkernel/CMakeLists.txt	2011-09-20 07:39:25 UTC (rev 40384)
@@ -361,10 +361,6 @@
 	)
 endif()
 
-if(WITH_INTERNATIONAL)
-	add_definitions(-DINTERNATIONAL)
-endif()
-
 if(MSVC)
 	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
 endif()

Modified: branches/soc-2011-garlic/source/blender/blenkernel/SConscript
===================================================================
--- branches/soc-2011-garlic/source/blender/blenkernel/SConscript	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/blenkernel/SConscript	2011-09-20 07:39:25 UTC (rev 40384)
@@ -97,9 +97,6 @@
 else:
     sources.remove('intern' + os.sep + 'navmesh_conversion.cpp')
 
-if env['WITH_BF_INTERNATIONAL']:
-    defs.append('INTERNATIONAL')
-
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
     incs += ' ' + env['BF_PTHREADS_INC']
 

Modified: branches/soc-2011-garlic/source/blender/blenkernel/intern/font.c
===================================================================
--- branches/soc-2011-garlic/source/blender/blenkernel/intern/font.c	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/blenkernel/intern/font.c	2011-09-20 07:39:25 UTC (rev 40384)
@@ -255,29 +255,6 @@
 	}
 }
 
-#ifdef INTERNATIONAL
-const char unifont_filename[]="droidsans.ttf.gz";
-static unsigned char *unifont_ttf= NULL;
-static int unifont_size= 0;
-
-unsigned char *BKE_font_get_unifont(int *unifont_size_r)
-{
-	if(unifont_ttf==NULL) {
-		char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts");
-		char unifont_path[1024];
-
-		BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename);
-
-		unifont_ttf= BLI_ungzip_to_mem(unifont_path, &unifont_size);
-	}
-
-	*unifont_size_r= unifont_size;
-
-	return unifont_ttf;
-}
-
-#endif
-
 void free_ttfont(void)
 {
 	struct TmpFont *tf;
@@ -288,11 +265,6 @@
 		tf->vfont= NULL;
 	}
 	BLI_freelistN(&ttfdata);
-
-#ifdef INTERNATIONAL
-	if(unifont_ttf)
-		MEM_freeN(unifont_ttf);
-#endif
 }
 
 struct TmpFont *vfont_find_tmpfont(VFont *vfont)

Modified: branches/soc-2011-garlic/source/blender/editors/armature/poselib.c
===================================================================
--- branches/soc-2011-garlic/source/blender/editors/armature/poselib.c	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/editors/armature/poselib.c	2011-09-20 07:39:25 UTC (rev 40384)
@@ -43,7 +43,7 @@
 #include "BLI_dlrbTree.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"

Modified: branches/soc-2011-garlic/source/blender/editors/interface/interface.c
===================================================================
--- branches/soc-2011-garlic/source/blender/editors/interface/interface.c	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/editors/interface/interface.c	2011-09-20 07:39:25 UTC (rev 40384)
@@ -55,6 +55,7 @@
 #include "BIF_gl.h"
 
 #include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "UI_interface.h"
 

Modified: branches/soc-2011-garlic/source/blender/editors/interface/interface_layout.c
===================================================================
--- branches/soc-2011-garlic/source/blender/editors/interface/interface_layout.c	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/editors/interface/interface_layout.c	2011-09-20 07:39:25 UTC (rev 40384)
@@ -43,7 +43,7 @@
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_context.h"
 #include "BKE_global.h"
@@ -2808,7 +2808,7 @@
 		empty= uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0;
 
 		if(empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) {
-			uiItemL(layout, _("No Properties"), ICON_NONE);
+			uiItemL(layout, UI_translate_do_iface(N_("No Properties")), ICON_NONE);
 		}
 	}
 	

Modified: branches/soc-2011-garlic/source/blender/editors/interface/interface_panel.c
===================================================================
--- branches/soc-2011-garlic/source/blender/editors/interface/interface_panel.c	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/editors/interface/interface_panel.c	2011-09-20 07:39:25 UTC (rev 40384)
@@ -53,8 +53,6 @@
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
 
-#include "BLF_api.h"
-
 #include "WM_api.h"
 #include "WM_types.h"
 

Modified: branches/soc-2011-garlic/source/blender/editors/interface/interface_regions.c
===================================================================
--- branches/soc-2011-garlic/source/blender/editors/interface/interface_regions.c	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/editors/interface/interface_regions.c	2011-09-20 07:39:25 UTC (rev 40384)
@@ -62,6 +62,7 @@
 #include "UI_view2d.h"
 
 #include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "ED_screen.h"
 

Modified: branches/soc-2011-garlic/source/blender/editors/interface/interface_style.c
===================================================================
--- branches/soc-2011-garlic/source/blender/editors/interface/interface_style.c	2011-09-20 06:47:43 UTC (rev 40383)
+++ branches/soc-2011-garlic/source/blender/editors/interface/interface_style.c	2011-09-20 07:39:25 UTC (rev 40384)
@@ -44,10 +44,10 @@
 #include "BLI_string.h"
 
 #include "BKE_global.h"
-#include "BKE_font.h"
 
 
 #include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "UI_interface.h"
 
@@ -324,7 +324,7 @@
 		if(font->uifont_id==UIFONT_DEFAULT) {
 #ifdef INTERNATIONAL
 			int unifont_size;
-			unsigned char *unifont_ttf= BKE_font_get_unifont(&unifont_size);
+			unsigned char *unifont_ttf= BLF_get_unifont(&unifont_size);
 
 			if(unifont_ttf)
 				font->blf_id= BLF_load_mem_unique("default", unifont_ttf, unifont_size);

Modified: branches/soc-2011-garlic/source/blender/editors/interface/interface_templates.c
===================================================================
--- branches/soc-2011-garlic/source/blender/editors/interface/interface_templates.c	2011-09-20 06:47:43 UTC (rev 40383)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list