From 2e2dc9b9e32d104a0f7c3241ea0c11b57a37fd5b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 16 Aug 2015 17:32:01 +1000 Subject: Refactor translation code out of blenfont - Add blentranslation `BLT_*` module. - moved & split `BLF_translation.h` into (`BLT_translation.h`, `BLT_lang.h`). - moved `BLF_*_unifont` functions from `blf_translation.c` to new source file `blf_font_i18n.c`. --- source/blender/windowmanager/CMakeLists.txt | 1 + source/blender/windowmanager/SConscript | 1 + source/blender/windowmanager/intern/wm_dragdrop.c | 2 +- source/blender/windowmanager/intern/wm_files.c | 2 +- source/blender/windowmanager/intern/wm_init_exit.c | 8 ++++---- source/blender/windowmanager/intern/wm_keymap.c | 2 +- source/blender/windowmanager/intern/wm_operators.c | 18 +++++++++--------- source/blender/windowmanager/intern/wm_window.c | 2 +- 8 files changed, 19 insertions(+), 17 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 5328e62367b..c5e8cbf1260 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -29,6 +29,7 @@ set(INC ../blenkernel ../blenlib ../blenloader + ../blentranslation ../compositor ../editors/include ../gpu diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript index 4f2e295e872..ec1b265d800 100644 --- a/source/blender/windowmanager/SConscript +++ b/source/blender/windowmanager/SConscript @@ -42,6 +42,7 @@ incs = [ '../blenkernel', '../blenlib', '../blenloader', + '../blentranslation', '../compositor', '../editors/include', '../gpu', diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index cdc3c9eaaff..3a53906a8e8 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -37,7 +37,7 @@ #include "MEM_guardedalloc.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BLI_blenlib.h" diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 7d06211f519..a4f69b24351 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -60,7 +60,7 @@ #include "BLI_system.h" #include BLI_SYSTEM_PID_H -#include "BLF_translation.h" +#include "BLT_translation.h" #include "DNA_object_types.h" #include "DNA_space_types.h" diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index bde6db259bc..17dde5cec23 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -107,7 +107,7 @@ #include "UI_interface.h" #include "BLF_api.h" -#include "BLF_translation.h" +#include "BLT_lang.h" #include "GPU_buffers.h" #include "GPU_draw.h" @@ -167,7 +167,7 @@ void WM_init(bContext *C, int argc, const char **argv) ED_node_init_butfuncs(); BLF_init(11, U.dpi); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */ - BLF_lang_init(); + BLT_lang_init(); /* Enforce loading the UI for the initial homefile */ G.fileflags &= ~G_FILE_NO_UI; @@ -176,7 +176,7 @@ void WM_init(bContext *C, int argc, const char **argv) wm_homefile_read(C, NULL, G.factory_startup, NULL); - BLF_lang_set(NULL); + BLT_lang_set(NULL); if (!G.background) { /* sets 3D mouse deadzone */ @@ -503,7 +503,7 @@ void WM_exit_ext(bContext *C, const bool do_python) #ifdef WITH_INTERNATIONAL BLF_free_unifont(); BLF_free_unifont_mono(); - BLF_lang_free(); + BLT_lang_free(); #endif ANIM_keyingset_infos_exit(); diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 7570b4044b2..e658396fb16 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -50,7 +50,7 @@ #include "BKE_main.h" #include "BKE_screen.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "RNA_access.h" #include "RNA_enum_types.h" diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 1455b7000e9..f5706c1cab4 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -54,7 +54,7 @@ #include "DNA_windowmanager_types.h" #include "DNA_mesh_types.h" /* only for USE_BMESH_SAVE_AS_COMPAT */ -#include "BLF_translation.h" +#include "BLT_translation.h" #include "PIL_time.h" @@ -171,8 +171,8 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType *)) ot = MEM_callocN(sizeof(wmOperatorType), "operatortype"); ot->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_OperatorProperties); /* Set the default i18n context now, so that opfunc can redefine it if needed! */ - RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); - ot->translation_context = BLF_I18NCONTEXT_OPERATOR_DEFAULT; + RNA_def_struct_translation_context(ot->srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); + ot->translation_context = BLT_I18NCONTEXT_OPERATOR_DEFAULT; opfunc(ot); if (ot->name == NULL) { @@ -194,8 +194,8 @@ void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType *, void *), void * ot = MEM_callocN(sizeof(wmOperatorType), "operatortype"); ot->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_OperatorProperties); /* Set the default i18n context now, so that opfunc can redefine it if needed! */ - RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); - ot->translation_context = BLF_I18NCONTEXT_OPERATOR_DEFAULT; + RNA_def_struct_translation_context(ot->srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); + ot->translation_context = BLT_I18NCONTEXT_OPERATOR_DEFAULT; opfunc(ot, userdata); RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description : UNDOCUMENTED_OPERATOR_TIP); RNA_def_struct_identifier(ot->srna, ot->idname); @@ -405,7 +405,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam RNA_def_struct_ui_text(ot->srna, ot->name, ot->description); RNA_def_struct_identifier(ot->srna, ot->idname); /* Use i18n context from ext.srna if possible (py operators). */ - i18n_context = ot->ext.srna ? RNA_struct_translation_context(ot->ext.srna) : BLF_I18NCONTEXT_OPERATOR_DEFAULT; + i18n_context = ot->ext.srna ? RNA_struct_translation_context(ot->ext.srna) : BLT_I18NCONTEXT_OPERATOR_DEFAULT; RNA_def_struct_translation_context(ot->srna, i18n_context); ot->translation_context = i18n_context; @@ -432,8 +432,8 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType *, void *), ot->description = UNDOCUMENTED_OPERATOR_TIP; /* Set the default i18n context now, so that opfunc can redefine it if needed! */ - RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); - ot->translation_context = BLF_I18NCONTEXT_OPERATOR_DEFAULT; + RNA_def_struct_translation_context(ot->srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); + ot->translation_context = BLT_I18NCONTEXT_OPERATOR_DEFAULT; opfunc(ot, userdata); RNA_def_struct_ui_text(ot->srna, ot->name, ot->description); @@ -3121,7 +3121,7 @@ static int wm_console_toggle_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) static void WM_OT_console_toggle(wmOperatorType *ot) { /* XXX Have to mark these for xgettext, as under linux they do not exists... */ - ot->name = CTX_N_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Toggle System Console"); + ot->name = CTX_N_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Toggle System Console"); ot->idname = "WM_OT_console_toggle"; ot->description = N_("Toggle System Console"); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index d0ecec66d0b..af7e9c8ca33 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -47,7 +47,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_blender.h" #include "BKE_context.h" -- cgit v1.2.3