i18n: code clean-up
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 20 Sep 2011 07:39:25 +0000 (07:39 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 20 Sep 2011 07:39:25 +0000 (07:39 +0000)
- Move all translation-related declarations to BLF_translation.h
- Reverted some changes to match trunk svn rev40365

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

index b71318000973ed1cab5f386539791ff00bc2da3b..1bb61d02b78f076532d8f7a4c0d3d88d9cb2950a 100644 (file)
@@ -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_exit(void);
 
 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_buffer_col(int fontid, float r, float g, float b, float a);
  */
 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 @@ void BLF_dir_free(char **dirs, int count);
 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 */
index 82099d4f125a9687d0d16f394da03919d91042fb..b87a3b88f077d1db4348ccdedb6bc4dfded2dc1c 100644 (file)
@@ -42,9 +42,11 @@ set(SRC
        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 @@ if(WITH_INTERNATIONAL)
        add_definitions(-DINTERNATIONAL)
 endif()
 
-if(WIN32 AND NOT UNIX)
-       add_definitions(-DUSE_GETTEXT_DLL)
-endif()
-
 blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}")
 
index 2763bea0da0781f6ab2f8a2c587fc2a6d9212f5a..45a557938563b4d1bd60d371661d844578d7da80 100644 (file)
@@ -13,7 +13,6 @@ defs = []
 
 if sys.platform == 'win32' or env['OURPLATFORM'] == 'linuxcross':
     defs.append('_WIN32')
-    defs.append('USE_GETTEXT_DLL')
 
 if env['WITH_BF_INTERNATIONAL']:
     defs.append('INTERNATIONAL')
index 9a1c87ea3deff2a1ed07672f3b227f521df847d4..cccecd00bf7124da01ff3d17a895e213703de0b6 100644 (file)
 #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 @@ void BLF_enable(int fontid, int option)
        }
 }
 
-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);
index 3f89f5e8448771b432666660cdb861d8a16c0fcf..2195b370a5fc6fa30f3692859954ace529d25e67 100644 (file)
@@ -89,10 +89,6 @@ void wcs2utf8s(char *dst, const wchar_t *src);
 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
index 5de78bd7a6b8c7b19759f821dd399b90f9dd16f9..09b38195ef37c532a8066a2a6c329c89fd7d428b 100644 (file)
@@ -361,10 +361,6 @@ if(WITH_GAMEENGINE)
        )
 endif()
 
-if(WITH_INTERNATIONAL)
-       add_definitions(-DINTERNATIONAL)
-endif()
-
 if(MSVC)
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
 endif()
index 3935f01e46e17a348e9aeb4b8cda13b13fe00506..56de8afc0da5ff0a2be12062627b7391050d6d6d 100644 (file)
@@ -97,9 +97,6 @@ if env['WITH_BF_GAMEENGINE']:
 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']
 
index b5770d6a57ce454e189c1444eb51b1e975b827ec..6898615c7537b045cbd1eff58b979599715ee2d1 100644 (file)
@@ -255,29 +255,6 @@ static PackedFile *get_builtin_packedfile(void)
        }
 }
 
-#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 @@ void free_ttfont(void)
                tf->vfont= NULL;
        }
        BLI_freelistN(&ttfdata);
-
-#ifdef INTERNATIONAL
-       if(unifont_ttf)
-               MEM_freeN(unifont_ttf);
-#endif
 }
 
 struct TmpFont *vfont_find_tmpfont(VFont *vfont)
index 5acd63f836d9e4929d90616e3880ef9f465f4f43..8a7d837d2a875cdbf7f5d96b24d12ee0ed0656e9 100644 (file)
@@ -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"
index a49de18002ab43fe6fc62a36f441b8a5c168c628..a850fa993f07973485953c5a3595a62d9b9536da 100644 (file)
@@ -55,6 +55,7 @@
 #include "BIF_gl.h"
 
 #include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "UI_interface.h"
 
index 3e4f34aff0ee3d80eab1da01c91ca6394238cd8c..3c02f7d4bd2c05f07e927242aecebd2b3d5af4b8 100644 (file)
@@ -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 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
                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);
                }
        }
        
index d6ea5c926dbd7d492ad7084154b5693a2770bfbd..ec7456eebdce05f53af8a34775cd8eb4d9ac52ba 100644 (file)
@@ -53,8 +53,6 @@
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
 
-#include "BLF_api.h"
-
 #include "WM_api.h"
 #include "WM_types.h"
 
index fb63af5823f04fdfb6d5e76d0afb619222e00cc7..4221f7c30ffcc9578e8f43c403223ae52294e964 100644 (file)
@@ -62,6 +62,7 @@
 #include "UI_view2d.h"
 
 #include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "ED_screen.h"
 
index d242da8e480bfcb267c4c63652822f4297221cb3..5ea20b33b3a270db8004d893917c9df8d6d14169 100644 (file)
 #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 @@ void uiStyleInit(void)
                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);
index 7335d13079adb06f40ef27fcb5cea023afb58653..095c90797f1b9259a2db9b40ff52620d380bb079 100644 (file)
@@ -68,6 +68,7 @@
 #include "interface_intern.h"
 
 #include "BLF_api.h"
+#include "BLF_translation.h"
 
 void UI_template_fix_linking(void)
 {
index 54aef0729a80bb8de61dc77f7ecb2163973ba910..a49060eaca2862379ab7655bb00743bf6b466e7e 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_context.h"
 
index d9a5e92a72c0b8abfcceea31a5b733a585c6fdc2..4582964614500f18335f0cb6aec2ad4c463adea1 100644 (file)
@@ -1018,6 +1018,7 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
 
 static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
 {
+//     int transopts;
        char *cpoin = NULL;
        
        /* for underline drawing */
@@ -1087,6 +1088,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
        if (fstyle->kerning == 1)
                BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
        
+       //      ui_rasterpos_safe(x, y, but->aspect);
+//     if(but->type==IDPOIN) transopts= 0;     // no translation, of course!
+//     else transopts= ui_translate_buttons();
+       
        /* cut string in 2 parts - only for menu entries */
        if((but->block->flag & UI_BLOCK_LOOP)) {
                if(ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS)==0) {
index c7e7cc35c8e7e804baf93bb8387d2c6a8ca2e32e..8951df9221e12b75a20144dced2f8413591b8cc7 100644 (file)
@@ -43,7 +43,7 @@
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_context.h"
 #include "BKE_global.h"
index 0f4467975d1bf0a12a66d91a3c41b3bffc1d1d69..b18b5373240e59809f78a27c80353fd629c05905 100644 (file)
@@ -37,7 +37,7 @@
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_context.h"
 
index 2d00a08662afdce07b5dc0bb0afe3ff536a01282..b2b734159ff7ce9806d605ebd4a40f2c54f9ba2f 100644 (file)
@@ -50,6 +50,7 @@
 #include "BKE_main.h"
 
 #include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "IMB_imbuf_types.h"
  
index 0741152f0ab023ad6e571b0cdeb29ba047e2003c..37dce293d777b5f4c52d835e0db5e038c8de7bcf 100644 (file)
@@ -37,7 +37,7 @@
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
index 766ff3d118ced9cda25f114c8a96ee486a759678..28fd1cd3304132b56964aa7300f6d298e2c4d405 100644 (file)
@@ -46,7 +46,7 @@
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
index 404d7d241f1f8193e8f3d54187cdce6a92d77774..75e13b24ede5f689abb9a0c14e73a7427b9af828 100644 (file)
@@ -41,7 +41,7 @@
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_context.h"
 #include "BKE_global.h"
index 55eff4defe39352e1f4979acb2f9777be197b1e5..5e1f27455594d26138f952a478407968e0765ad2 100644 (file)
@@ -45,7 +45,7 @@
 #include "BLI_editVert.h"
 #include "BLI_rand.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_nla.h"
 #include "BKE_context.h"
index f4713ecaf13549e0b172120870d06c8520393211..996e05afdefe86d33cb1d261a58f74bf79478128 100644 (file)
@@ -44,7 +44,7 @@
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_context.h"
 #include "BKE_global.h"
index 6dd4103dc6da37e60db8c58dc6980848f20c917b..22146a22b9b4bec4e8a741d73dead0a7bd1134bb 100644 (file)
@@ -47,7 +47,7 @@
 #include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
index ad338cef2078a5e966c35ea52711ccacaf00a202..ddea89e1cdb067b1f2b0375d4a86ef56f8d849f2 100644 (file)
@@ -48,7 +48,7 @@
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_context.h"
 #include "BKE_idprop.h"
index 3daede5f785b5739e625c56ca647e43a6c843e75..3ee4c30192e7a7c4fe37c2a25e23bb0bce13e512 100644 (file)
@@ -50,7 +50,7 @@
 #include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 //#include "BIF_editmesh.h"
 //#include "BIF_interface.h"
index 691e3aa6e2090cdc96dba5096801df8bf7928802..26bae68d5a43ef9f2db921cde5d6ea630142821f 100644 (file)
@@ -587,9 +587,6 @@ extern StructRNA RNA_WorldTextureSlot;
 extern StructRNA RNA_XnorController;
 extern StructRNA RNA_XorController;
 
-/* make every name and description field surrounded by gettext */
-EnumPropertyItem* RNA_enum_items_gettexted(EnumPropertyItem *item);
-
 /* Pointer
  *
  * These functions will fill in RNA pointers, this can be done in three ways:
index e3dc2779e9dfca799e1e59660538b8c0f796492e..b7709416a75ba319afce7bac4bab66b52a190749 100644 (file)
@@ -44,6 +44,7 @@
 #include "BLI_ghash.h"
 
 #include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_animsys.h"
 #include "BKE_context.h"
index de1445a2b29f05c7bc0322f025d60a96f70061f0..b9a53acd6f43c378e3ec327d1f6d2a6843655fe9 100644 (file)
@@ -44,7 +44,7 @@
 #include "WM_types.h"
 
 #include "BLI_utildefines.h"
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_sound.h"
 
index 4b14ddc303c012bc24306c02f92f2244920d12d5..2b1cbaf7af5a7c482c525c13fee7029c108ba7cf 100644 (file)
@@ -31,6 +31,7 @@
 #include "blf_py_api.h"
 
 #include "../../blenfont/BLF_api.h"
+#include "../../blenfont/BLF_translation.h"
 
 #include "BLI_utildefines.h"
 
index 0fef66d48c7246938755a1afb958be20600f8ab8..f862af6173a3c1a19fdba32ac51d40ebabdb5d53 100644 (file)
@@ -59,7 +59,7 @@
 #include "BLI_utildefines.h"
 #include "BLI_callbacks.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "DNA_anim_types.h"
 #include "DNA_ipo_types.h" // XXX old animation system
index 32f7e404a0a06d03e8e57797215fe2c918938edf..f114b19debb7e9d3a52c487e2a76f54ac71f05fc 100644 (file)
@@ -99,6 +99,7 @@
 
 #include "UI_interface.h"
 #include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "GPU_buffers.h"
 #include "GPU_extensions.h"
@@ -400,6 +401,7 @@ void WM_exit(bContext *C)
        free_posebuf();
 
        BLF_exit();
+       BLF_free_unifont();
        
        ANIM_keyingset_infos_exit();
        
index ff4aeef9339cc9ca3968be1892d766818b0dae9d..320dc2ecddaf2708c80d295fcd96e2e2847ed0ab 100644 (file)
@@ -49,7 +49,7 @@
 #include "DNA_userdef_types.h"
 #include "DNA_windowmanager_types.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "PIL_time.h"
 
index 073b5824ae1086a342c0975bc30820698ac793da..d9ca275c819927f09d293dd708b457477dd54c40 100644 (file)
@@ -48,7 +48,7 @@
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "BKE_blender.h"
 #include "BKE_context.h"
index 6312fea76983c358cee2363e0fddd960ca89dcb0..0b16e8887eecdbbb29e5dbb758ce07ad73b50776 100644 (file)
@@ -997,6 +997,7 @@ int main(int argc, char** argv)
        // Cleanup
        RNA_exit();
        BLF_exit();
+       BLF_free_unifont();
        IMB_exit();
        free_nodesystem();