forked from bartvdbraak/blender
Moving i18n code to BLF_translation.h
This way, we will be able to use it in non-UI parts of the code too.
This commit is contained in:
parent
ee1569b933
commit
e4269043b4
@ -58,8 +58,18 @@ void BLF_lang_encoding_name(const char *str);
|
||||
|
||||
void BLF_lang_encoding(const char *str);
|
||||
|
||||
/* translation */
|
||||
int BLF_translate_iface(void);
|
||||
int BLF_translate_tooltips(void);
|
||||
const char *BLF_translate_do_iface(const char *msgid);
|
||||
const char *BLF_translate_do_tooltip(const char *msgid);
|
||||
|
||||
|
||||
/*#define _(msgid) BLF_gettext(msgid)*/
|
||||
/* The "translation-marker" macro. */
|
||||
#define N_(msgid) msgid
|
||||
/* Those macros should be used everywhere in UI code. */
|
||||
#define IFACE_(msgid) BLF_translate_do_iface(msgid)
|
||||
#define TIP_(msgid) BLF_translate_do_tooltip(msgid)
|
||||
|
||||
#endif /* BLF_TRANSLATION_H */
|
||||
|
@ -44,6 +44,8 @@
|
||||
|
||||
#include "BLF_translation.h"
|
||||
|
||||
#include "DNA_userdef_types.h" /* For user settings. */
|
||||
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
const char unifont_filename[]="droidsans.ttf.gz";
|
||||
static unsigned char *unifont_ttf= NULL;
|
||||
@ -88,3 +90,46 @@ const char* BLF_gettext(const char *msgid)
|
||||
return msgid;
|
||||
#endif
|
||||
}
|
||||
|
||||
int BLF_translate_iface(void)
|
||||
{
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int BLF_translate_tooltips(void)
|
||||
{
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_TOOLTIPS);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *BLF_translate_do_iface(const char *msgid)
|
||||
{
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
if(BLF_translate_iface())
|
||||
return BLF_gettext(msgid);
|
||||
else
|
||||
return msgid;
|
||||
#else
|
||||
return msgid;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *BLF_translate_do_tooltip(const char *msgid)
|
||||
{
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
if(BLF_translate_tooltips())
|
||||
return BLF_gettext(msgid);
|
||||
else
|
||||
return msgid;
|
||||
#else
|
||||
return msgid;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -820,16 +820,6 @@ uiStyle* UI_GetStyle(void);
|
||||
/* linker workaround ack! */
|
||||
void UI_template_fix_linking(void);
|
||||
|
||||
/* translation */
|
||||
int UI_translate_iface(void);
|
||||
int UI_translate_tooltips(void);
|
||||
const char *UI_translate_do_iface(const char *msgid);
|
||||
const char *UI_translate_do_tooltip(const char *msgid);
|
||||
|
||||
/* Those macros should be used everywhere in UI code. */
|
||||
#define IFACE_(msgid) UI_translate_do_iface(msgid)
|
||||
#define TIP_(msgid) UI_translate_do_tooltip(msgid)
|
||||
|
||||
/* UI_OT_editsource helpers */
|
||||
int UI_editsource_enable_check(void);
|
||||
void UI_editsource_active_but_test(uiBut *but);
|
||||
|
@ -90,50 +90,6 @@
|
||||
|
||||
static void ui_free_but(const bContext *C, uiBut *but);
|
||||
|
||||
/* ************* translation ************** */
|
||||
|
||||
int UI_translate_iface(void)
|
||||
{
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int UI_translate_tooltips(void)
|
||||
{
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_TOOLTIPS);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *UI_translate_do_iface(const char *msgid)
|
||||
{
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
if(UI_translate_iface())
|
||||
return BLF_gettext(msgid);
|
||||
else
|
||||
return msgid;
|
||||
#else
|
||||
return msgid;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *UI_translate_do_tooltip(const char *msgid)
|
||||
{
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
if(UI_translate_tooltips())
|
||||
return BLF_gettext(msgid);
|
||||
else
|
||||
return msgid;
|
||||
#else
|
||||
return msgid;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ************* window matrix ************** */
|
||||
|
||||
void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y)
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLF_translation.h"
|
||||
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
@ -40,6 +40,8 @@
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_ghash.h"
|
||||
|
||||
#include "BLF_translation.h"
|
||||
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
|
@ -40,6 +40,8 @@
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLF_translation.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_library.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
Import ('env')
|
||||
|
||||
incs = '. ../editors/include ../makesdna ../makesrna ../blenlib ../blenkernel ../nodes'
|
||||
incs = '. ../editors/include ../makesdna ../makesrna ../blenfont ../blenlib ../blenkernel ../nodes'
|
||||
incs += ' ../imbuf ../blenloader ../gpu ../render/extern/include ../windowmanager'
|
||||
incs += ' #intern/guardedalloc #intern/memutil #extern/glew/include'
|
||||
incs += ' #intern/audaspace/intern ' + env['BF_PYTHON_INC']
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
set(INC
|
||||
..
|
||||
../../blenfont
|
||||
../../blenkernel
|
||||
../../blenlib
|
||||
../../blenloader
|
||||
|
@ -77,7 +77,7 @@
|
||||
#include "../generic/py_capi_utils.h"
|
||||
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
#include "UI_interface.h" /* bad level call into editors */
|
||||
#include "BLF_translation.h"
|
||||
#endif
|
||||
|
||||
#define USE_PEDANTIC_WRITE
|
||||
|
Loading…
Reference in New Issue
Block a user