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:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-09-20 17:41:43 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-09-20 17:41:43 +0400
commitf0aac81466bb5b3a935d74d3a35b545002b0451b (patch)
tree4ff0b58172337883e4f7ac8420e90ae384d76ef5 /source/blender
parent1657cbe61a756222feac5107f87d0d699a92b4a6 (diff)
parent7172316b945c62797e6beba953ff203766614531 (diff)
Improved Internationalization and Localization
============================================== Commiting GSoC project by Xiangquan Xiao trunk. Applied as separated patch, because svn merge produces to much false conflicts and worked really slow. Details for usage would be published on code.blender.org soon. Thanks to Xiao for implementation of project, Campbell to code review, Dalai and Gez for pointing to nice font and everybody else who took part in improving i18n support.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenfont/BLF_api.h14
-rw-r--r--source/blender/blenfont/BLF_translation.h66
-rw-r--r--source/blender/blenfont/CMakeLists.txt6
-rw-r--r--source/blender/blenfont/SConscript1
-rw-r--r--source/blender/blenfont/intern/blf_lang.c130
-rw-r--r--source/blender/blenfont/intern/blf_translation.c86
-rw-r--r--source/blender/blenlib/BLI_fileops.h1
-rw-r--r--source/blender/blenlib/intern/fileops.c41
-rw-r--r--source/blender/editors/armature/CMakeLists.txt1
-rw-r--r--source/blender/editors/armature/SConscript2
-rw-r--r--source/blender/editors/armature/poselib.c8
-rw-r--r--source/blender/editors/include/UI_interface.h8
-rw-r--r--source/blender/editors/interface/interface.c59
-rw-r--r--source/blender/editors/interface/interface_handlers.c6
-rw-r--r--source/blender/editors/interface/interface_intern.h4
-rw-r--r--source/blender/editors/interface/interface_layout.c32
-rw-r--r--source/blender/editors/interface/interface_panel.c14
-rw-r--r--source/blender/editors/interface/interface_regions.c33
-rw-r--r--source/blender/editors/interface/interface_style.c35
-rw-r--r--source/blender/editors/interface/interface_templates.c182
-rw-r--r--source/blender/editors/interface/interface_utils.c4
-rw-r--r--source/blender/editors/interface/view2d.c2
-rw-r--r--source/blender/editors/interface/view2d_ops.c3
-rw-r--r--source/blender/editors/screen/area.c13
-rw-r--r--source/blender/editors/space_buttons/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_buttons/SConscript2
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c30
-rw-r--r--source/blender/editors/space_file/file_draw.c15
-rw-r--r--source/blender/editors/space_file/file_panels.c4
-rw-r--r--source/blender/editors/space_file/filesel.c6
-rw-r--r--source/blender/editors/space_graph/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_graph/SConscript2
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c5
-rw-r--r--source/blender/editors/space_info/space_info.c4
-rw-r--r--source/blender/editors/space_logic/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_logic/logic_window.c6
-rw-r--r--source/blender/editors/space_nla/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_nla/SConscript2
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c5
-rw-r--r--source/blender/editors/space_node/node_draw.c2
-rw-r--r--source/blender/editors/space_node/node_header.c58
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c54
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c4
-rw-r--r--source/blender/editors/transform/CMakeLists.txt1
-rw-r--r--source/blender/editors/transform/SConscript2
-rw-r--r--source/blender/editors/transform/transform_orientations.c14
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h4
-rw-r--r--source/blender/makesrna/RNA_access.h10
-rw-r--r--source/blender/makesrna/SConscript3
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt4
-rw-r--r--source/blender/makesrna/intern/SConscript3
-rw-r--r--source/blender/makesrna/intern/rna_access.c72
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c72
-rw-r--r--source/blender/python/SConscript3
-rw-r--r--source/blender/python/generic/CMakeLists.txt3
-rw-r--r--source/blender/python/generic/blf_py_api.c35
-rw-r--r--source/blender/windowmanager/SConscript3
-rw-r--r--source/blender/windowmanager/intern/wm_files.c11
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c6
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c122
-rw-r--r--source/blender/windowmanager/intern/wm_window.c10
61 files changed, 944 insertions, 390 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index 00943ace05c..1bb61d02b78 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -178,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);
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
new file mode 100644
index 00000000000..4377d391354
--- /dev/null
+++ b/source/blender/blenfont/BLF_translation.h
@@ -0,0 +1,66 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation,
+ * Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenfont/BLF_translation.h
+ * \ingroup blf
+ */
+
+
+#ifndef BLF_TRANSLATION_H
+#define BLF_TRANSLATION_H
+
+/* blf_translation.c */
+
+#ifdef INTERNATIONAL
+unsigned char *BLF_get_unifont(int *unifont_size);
+void BLF_free_unifont(void);
+#endif
+
+const char* BLF_gettext(const char *msgid);
+
+/* blf_lang.c */
+
+/*
+ * 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);
+
+#define _(msgid) BLF_gettext(msgid)
+#define N_(msgid) msgid
+
+#endif /* BLF_TRANSLATION_H */
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
index 82099d4f125..b87a3b88f07 100644
--- a/source/blender/blenfont/CMakeLists.txt
+++ b/source/blender/blenfont/CMakeLists.txt
@@ -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}")
diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript
index 2763bea0da0..45a55793856 100644
--- a/source/blender/blenfont/SConscript
+++ b/source/blender/blenfont/SConscript
@@ -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')
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index 80951899040..8f745180b8b 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -39,8 +39,14 @@
#ifdef INTERNATIONAL
#include <locale.h>
+
+#if defined (_WIN32)
+#include <windows.h>
+#endif
+
#include "libintl.h"
+#include "DNA_userdef_types.h"
#include "DNA_listBase.h"
#include "DNA_vec_types.h"
@@ -60,6 +66,35 @@ static char global_messagepath[1024];
static char global_language[32];
static char global_encoding_name[32];
+/* map from the rna_userdef.c:rna_def_userdef_system(BlenderRNA *brna):language_items */
+static const char *locales[] = {
+ "", "",
+ "english", "en_US",
+ "japanese", "ja_JP",
+ "dutch", "nl_NL",
+ "italian", "it_IT",
+ "german", "de_DE",
+ "finnish", "fi_FI",
+ "swedish", "sv_SE",
+ "french", "fr_FR",
+ "spanish", "es_ES",
+ "catalan", "ca_AD",
+ "czech", "cs_CZ",
+ "ptb", "pt_BR",
+ "chs", "zh_CN",
+ "cht", "zh_TW",
+ "russian", "ru_RU",
+ "croatian", "hr_HR",
+ "serbian", "sr_RS",
+ "ukrainian", "uk_UA",
+ "polish", "pl_PL",
+ "romanian", "ro_RO",
+ "arabic", "ar_EG",
+ "bulgarian", "bg_BG",
+ "greek", "el_GR",
+ "korean", "ko_KR",
+ "nepali", "ne_NP",
+};
void BLF_lang_init(void)
{
@@ -77,34 +112,95 @@ void BLF_lang_init(void)
/* XXX WARNING!!! IN osx somehow the previous function call jumps in this one??? (ton, ppc) */
void BLF_lang_set(const char *str)
{
- if(str==NULL) {
+ char *locreturn;
+ const char *short_locale;
+ int ok= 1;
+#if defined (_WIN32)
+ char *long_locale = locales[ 2 * U.language];
+#endif
+
+ if((U.transopts&USER_DOTRANSLATE)==0)
return;
+
+ if(str)
+ short_locale = str;
+ else
+ short_locale = locales[ 2 * U.language + 1];
+
+#if defined (_WIN32)
+ if(short_locale) {
+ char *envStr;
+
+ if( U.language==0 )/* use system setting */
+ envStr = BLI_sprintfN( "LANG=%s", getenv("LANG") );
+ else
+ envStr = BLI_sprintfN( "LANG=%s", short_locale );
+
+ gettext_putenv(envStr);
+ MEM_freeN(envStr);
+ }
+
+ locreturn= setlocale(LC_ALL, long_locale);
+
+ if (locreturn == NULL) {
+ printf("Could not change locale to %s\n", long_locale);
+ ok= 0;
}
- else {
-
-#if defined (_WIN32) || defined(__APPLE__)
- BLI_setenv("LANG", str);
#else
- char *locreturn= setlocale(LC_ALL, str);
+ {
+ const char *locale;
+ static char default_locale[64]="\0";
+
+ if(default_locale[0]==0) {
+ char *env_language= getenv("LANGUAGE");
+
+ if(env_language) {
+ char *s;
+
+ /* store defaul locale */
+ strncpy(default_locale, env_language, sizeof(default_locale));
+
+ /* use first language as default */
+ s= strchr(default_locale, ':');
+ if(s) s[0]= 0;
+ }
+ }
+
+ if(short_locale[0])
+ locale= short_locale;
+ else
+ locale= default_locale;
+
+ BLI_setenv("LANG", locale);
+ BLI_setenv("LANGUAGE", locale);
+
+ locreturn= setlocale(LC_ALL, locale);
+
if (locreturn == NULL) {
- char *lang= BLI_sprintfN("%s.UTF-8", str);
+ char *short_locale_utf8= BLI_sprintfN("%s.UTF-8", short_locale);
+
+ locreturn= setlocale(LC_ALL, short_locale_utf8);
- locreturn= setlocale(LC_ALL, lang);
if (locreturn == NULL) {
- printf("could not change language to %s nor %s\n", str, lang);
+ printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8);
+ ok= 0;
}
- MEM_freeN(lang);
+ MEM_freeN(short_locale_utf8);
}
-
- setlocale(LC_NUMERIC, "C");
+ }
#endif
- textdomain(DOMAIN_NAME);
- bindtextdomain(DOMAIN_NAME, global_messagepath);
- /* bind_textdomain_codeset(DOMAIN_NAME, global_encoding_name); */
- BLI_strncpy(global_language, str, sizeof(global_language));
-
+
+ if(ok) {
+ //printf("Change locale to %s\n", locreturn );
+ BLI_strncpy(global_language, locreturn, sizeof(global_language));
}
+
+ setlocale(LC_NUMERIC, "C");
+
+ textdomain(DOMAIN_NAME);
+ bindtextdomain(DOMAIN_NAME, global_messagepath);
+ bind_textdomain_codeset(DOMAIN_NAME, global_encoding_name);
}
void BLF_lang_encoding(const char *str)
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
new file mode 100644
index 00000000000..b53f4cf7609
--- /dev/null
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -0,0 +1,86 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation,
+ * Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenfont/intern/blf_translation.c
+ * \ingroup blf
+ */
+
+#include <stdlib.h>
+
+#ifdef INTERNATIONAL
+#include <libintl.h>
+#endif
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+#include "BLI_path_util.h"
+#include "BLI_fileops.h"
+
+#include "BLF_translation.h"
+
+#ifdef INTERNATIONAL
+const char unifont_filename[]="droidsans.ttf.gz";
+static unsigned char *unifont_ttf= NULL;
+static int unifont_size= 0;
+
+unsigned char *BLF_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= (unsigned char*)BLI_ungzip_to_mem(unifont_path, &unifont_size);
+ }
+
+ *unifont_size_r= unifont_size;
+
+ return unifont_ttf;
+}
+
+void BLF_free_unifont(void)
+{
+ if(unifont_ttf)
+ MEM_freeN(unifont_ttf);
+}
+
+#endif
+
+const char* BLF_gettext(const char *msgid)
+{
+#ifdef INTERNATIONAL
+ if( msgid[0] )
+ return gettext( msgid );
+ return "";
+#else
+ return msgid;
+#endif
+}
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index 59c01348c07..21d28ca3185 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -53,6 +53,7 @@ int BLI_exists(const char *file);
int BLI_copy_fileops(const char *file, const char *to);
int BLI_rename(const char *from, const char *to);
int BLI_gzip(const char *from, const char *to);
+char *BLI_ungzip_to_mem(const char *from_file, int *size_r);
int BLI_delete(const char *file, int dir, int recursive);
int BLI_move(const char *file, const char *to);
int BLI_touch(const char *file);
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 3299752646b..6b125435b31 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -52,6 +52,8 @@
#include <sys/param.h>
#endif
+#include "MEM_guardedalloc.h"
+
#include "BLI_blenlib.h"
#include "BKE_utildefines.h"
@@ -104,6 +106,45 @@ int BLI_gzip(const char *from, const char *to) {
return rval;
}
+/* gzip the file in from_file and write it to memery to_mem, at most size bytes.
+ return the unziped size
+ */
+char *BLI_ungzip_to_mem(const char *from_file, int *size_r)
+{
+ gzFile gzfile;
+ int readsize, size, alloc_size=0;
+ char *mem= NULL;
+ const int chunk_size= 512*1024;
+
+ size= 0;
+
+ gzfile = gzopen( from_file, "rb" );
+
+ for(;;) {
+ if(mem==NULL) {
+ mem= MEM_callocN(chunk_size, "BLI_ungzip_to_mem");
+ alloc_size= chunk_size;
+ } else {
+ mem= MEM_reallocN(mem, size+chunk_size);
+ alloc_size+= chunk_size;
+ }
+
+ readsize= gzread(gzfile, mem+size, chunk_size);
+ if(readsize>0) {
+ size+= readsize;
+ }
+ else break;
+ }
+
+ if(mem && alloc_size!=size)
+ mem= MEM_reallocN(mem, size);
+
+ *size_r= size;
+
+ return mem;
+}
+
+
/* return 1 when file can be written */
int BLI_is_writable(const char *filename)
{
diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt
index 9a44525611a..7ecbdc9ebe5 100644
--- a/source/blender/editors/armature/CMakeLists.txt
+++ b/source/blender/editors/armature/CMakeLists.txt
@@ -21,6 +21,7 @@
set(INC
../include
+ ../../blenfont
../../blenkernel
../../blenlib
../../blenloader
diff --git a/source/blender/editors/armature/SConscript b/source/blender/editors/armature/SConscript
index b7f9a263bc1..ded82b3dfb7 100644
--- a/source/blender/editors/armature/SConscript
+++ b/source/blender/editors/armature/SConscript
@@ -3,7 +3,7 @@ Import ('env')
sources = env.Glob('*.c')
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf ../../blenloader'
+incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf ../../blenloader'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../gpu ../../makesrna #/intern/opennl/extern'
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 67c93c4c906..8a7d837d2a8 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -43,6 +43,8 @@
#include "BLI_dlrbTree.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
@@ -407,15 +409,15 @@ static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
/* add new (adds to the first unoccupied frame) */
- uiItemIntO(layout, "Add New", ICON_NONE, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib));
+ uiItemIntO(layout, UI_translate_do_iface(N_("Add New")), ICON_NONE, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib));
/* check if we have any choices to add a new pose in any other way */
if ((ob->poselib) && (ob->poselib->markers.first)) {
/* add new (on current frame) */
- uiItemIntO(layout, "Add New (Current Frame)", ICON_NONE, "POSELIB_OT_pose_add", "frame", CFRA);
+ uiItemIntO(layout, UI_translate_do_iface(N_("Add New (Current Frame)")), ICON_NONE, "POSELIB_OT_pose_add", "frame", CFRA);
/* replace existing - submenu */
- uiItemMenuF(layout, "Replace Existing...", 0, poselib_add_menu_invoke__replacemenu, NULL);
+ uiItemMenuF(layout, UI_translate_do_iface(N_("Replace Existing...")), 0, poselib_add_menu_invoke__replacemenu, NULL);
}
uiPupMenuEnd(C, pup);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 637940f59a6..06b44e36b69 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -799,9 +799,15 @@ void uiStyleFontDrawRotated(struct uiFontStyle *fs, struct rcti *rect, const cha
int UI_GetStringWidth(const char *str); // XXX temp
void UI_DrawString(float x, float y, const char *str); // XXX temp
void UI_DrawTriIcon(float x, float y, char dir);
-
+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);
+
#endif /* UI_INTERFACE_H */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index abc668d72dd..2ff77d255c6 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -55,6 +55,7 @@
#include "BIF_gl.h"
#include "BLF_api.h"
+#include "BLF_translation.h"
#include "UI_interface.h"
@@ -93,19 +94,46 @@ static void ui_free_but(const bContext *C, uiBut *but);
/* ************* translation ************** */
-int ui_translate_buttons(void)
+int UI_translate_iface(void)
{
- return (U.transopts & USER_TR_BUTTONS);
+#ifdef INTERNATIONAL
+ return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE);
+#else
+ return 0;
+#endif
}
-int ui_translate_menus(void)
+int UI_translate_tooltips(void)
{
- return (U.transopts & USER_TR_MENUS);
+#ifdef INTERNATIONAL
+ return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_TOOLTIPS);
+#else
+ return 0;
+#endif
}
-int ui_translate_tooltips(void)
+const char *UI_translate_do_iface(const char *msgid)
{
- return (U.transopts & USER_TR_TOOLTIPS);
+#ifdef 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 INTERNATIONAL
+ if(UI_translate_tooltips())
+ return BLF_gettext(msgid);
+ else
+ return msgid;
+#else
+ return msgid;
+#endif
}
/* ************* window matrix ************** */
@@ -229,7 +257,7 @@ void ui_block_translate(uiBlock *block, int x, int y)
static void ui_text_bounds_block(uiBlock *block, float offset)
{
- uiStyle *style= U.uistyles.first; // XXX pass on as arg
+ uiStyle *style=UI_GetStyle();
uiBut *bt;
int i = 0, j, x1addval= offset, nextcol;
int lastcol= 0, col= 0;
@@ -238,9 +266,6 @@ static void ui_text_bounds_block(uiBlock *block, float offset)
for(bt= block->buttons.first; bt; bt= bt->next) {
if(bt->type!=SEPR) {
- //int transopts= ui_translate_buttons();
- //if(bt->type==TEX || bt->type==IDPOIN) transopts= 0;
-
j= BLF_width(style->widget.uifont_id, bt->drawstr);
if(j > i) i = j;
@@ -930,7 +955,7 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u
/* uses local copy of style, to scale things down, and allow widgets to change stuff */
void uiDrawBlock(const bContext *C, uiBlock *block)
{
- uiStyle style= *((uiStyle *)U.uistyles.first); // XXX pass on as arg
+ uiStyle style= *UI_GetStyle(); // XXX pass on as arg
ARegion *ar;
uiBut *but;
rcti rect;
@@ -2033,12 +2058,9 @@ void ui_check_but(uiBut *but)
/* if something changed in the button */
double value= UI_BUT_VALUE_UNSET;
// float okwidth; // UNUSED
-// int transopts= ui_translate_buttons();
ui_is_but_sel(but, &value);
-// if(but->type==TEX || but->type==IDPOIN) transopts= 0;
-
/* only update soft range while not editing */
if(but->rnaprop && !(but->editval || but->editstr || but->editvec)) {
UI_GET_BUT_VALUE_INIT(but, value)
@@ -2547,7 +2569,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
DynStr *dynstr;
int i, totitem, value, free;
- RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free);
+ RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
value= RNA_property_enum_get(ptr, prop);
dynstr= BLI_dynstr_new();
@@ -2582,7 +2604,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
EnumPropertyItem *item;
int i, totitem, free;
- RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free);
+ RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
for(i=0; i<totitem; i++) {
if(item[i].identifier[0] && item[i].value == (int)max) {
str= item[i].name;
@@ -2710,6 +2732,11 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname,
if ((!tip || tip[0]=='\0') && ot && ot->description) {
tip= ot->description;
+
+#ifdef INTERNATIONAL
+ if(UI_translate_tooltips())
+ tip= BLF_gettext(tip);
+#endif
}
but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 7661fa5994b..125928c136b 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1269,7 +1269,7 @@ static int ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data)
/* note, but->block->aspect is used here, when drawing button style is getting scaled too */
static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, short x)
{
- uiStyle *style= U.uistyles.first; // XXX pass on as arg
+ uiStyle *style= UI_GetStyle(); // XXX pass on as arg
uiFontStyle *fstyle = &style->widget;
int startx= but->x1;
char *origstr;
@@ -4101,7 +4101,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
wmKeyMapItem *kmi;
PointerRNA ptr;
uiLayout *layout;
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
@@ -4133,7 +4133,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
wmKeyMapItem *kmi;
PointerRNA ptr;
uiLayout *layout;
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
int kmi_id;
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index ebc8725ad5d..72eb869dea0 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -347,10 +347,6 @@ typedef struct uiSafetyRct {
extern void ui_delete_linkline(uiLinkLine *line, uiBut *but);
-extern int ui_translate_buttons(void);
-extern int ui_translate_menus(void);
-extern int ui_translate_tooltips(void);
-
void ui_fontscale(short *points, float aspect);
extern void ui_block_to_window_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 10300cee9ea..3c02f7d4bd2 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -43,6 +43,8 @@
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
@@ -475,7 +477,7 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
const char *name;
int a, totitem, itemw, icon, value, free;
- RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free);
+ RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
uiBlockSetCurLayout(block, ui_item_local_sublayout(layout, layout, 1));
for(a=0; a<totitem; a++) {
@@ -634,8 +636,14 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i
return PointerRNA_NULL;
}
- if(!name)
+ if(!name) {
name= ot->name;
+
+#ifdef INTERNATIONAL
+ name= UI_translate_do_iface(name);
+#endif
+ }
+
if(layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
@@ -701,7 +709,7 @@ static const char *ui_menu_enumpropname(uiLayout *layout, const char *opname, co
int totitem, free;
const char *name;
- RNA_property_enum_items(layout->root->block->evil_C, &ptr, prop, &item, &totitem, &free);
+ RNA_property_enum_items_gettexted(layout->root->block->evil_C, &ptr, prop, &item, &totitem, &free);
if(RNA_enum_name(item, retval, &name)) {
if(free) MEM_freeN(item);
return name;
@@ -753,7 +761,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
uiLayout *split= uiLayoutSplit(layout, 0, 0);
uiLayout *column= uiLayoutColumn(split, 0);
- RNA_property_enum_items(block->evil_C, &ptr, prop, &item, &totitem, &free);
+ RNA_property_enum_items_gettexted(block->evil_C, &ptr, prop, &item, &totitem, &free);
for(i=0; i<totitem; i++) {
if(item[i].identifier[0]) {
@@ -841,7 +849,7 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
/* enum lookup */
if((prop= RNA_struct_find_property(&ptr, propname))) {
- RNA_property_enum_items(layout->root->block->evil_C, &ptr, prop, &item, NULL, &free);
+ RNA_property_enum_items_gettexted(layout->root->block->evil_C, &ptr, prop, &item, NULL, &free);
if(item==NULL || RNA_enum_value_from_id(item, value_str, &value)==0) {
if(free) MEM_freeN(item);
RNA_warning("%s.%s, enum %s not found", RNA_struct_identifier(ptr.type), propname, value_str);
@@ -1091,7 +1099,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
return;
}
- RNA_property_enum_items(layout->root->block->evil_C, ptr, prop, &item, NULL, &free);
+ RNA_property_enum_items_gettexted(layout->root->block->evil_C, ptr, prop, &item, NULL, &free);
if(!RNA_enum_value_from_id(item, value, &ivalue)) {
if(free) MEM_freeN(item);
@@ -1135,7 +1143,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
uiLayout *split= uiLayoutSplit(layout, 0, 0);
uiLayout *column= uiLayoutColumn(split, 0);
- RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free);
+ RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
for(i=0; i<totitem; i++) {
if(item[i].identifier[0]) {
@@ -1421,8 +1429,14 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const
return;
}
- if(!name)
+ if(!name) {
name= mt->label;
+
+#ifdef INTERNATIONAL
+ name= UI_translate_do_iface(name);
+#endif
+ }
+
if(layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
@@ -2794,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);
}
}
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index cd1d250d6a4..ec7456eebdc 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -173,7 +173,7 @@ static void ui_panel_copy_offset(Panel *pa, Panel *papar)
Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int *open)
{
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
Panel *pa, *patab, *palast, *panext;
char *drawname= pt->label;
char *idname= pt->idname;
@@ -292,7 +292,7 @@ void uiEndPanel(uiBlock *block, int width, int height)
static void ui_offset_panel_block(uiBlock *block)
{
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
uiBut *but;
int ofsy;
@@ -442,8 +442,12 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r
Panel *panel= block->panel;
rcti hrect;
int pnl_icons;
- char *activename= panel->drawname[0]?panel->drawname:panel->panelname;
-
+ const char *activename= panel->drawname[0]?panel->drawname:panel->panelname;
+
+#ifdef INTERNATIONAL
+ activename= UI_translate_do_iface(activename);
+#endif
+
/* + 0.001f to avoid flirting with float inaccuracy */
if(panel->control & UI_PNL_CLOSE) pnl_icons=(panel->labelofs+2*PNL_ICON+5)/block->aspect + 0.001f;
else pnl_icons= (panel->labelofs+PNL_ICON+5)/block->aspect + 0.001f;
@@ -667,7 +671,7 @@ static int compare_panel(const void *a1, const void *a2)
/* returns 1 when it did something */
static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
{
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
Panel *pa;
PanelSort *ps, *panelsort, *psnext;
int a, tot=0, done;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index f31c16cd020..4221f7c30ff 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -62,6 +62,7 @@
#include "UI_view2d.h"
#include "BLF_api.h"
+#include "BLF_translation.h"
#include "ED_screen.h"
@@ -318,7 +319,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
rcti bbox= data->bbox;
int a;
- ui_draw_menu_back(U.uistyles.first, NULL, &data->bbox);
+ ui_draw_menu_back(UI_GetStyle(), NULL, &data->bbox);
/* draw text */
uiStyleFontSet(&data->fstyle);
@@ -343,9 +344,10 @@ static void ui_tooltip_region_free_cb(ARegion *ar)
ar->regiondata= NULL;
}
+#define TIP_(msgid) UI_translate_do_tooltip(msgid)
ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
{
- uiStyle *style= U.uistyles.first; // XXX pass on as arg
+ uiStyle *style= UI_GetStyle();
static ARegionType type;
ARegion *ar;
uiTooltipData *data;
@@ -374,7 +376,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
EnumPropertyItem *item;
int i, totitem, free;
- RNA_property_enum_items(C, &but->rnapoin, but->rnaprop, &item, &totitem, &free);
+ RNA_property_enum_items_gettexted(C, &but->rnapoin, but->rnaprop, &item, &totitem, &free);
for(i=0; i<totitem; i++) {
if(item[i].identifier[0] && item[i].value == (int)but->hardmax) {
@@ -403,7 +405,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
prop= (but->opptr)? but->opptr->data: NULL;
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Shortcut: %s", buf);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Shortcut: %s")), buf);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -413,7 +415,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* full string */
ui_get_but_string(but, buf, sizeof(buf));
if(buf[0]) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Value: %s", buf);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Value: %s")), buf);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -425,7 +427,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if (unit_type == PROP_UNIT_ROTATION) {
if (RNA_property_type(but->rnaprop) == PROP_FLOAT) {
float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop);
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", value);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Radians: %f")), value);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -434,7 +436,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if(but->flag & UI_BUT_DRIVEN) {
if(ui_but_anim_expression_get(but, buf, sizeof(buf))) {
/* expression */
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Expression: %s", buf);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Expression: %s")), buf);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -442,7 +444,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* rna info */
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Python: %s.%s")), RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -450,7 +452,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if(but->rnapoin.id.data) {
ID *id= but->rnapoin.id.data;
if(id->lib && id->lib->name) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Library: %s", id->lib->name);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Library: %s")), id->lib->name);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -465,7 +467,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* operator info */
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Python: %s")), str);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -479,7 +481,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
WM_operator_poll_context(C, but->optype, but->opcontext);
poll_msg= CTX_wm_operator_poll_msg_get(C);
if(poll_msg) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Disabled: %s", poll_msg);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Disabled: %s")), poll_msg);
data->color[data->totline]= 0x6666ff; /* alert */
data->totline++;
}
@@ -489,7 +491,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
if(but->menu_create_func && WM_menutype_contains((MenuType *)but->poin)) {
MenuType *mt= (MenuType *)but->poin;
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", mt->idname);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Python: %s")), mt->idname);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -608,6 +610,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
return ar;
}
+#undef TIP_
void ui_tooltip_free(bContext *C, ARegion *ar)
{
@@ -985,7 +988,7 @@ static void ui_searchbox_region_free_cb(ARegion *ar)
ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
{
- uiStyle *style= U.uistyles.first; // XXX pass on as arg
+ uiStyle *style= UI_GetStyle();
static ARegionType type;
ARegion *ar;
uiSearchboxData *data;
@@ -2299,7 +2302,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, void *arg, char *str)
{
wmWindow *window= CTX_wm_window(C);
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
uiPopupBlockHandle *handle;
uiPopupMenu *pup;
@@ -2348,7 +2351,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
/* only return handler, and set optional title */
uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
{
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
uiPopupMenu *pup= MEM_callocN(sizeof(uiPopupMenu), "popup menu");
uiBut *but;
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 8d4b4209120..5ea20b33b3a 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -47,6 +47,7 @@
#include "BLF_api.h"
+#include "BLF_translation.h"
#include "UI_interface.h"
@@ -76,7 +77,7 @@
/* ********************************************** */
-static uiStyle *ui_style_new(ListBase *styles, const char *name)
+static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id)
{
uiStyle *style= MEM_callocN(sizeof(uiStyle), "new style");
@@ -85,7 +86,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
style->panelzoom= 1.0; /* unused */
- style->paneltitle.uifont_id= UIFONT_DEFAULT;
+ style->paneltitle.uifont_id= uifont_id;
style->paneltitle.points= 12;
style->paneltitle.kerning= 1;
style->paneltitle.shadow= 1;
@@ -94,7 +95,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
style->paneltitle.shadowalpha= 0.15f;
style->paneltitle.shadowcolor= 1.0f;
- style->grouplabel.uifont_id= UIFONT_DEFAULT;
+ style->grouplabel.uifont_id= uifont_id;
style->grouplabel.points= 12;
style->grouplabel.kerning= 1;
style->grouplabel.shadow= 3;
@@ -102,7 +103,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
style->grouplabel.shady= -1;
style->grouplabel.shadowalpha= 0.25f;
- style->widgetlabel.uifont_id= UIFONT_DEFAULT;
+ style->widgetlabel.uifont_id= uifont_id;
style->widgetlabel.points= 11;
style->widgetlabel.kerning= 1;
style->widgetlabel.shadow= 3;
@@ -111,7 +112,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
style->widgetlabel.shadowalpha= 0.15f;
style->widgetlabel.shadowcolor= 1.0f;
- style->widget.uifont_id= UIFONT_DEFAULT;
+ style->widget.uifont_id= uifont_id;
style->widget.points= 11;
style->widget.kerning= 1;
style->widget.shadowalpha= 0.25f;
@@ -251,11 +252,19 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
}
/* ************** helpers ************************ */
+/* XXX: read a style configure */
+uiStyle* UI_GetStyle(void)
+{
+ uiStyle *style = NULL;
+ /* offset is two struct uiStyle pointers */
+ /* style = BLI_findstring( &U.uistyles, "Unifont Style", sizeof(style)*2 ) */;
+ return (style != NULL) ? style : U.uistyles.first;
+}
/* temporarily, does widget font */
int UI_GetStringWidth(const char *str)
{
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
uiFontStyle *fstyle= &style->widget;
int width;
@@ -274,7 +283,7 @@ int UI_GetStringWidth(const char *str)
/* temporarily, does widget font */
void UI_DrawString(float x, float y, const char *str)
{
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
if (style->widget.kerning == 1)
BLF_enable(style->widget.uifont_id, BLF_KERNING_DEFAULT);
@@ -313,7 +322,17 @@ void uiStyleInit(void)
for(font= U.uifonts.first; font; font= font->next) {
if(font->uifont_id==UIFONT_DEFAULT) {
+#ifdef INTERNATIONAL
+ int 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);
+ else
+ font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+#else
font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+#endif
}
else {
font->blf_id= BLF_load(font->filename);
@@ -337,7 +356,7 @@ void uiStyleInit(void)
}
if(style==NULL) {
- ui_style_new(&U.uistyles, "Default Style");
+ ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT );
}
// XXX, this should be moved into a style, but for now best only load the monospaced font once.
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 493ccebc19e..af515bf8061 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -68,6 +68,7 @@
#include "interface_intern.h"
#include "BLF_api.h"
+#include "BLF_translation.h"
void UI_template_fix_linking(void)
{
@@ -306,31 +307,31 @@ static const char *template_id_browse_tip(StructRNA *type)
{
if(type) {
switch(RNA_type_to_ID_code(type)) {
- case ID_SCE: return "Browse Scene to be linked";
- case ID_OB: return "Browse Object to be linked";
- case ID_ME: return "Browse Mesh Data to be linked";
- case ID_CU: return "Browse Curve Data to be linked";
- case ID_MB: return "Browse MetaBall Data to be linked";
- case ID_MA: return "Browse Material to be linked";
- case ID_TE: return "Browse Texture to be linked";
- case ID_IM: return "Browse Image to be linked";
- case ID_LT: return "Browse Lattice Data to be linked";
- case ID_LA: return "Browse Lamp Data to be linked";
- case ID_CA: return "Browse Camera Data to be linked";
- case ID_WO: return "Browse World Settings to be linked";
- case ID_SCR: return "Choose Screen lay-out";
- case ID_TXT: return "Browse Text to be linked";
- case ID_SPK: return "Browse Speaker Data to be linked";
- case ID_SO: return "Browse Sound to be linked";
- case ID_AR: return "Browse Armature data to be linked";
- case ID_AC: return "Browse Action to be linked";
- case ID_NT: return "Browse Node Tree to be linked";
- case ID_BR: return "Browse Brush to be linked";
- case ID_PA: return "Browse Particle System to be linked";
- case ID_GD: return "Browse Grease Pencil Data to be linked";
+ case ID_SCE: return N_("Browse Scene to be linked");
+ case ID_OB: return N_("Browse Object to be linked");
+ case ID_ME: return N_("Browse Mesh Data to be linked");
+ case ID_CU: return N_("Browse Curve Data to be linked");
+ case ID_MB: return N_("Browse MetaBall Data to be linked");
+ case ID_MA: return N_("Browse Material to be linked");
+ case ID_TE: return N_("Browse Texture to be linked");
+ case ID_IM: return N_("Browse Image to be linked");
+ case ID_LT: return N_("Browse Lattice Data to be linked");
+ case ID_LA: return N_("Browse Lamp Data to be linked");
+ case ID_CA: return N_("Browse Camera Data to be linked");
+ case ID_WO: return N_("Browse World Settings to be linked");
+ case ID_SCR: return N_("Choose Screen lay-out");
+ case ID_TXT: return N_("Browse Text to be linked");
+ case ID_SPK: return N_("Browse Speaker Data to be linked");
+ case ID_SO: return N_("Browse Sound to be linked");
+ case ID_AR: return N_("Browse Armature data to be linked");
+ case ID_AC: return N_("Browse Action to be linked");
+ case ID_NT: return N_("Browse Node Tree to be linked");
+ case ID_BR: return N_("Browse Brush to be linked");
+ case ID_PA: return N_("Browse Particle System to be linked");
+ case ID_GD: return N_("Browse Grease Pencil Data to be linked");
}
}
- return "Browse ID data to be linked";
+ return N_("Browse ID data to be linked");
}
static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, const char *newop, const char *openop, const char *unlinkop)
@@ -355,7 +356,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
if(flag & UI_ID_PREVIEWS) {
- but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6, template_id_browse_tip(type));
+ but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6,
+ UI_translate_do_tooltip(template_id_browse_tip(type)));
if(type) {
but->icon= RNA_struct_ui_icon(type);
if (id) but->icon = ui_id_icon_get(C, id, 1);
@@ -367,7 +369,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
uiLayoutRow(layout, 1);
}
else if(flag & UI_ID_BROWSE) {
- but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y, template_id_browse_tip(type));
+ but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y,
+ UI_translate_do_tooltip(template_id_browse_tip(type)));
if(type) {
but->icon= RNA_struct_ui_icon(type);
/* default dragging of icon for id browse buttons */
@@ -393,12 +396,12 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
if(id->lib) {
if(id->flag & LIB_INDIRECT) {
but= uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0,
- "Indirect library datablock, cannot change");
+ UI_translate_do_tooltip(N_("Indirect library datablock, cannot change")));
uiButSetFlag(but, UI_BUT_DISABLED);
}
else {
but= uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0,
- "Direct linked library datablock, click to make local");
+ UI_translate_do_tooltip(N_("Direct linked library datablock, click to make local")));
if(!id_make_local(id, 1 /* test */) || (idfrom && idfrom->lib))
uiButSetFlag(but, UI_BUT_DISABLED);
}
@@ -411,7 +414,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
sprintf(str, "%d", id->us);
- but= uiDefBut(block, BUT, 0, str, 0,0,UI_UNIT_X + ((id->us < 10) ? 0:10), UI_UNIT_Y, NULL, 0, 0, 0, 0, "Displays number of users of this data, click to make a single-user copy");
+ but= uiDefBut(block, BUT, 0, str, 0,0,UI_UNIT_X + ((id->us < 10) ? 0:10), UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ UI_translate_do_tooltip(_("Displays number of users of this data. Click to make a single-user copy")));
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE));
if(!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib) || !editable)
@@ -429,11 +433,11 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
int w= id?UI_UNIT_X: (flag & UI_ID_OPEN)? UI_UNIT_X*3: UI_UNIT_X*6;
if(newop) {
- but= uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id)? "": "New", 0, 0, w, UI_UNIT_Y, NULL);
+ but= uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id)? "": UI_translate_do_iface(N_("New")), 0, 0, w, UI_UNIT_Y, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
else {
- but= uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id)? "": "New", 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+ but= uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id)? "": _("New"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
@@ -445,11 +449,11 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
int w= id?UI_UNIT_X: (flag & UI_ID_ADD_NEW)? UI_UNIT_X*3: UI_UNIT_X*6;
if(openop) {
- but= uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id)? "": "Open", 0, 0, w, UI_UNIT_Y, NULL);
+ but= uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id)? "": UI_translate_do_iface(N_("Open")), 0, 0, w, UI_UNIT_Y, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN));
}
else {
- but= uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id)? "": "Open", 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+ but= uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id)? "": UI_translate_do_iface(N_("Open")), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN));
}
@@ -465,7 +469,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
uiButSetNFunc(but, NULL, MEM_dupallocN(template), NULL);
}
else {
- but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Unlink datablock. Shift + Click to set users to zero, data will then not be saved");
+ but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ UI_translate_do_tooltip(N_("Unlink datablock. Shift + Click to set users to zero, data will then not be saved")));
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE));
if(RNA_property_flag(template->prop) & PROP_NEVER_NULL)
@@ -722,7 +727,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif
sprintf(str, "%s parent deform", md->name);
uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name");
- but = uiDefBut(block, BUT, 0, "Make Real", 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Convert virtual modifier to a real modifier");
+ but = uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Make Real")), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0,
+ UI_translate_do_tooltip(N_("Convert virtual modifier to a real modifier")));
uiButSetFunc(but, modifiers_convertToReal, ob, md);
}
else {
@@ -756,7 +762,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif
if ((ob->type==OB_MESH) && modifier_couldBeCage(scene, md) && (index <= lastCageIndex))
{
/* -- convert to rna ? */
- but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, "Apply modifier to editing cage during Editmode");
+ but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
+ UI_translate_do_tooltip(N_("Apply modifier to editing cage during Editmode")));
if (index < cageIndex)
uiButSetFlag(but, UI_BUT_DISABLED);
uiButSetFunc(but, modifiers_setOnCage, ob, md);
@@ -768,7 +775,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif
if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
/* add disabled pre-tesselated button, so users could have
message for this modifiers */
- but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, "This modifier could be applied on splines' points only");
+ but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
+ UI_translate_do_tooltip(N_("This modifier could be applied on splines' points only")));
uiButSetFlag(but, UI_BUT_DISABLED);
} else if (mti->type != eModifierTypeType_Constructive) {
/* constructive modifiers tesselates curve before applying */
@@ -818,17 +826,17 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif
}
else {
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
- uiItemEnumO(row, "OBJECT_OT_modifier_apply", "Apply", 0, "apply_as", MODIFIER_APPLY_DATA);
+ uiItemEnumO(row, "OBJECT_OT_modifier_apply", UI_translate_do_iface(N_("Apply")), 0, "apply_as", MODIFIER_APPLY_DATA);
if (modifier_sameTopology(md))
- uiItemEnumO(row, "OBJECT_OT_modifier_apply", "Apply as Shape", 0, "apply_as", MODIFIER_APPLY_SHAPE);
+ uiItemEnumO(row, "OBJECT_OT_modifier_apply", UI_translate_do_iface(N_("Apply as Shape")), 0, "apply_as", MODIFIER_APPLY_SHAPE);
}
uiBlockClearButLock(block);
uiBlockSetButLock(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE);
if (!ELEM5(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, eModifierType_Cloth, eModifierType_Smoke))
- uiItemO(row, "Copy", ICON_NONE, "OBJECT_OT_modifier_copy");
+ uiItemO(row, UI_translate_do_tooltip(N_("Copy")), ICON_NONE, "OBJECT_OT_modifier_copy");
}
/* result is the layout block inside the box, that we return so that modifier settings can be drawn */
@@ -1005,8 +1013,8 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
uiBlockSetEmboss(block, UI_EMBOSSN);
/* draw a ghost icon (for proxy) and also a lock beside it, to show that constraint is "proxy locked" */
- uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco+244, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Proxy Protected");
- uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco+262, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Proxy Protected");
+ uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco+244, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Proxy Protected")));
+ uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco+262, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Proxy Protected")));
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -1192,14 +1200,14 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr);
uiLayoutRow(layout, 1);
- uiDefButS(block, ROW, B_MATPRV, "Texture", 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, "");
+ uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Texture")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, "");
if(GS(parent->name) == ID_MA)
- uiDefButS(block, ROW, B_MATPRV, "Material", 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+ uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Material")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
else if(GS(parent->name) == ID_LA)
- uiDefButS(block, ROW, B_MATPRV, "Lamp", 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+ uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Lamp")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
else if(GS(parent->name) == ID_WO)
- uiDefButS(block, ROW, B_MATPRV, "World", 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
- uiDefButS(block, ROW, B_MATPRV, "Both", 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, "");
+ uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("World")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+ uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Both")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, "");
/* Alpha buton for texture preview */
if(*pr_texture!=TEX_PR_OTHER) {
@@ -1290,21 +1298,23 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
if(coba==NULL) return;
- bt= uiDefBut(block, BUT, 0, "Add", 0+xoffs,line1_y,40,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Add a new color stop to the colorband");
+ bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Add")), 0+xoffs,line1_y,40,UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ UI_translate_do_tooltip(N_("Add a new color stop to the colorband")));
uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba);
- bt= uiDefBut(block, BUT, 0, "Delete", 45+xoffs,line1_y,45,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Delete the active position");
+ bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Delete")), 45+xoffs,line1_y,45,UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ UI_translate_do_tooltip(N_("Delete the active position")));
uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba);
/* XXX, todo for later - convert to operator - campbell */
- bt= uiDefBut(block, BUT, 0, "F", 95+xoffs,line1_y,20,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Flip colorband");
+ bt= uiDefBut(block, BUT, 0, "F", 95+xoffs,line1_y,20,UI_UNIT_Y, NULL, 0, 0, 0, 0, UI_translate_do_tooltip(N_("Flip colorband")));
uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
- uiDefButS(block, NUM, 0, "", 120+xoffs,line1_y,80, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot-1)), 0, 0, "Choose active color stop");
+ uiDefButS(block, NUM, 0, "", 120+xoffs,line1_y,80, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot-1)), 0, 0, UI_translate_do_tooltip(N_("Choose active color stop")));
- bt= uiDefButS(block, MENU, 0, "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
- 210+xoffs, line1_y, 90, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, "Set interpolation between color stops");
+ bt= uiDefButS(block, MENU, 0, UI_translate_do_iface(N_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4")),
+ 210+xoffs, line1_y, 90, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, UI_translate_do_tooltip(N_("Set interpolation between color stops")));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
uiBlockEndAlign(block);
@@ -1333,11 +1343,13 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
float xs= butr->xmin;
uiBlockBeginAlign(block);
- bt= uiDefBut(block, BUT, 0, "Add", xs,butr->ymin+UI_UNIT_Y,2.0f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Add a new color stop to the colorband");
+ bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Add")), xs,butr->ymin+UI_UNIT_Y,2.0f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ UI_translate_do_tooltip(N_("Add a new color stop to the colorband")));
uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba);
- bt= uiDefBut(block, BUT, 0, "Delete", xs+2.0f*unit,butr->ymin+UI_UNIT_Y,1.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Delete the active position");
+ bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Delete")), xs+2.0f*unit,butr->ymin+UI_UNIT_Y,1.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ UI_translate_do_tooltip(N_("Delete the active position")));
uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba);
- bt= uiDefBut(block, BUT, 0, "F", xs+3.5f*unit,butr->ymin+UI_UNIT_Y,0.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Flip the color ramp");
+ bt= uiDefBut(block, BUT, 0, "F", xs+3.5f*unit,butr->ymin+UI_UNIT_Y,0.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, UI_translate_do_tooltip(N_("Flip the color ramp")));
uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
uiBlockEndAlign(block);
@@ -1348,8 +1360,9 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
uiItemR(layout, &ptr, "color", 0, "", ICON_NONE);
}
- bt= uiDefButS(block, MENU, 0, "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
- xs+10.0f*unit, butr->ymin+UI_UNIT_Y, unit*4, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, "Set interpolation between color stops");
+ bt= uiDefButS(block, MENU, 0, UI_translate_do_tooltip(N_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4")),
+ xs+10.0f*unit, butr->ymin+UI_UNIT_Y, unit*4, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0,
+ UI_translate_do_tooltip(N_("Set interpolation between color stops")));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
bt= uiDefBut(block, BUT_COLORBAND, 0, "", xs,butr->ymin,butr->xmax-butr->xmin,UI_UNIT_Y, coba, 0, 0, 0, 0, "");
@@ -1600,10 +1613,10 @@ static uiBlock *curvemap_clipping_func(bContext *C, struct ARegion *ar, void *cu
uiButSetFunc(bt, curvemap_buttons_setclip, cumap, NULL);
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, 0, "Min X ", 0,4*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, "");
- uiDefButF(block, NUM, 0, "Min Y ", 0,3*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, "");
- uiDefButF(block, NUM, 0, "Max X ", 0,2*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "Max Y ", 0,UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Min X ")), 0,4*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, "");
+ uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Min Y ")), 0,3*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, "");
+ uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Max X ")), 0,2*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Max Y ")), 0,UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, "");
uiBlockSetDirection(block, UI_RIGHT);
@@ -1652,12 +1665,12 @@ static uiBlock *curvemap_tools_func(bContext *C, struct ARegion *ar, void *cumap
block= uiBeginBlock(C, ar, "curvemap_tools_func", UI_EMBOSS);
uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset View", 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Vector Handle", 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Auto Handle", 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Horizontal", 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Extrapolated", 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Curve", 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset View")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Vector Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Auto Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Extend Horizontal")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 4, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Extend Extrapolated")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 5, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset Curve")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 50);
@@ -1674,10 +1687,10 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, struct ARegion *ar, void
block= uiBeginBlock(C, ar, "curvemap_tools_func", UI_EMBOSS);
uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset View", 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Vector Handle", 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Auto Handle", 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Curve", 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset View")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Vector Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Auto Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset Curve")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 50);
@@ -1794,24 +1807,24 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
uiBlockSetEmboss(block, UI_EMBOSSN);
- bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMIN, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, "Zoom in");
+ bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMIN, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Zoom in")));
uiButSetFunc(bt, curvemap_buttons_zoom_in, cumap, NULL);
- bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, "Zoom out");
+ bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Zoom out")));
uiButSetFunc(bt, curvemap_buttons_zoom_out, cumap, NULL);
if(brush)
- bt= uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, "Tools");
+ bt= uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, UI_translate_do_tooltip(N_("Tools")));
else
- bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, "Tools");
+ bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, UI_translate_do_tooltip(N_("Tools")));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
if(cumap->flag & CUMA_DO_CLIP) icon= ICON_CLIPUV_HLT; else icon= ICON_CLIPUV_DEHLT;
- bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, "Clipping Options");
+ bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, UI_translate_do_tooltip(N_("Clipping Options")));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
- bt= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, "Delete points");
+ bt= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Delete points")));
uiButSetNFunc(bt, curvemap_buttons_delete, MEM_dupallocN(cb), cumap);
uiBlockSetEmboss(block, UI_EMBOSS);
@@ -1830,7 +1843,8 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
uiItemR(uiLayoutColumn(split, 0), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiLayoutRow(layout, 0);
- bt=uiDefBut(block, BUT, 0, "Reset", 0, 0, UI_UNIT_X*10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Reset Black/White point and curves");
+ bt=uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Reset")), 0, 0, UI_UNIT_X*10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
+ UI_translate_do_tooltip(N_("Reset Black/White point and curves")));
uiButSetNFunc(bt, curvemap_buttons_reset, MEM_dupallocN(cb), cumap);
}
@@ -2449,16 +2463,18 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
(void)ui_abs; // UNUSED
uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE,
- 0, UI_UNIT_Y*0.1, UI_UNIT_X*0.8, UI_UNIT_Y*0.8, NULL, 0.0f, 0.0f, 0, 0, "Stop this job");
+ 0, UI_UNIT_Y*0.1, UI_UNIT_X*0.8, UI_UNIT_Y*0.8, NULL, 0.0f, 0.0f, 0, 0, UI_translate_do_tooltip(N_("Stop this job")));
uiDefBut(block, PROGRESSBAR, 0, WM_jobs_name(wm, owner),
- UI_UNIT_X, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, "Progress");
+ UI_UNIT_X, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, UI_translate_do_tooltip(N_("Progress")));
uiLayoutRow(layout, 0);
}
if(WM_jobs_test(wm, screen))
- uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, "Capture", 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Stop screencast");
+ uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, UI_translate_do_iface(N_("Capture")), 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
+ UI_translate_do_tooltip(N_("Stop screencast")));
if(screen->animtimer)
- uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, "Anim Player", 0,0,100,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Stop animation playback");
+ uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, UI_translate_do_tooltip(N_("Anim Player")), 0,0,100,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
+ UI_translate_do_tooltip(N_("Stop animation playback")));
}
/************************* Reports for Last Operator Template **************************/
@@ -2520,7 +2536,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
uiBlockSetEmboss(block, UI_EMBOSSN);
if (reports->list.first != reports->list.last)
- uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, "Click to see rest of reports in textblock: 'Recent Reports'");
+ uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, UI_translate_do_tooltip(N_("Click to see rest of reports in textblock: 'Recent Reports'")));
else
uiDefIconBut(block, LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index a3f56192cb5..a49060eaca2 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -37,6 +37,8 @@
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
@@ -114,7 +116,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
}
case PROP_COLLECTION: {
char text[256];
- sprintf(text, "%d items", RNA_property_collection_length(ptr, prop));
+ sprintf(text, UI_translate_do_iface(N_("%d items")), RNA_property_collection_length(ptr, prop));
but= uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL);
uiButSetFlag(but, UI_BUT_DISABLED);
break;
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 9242ddc2f60..18db1c8c894 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -168,7 +168,7 @@ static void view2d_masks(View2D *v2d)
void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
{
short tot_changed= 0, init= 0;
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
/* initialise data if there is a need for such */
if ((v2d->flag & V2D_IS_INITIALISED) == 0) {
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 460c2f038a4..0aaf6fe3bc6 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -51,6 +51,7 @@
#include "ED_screen.h"
#include "UI_view2d.h"
+#include "UI_interface.h"
#include "PIL_time.h" /* USER_ZOOM_CONT */
@@ -1587,7 +1588,7 @@ static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
static int reset_exec(bContext *C, wmOperator *UNUSED(op))
{
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
ARegion *ar= CTX_wm_region(C);
View2D *v2d= &ar->v2d;
int winx, winy;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index d41d3245623..8951df9221e 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -43,6 +43,8 @@
#include "BLI_rand.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_screen.h"
@@ -1347,7 +1349,7 @@ void ED_area_prevspace(bContext *C, ScrArea *sa)
static const char *editortype_pup(void)
{
- return(
+ const char *types= N_(
"Editor type:%t"
"|3D View %x1"
@@ -1382,6 +1384,8 @@ static const char *editortype_pup(void)
"|Python Console %x18"
);
+
+ return UI_translate_do_iface(types);
}
static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
@@ -1403,8 +1407,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
but= uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D,
editortype_pup(), xco, yco, UI_UNIT_X+10, UI_UNIT_Y,
&(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays current editor type. "
- "Click for menu of available types");
+ UI_translate_do_tooltip(N_("Displays current editor type. Click for menu of available types")));
uiButSetFunc(but, spacefunc, NULL, NULL);
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
@@ -1449,7 +1452,7 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *context, int contextnr)
{
ScrArea *sa= CTX_wm_area(C);
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
uiBlock *block;
PanelType *pt;
Panel *panel;
@@ -1637,7 +1640,7 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
void ED_region_header(const bContext *C, ARegion *ar)
{
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
uiBlock *block;
uiLayout *layout;
HeaderType *ht;
diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt
index 631e2adea34..a9aaf6a6d58 100644
--- a/source/blender/editors/space_buttons/CMakeLists.txt
+++ b/source/blender/editors/space_buttons/CMakeLists.txt
@@ -21,6 +21,7 @@
set(INC
../include
+ ../../blenfont
../../blenkernel
../../blenlib
../../blenloader
diff --git a/source/blender/editors/space_buttons/SConscript b/source/blender/editors/space_buttons/SConscript
index a4270f1f59a..740353bc1f0 100644
--- a/source/blender/editors/space_buttons/SConscript
+++ b/source/blender/editors/space_buttons/SConscript
@@ -3,7 +3,7 @@ Import ('env')
sources = env.Glob('*.c')
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../makesrna ../../render/extern/include ../../blenloader'
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index e631718b0cb..b18b5373240 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -37,6 +37,7 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
#include "BKE_context.h"
@@ -124,24 +125,23 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
#define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \
if(sbuts->pathflag & (1<<_ctx)) { \
- but= uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, _tip); \
+ but= uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, UI_translate_do_tooltip(_tip)); \
uiButClearFlag(but, UI_BUT_UNDO); \
} \
-
- BUTTON_HEADER_CTX(BCONTEXT_RENDER, ICON_SCENE, "Render")
- BUTTON_HEADER_CTX(BCONTEXT_SCENE, ICON_SCENE_DATA, "Scene");
- BUTTON_HEADER_CTX(BCONTEXT_WORLD, ICON_WORLD, "World");
- BUTTON_HEADER_CTX(BCONTEXT_OBJECT, ICON_OBJECT_DATA, "Object");
- BUTTON_HEADER_CTX(BCONTEXT_CONSTRAINT, ICON_CONSTRAINT, "Object Constraints");
- BUTTON_HEADER_CTX(BCONTEXT_MODIFIER, ICON_MODIFIER, "Object Modifiers");
- BUTTON_HEADER_CTX(BCONTEXT_DATA, sbuts->dataicon, "Object Data");
- BUTTON_HEADER_CTX(BCONTEXT_BONE, ICON_BONE_DATA, "Bone");
- BUTTON_HEADER_CTX(BCONTEXT_BONE_CONSTRAINT, ICON_CONSTRAINT_BONE, "Bone Constraints");
- BUTTON_HEADER_CTX(BCONTEXT_MATERIAL, ICON_MATERIAL, "Material");
- BUTTON_HEADER_CTX(BCONTEXT_TEXTURE, ICON_TEXTURE, "Textures");
- BUTTON_HEADER_CTX(BCONTEXT_PARTICLE, ICON_PARTICLES, "Particles");
- BUTTON_HEADER_CTX(BCONTEXT_PHYSICS, ICON_PHYSICS, "Physics");
+ BUTTON_HEADER_CTX(BCONTEXT_RENDER, ICON_SCENE, N_("Render"))
+ BUTTON_HEADER_CTX(BCONTEXT_SCENE, ICON_SCENE_DATA, N_("Scene"));
+ BUTTON_HEADER_CTX(BCONTEXT_WORLD, ICON_WORLD, N_("World"));
+ BUTTON_HEADER_CTX(BCONTEXT_OBJECT, ICON_OBJECT_DATA, N_("Object"));
+ BUTTON_HEADER_CTX(BCONTEXT_CONSTRAINT, ICON_CONSTRAINT, N_("Object Constraints"));
+ BUTTON_HEADER_CTX(BCONTEXT_MODIFIER, ICON_MODIFIER, N_("Object Modifiers"));
+ BUTTON_HEADER_CTX(BCONTEXT_DATA, sbuts->dataicon, N_("Object Data"));
+ BUTTON_HEADER_CTX(BCONTEXT_BONE, ICON_BONE_DATA, N_("Bone"));
+ BUTTON_HEADER_CTX(BCONTEXT_BONE_CONSTRAINT, ICON_CONSTRAINT_BONE, N_("Bone Constraints"));
+ BUTTON_HEADER_CTX(BCONTEXT_MATERIAL, ICON_MATERIAL, N_("Material"));
+ BUTTON_HEADER_CTX(BCONTEXT_TEXTURE, ICON_TEXTURE, N_("Textures"));
+ BUTTON_HEADER_CTX(BCONTEXT_PARTICLE, ICON_PARTICLES, N_("Particles"));
+ BUTTON_HEADER_CTX(BCONTEXT_PHYSICS, ICON_PHYSICS, N_("Physics"));
#undef BUTTON_HEADER_CTX
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 5f9b91e9cc2..b2b734159ff 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -50,6 +50,7 @@
#include "BKE_main.h"
#include "BLF_api.h"
+#include "BLF_translation.h"
#include "IMB_imbuf_types.h"
@@ -181,7 +182,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "",
min_x, line1_y, line1_w-chan_offs, btn_h,
params->dir, 0.0, (float)FILE_MAX-1, 0, 0,
- "File path");
+ UI_translate_do_tooltip(N_("File path")));
uiButSetCompleteFunc(but, autocomplete_directory, NULL);
uiButSetFlag(but, UI_BUT_NO_UTF8);
@@ -189,7 +190,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
but = uiDefBut(block, TEX, B_FS_FILENAME, "",
min_x, line2_y, line2_w-chan_offs, btn_h,
params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0,
- overwrite_alert ?"File name, overwrite existing" : "File name");
+ UI_translate_do_tooltip(overwrite_alert ?N_("File name, overwrite existing") : N_("File name")));
uiButSetCompleteFunc(but, autocomplete_file, NULL);
uiButSetFlag(but, UI_BUT_NO_UTF8);
@@ -209,13 +210,13 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMOUT,
min_x + line2_w + separator - chan_offs, line2_y,
btn_fn_w, btn_h,
- "Decrement the filename number");
+ UI_translate_do_tooltip(N_("Decrement the filename number")));
RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", -1);
but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMIN,
min_x + line2_w + separator + btn_fn_w - chan_offs, line2_y,
btn_fn_w, btn_h,
- "Increment the filename number");
+ UI_translate_do_tooltip(N_("Increment the filename number")));
RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", 1);
uiBlockEndAlign(block);
}
@@ -226,9 +227,9 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
uiDefButO(block, BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, params->title,
max_x - loadbutton, line1_y, loadbutton, btn_h,
params->title);
- uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, "Cancel",
+ uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, UI_translate_do_iface(N_("Cancel")),
max_x - loadbutton, line2_y, loadbutton, btn_h,
- "Cancel");
+ UI_translate_do_tooltip(N_("Cancel")));
}
uiEndBlock(C, block);
@@ -295,7 +296,7 @@ static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon,
static void file_draw_string(int sx, int sy, const char* string, float width, int height, short align)
{
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
uiFontStyle fs = style->widgetlabel;
rcti rect;
char fname[FILE_MAXFILE];
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 959b1ddf1b5..37dce293d77 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -37,6 +37,8 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
@@ -144,7 +146,7 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa)
if(sfile) {
row= uiLayoutRow(pa->layout, 0);
- uiItemO(row, "Add", ICON_ZOOMIN, "file.bookmark_add");
+ uiItemO(row, UI_translate_do_iface(N_("Add")), ICON_ZOOMIN, "file.bookmark_add");
uiItemL(row, NULL, ICON_NONE);
file_panel_category(C, pa, FS_CATEGORY_BOOKMARKS, &sfile->bookmarknr, ICON_BOOKMARKS, 1, 0);
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index a8e7e08a7e0..1e113abfcd2 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -403,7 +403,7 @@ float file_shorten_string(char* string, float w, int front)
float file_string_width(const char* str)
{
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
uiStyleFontSet(&style->widget);
return BLF_width(style->widget.uifont_id, str);
}
@@ -413,12 +413,12 @@ float file_font_pointsize(void)
#if 0
float s;
char tmp[2] = "X";
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
uiStyleFontSet(&style->widget);
s = BLF_height(style->widget.uifont_id, tmp);
return style->widget.points;
#else
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
uiStyleFontSet(&style->widget);
return style->widget.points * UI_DPI_FAC;
#endif
diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt
index 80205ad5564..28383b29b36 100644
--- a/source/blender/editors/space_graph/CMakeLists.txt
+++ b/source/blender/editors/space_graph/CMakeLists.txt
@@ -21,6 +21,7 @@
set(INC
../include
+ ../../blenfont
../../blenkernel
../../blenlib
../../blenloader
diff --git a/source/blender/editors/space_graph/SConscript b/source/blender/editors/space_graph/SConscript
index 75d0927192b..fe8846d2c30 100644
--- a/source/blender/editors/space_graph/SConscript
+++ b/source/blender/editors/space_graph/SConscript
@@ -3,7 +3,7 @@ Import ('env')
sources = env.Glob('*.c')
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
+incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' #/intern/audaspace/intern ../../blenloader'
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index ffb43b753af..28fd1cd3304 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -46,6 +46,8 @@
#include "BLI_rand.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_fcurve.h"
@@ -750,7 +752,8 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
block= uiLayoutGetBlock(row);
// XXX for now, this will be a operator button which calls a 'add modifier' operator
- uiDefButO(block, BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, "Add Modifier", 10, 0, 150, 20, "Adds a new F-Curve Modifier for the active F-Curve");
+ uiDefButO(block, BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, UI_translate_do_iface(N_("Add Modifier")), 10, 0, 150, 20,
+ UI_translate_do_tooltip(N_("Adds a new F-Curve Modifier for the active F-Curve")));
/* copy/paste (as sub-row)*/
row= uiLayoutRow(row, 1);
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index bd2e8077eab..75e13b24ede 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -41,6 +41,8 @@
#include "BLI_rand.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_screen.h"
@@ -278,7 +280,7 @@ static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu)
uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
}
} else {
- uiItemL(layout, "No Recent Files", ICON_NONE);
+ uiItemL(layout, UI_translate_do_iface(N_("No Recent Files")), ICON_NONE);
}
}
diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt
index 44471902040..f4bb255e11f 100644
--- a/source/blender/editors/space_logic/CMakeLists.txt
+++ b/source/blender/editors/space_logic/CMakeLists.txt
@@ -21,10 +21,11 @@
set(INC
../include
- ../interface
+ ../../blenfont
../../blenkernel
../../blenlib
../../blenloader
+ ../../editors/interface
../../makesdna
../../makesrna
../../windowmanager
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 00f8f488b3c..3a4371e8bb9 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -4548,7 +4548,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
/* ****************** Controllers ****************** */
xco= 420; yco= 170; width= 300;
- layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, U.uistyles.first);
+ layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
row = uiLayoutRow(layout, 1);
uiDefBlockBut(block, controller_menu, NULL, "Controllers", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */
@@ -4651,7 +4651,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
/* ****************** Sensors ****************** */
xco= 10; yco= 170; width= 340;
- layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, U.uistyles.first);
+ layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
row = uiLayoutRow(layout, 1);
uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */
@@ -4717,7 +4717,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
/* ****************** Actuators ****************** */
xco= 800; yco= 170; width= 340;
- layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, U.uistyles.first);
+ layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
row = uiLayoutRow(layout, 1);
uiDefBlockBut(block, actuator_menu, NULL, "Actuators", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */
diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt
index b05d157365d..819e80d7b2e 100644
--- a/source/blender/editors/space_nla/CMakeLists.txt
+++ b/source/blender/editors/space_nla/CMakeLists.txt
@@ -21,6 +21,7 @@
set(INC
../include
+ ../../blenfont
../../blenkernel
../../blenlib
../../blenloader
diff --git a/source/blender/editors/space_nla/SConscript b/source/blender/editors/space_nla/SConscript
index 51ce829ed8d..6738f3380b4 100644
--- a/source/blender/editors/space_nla/SConscript
+++ b/source/blender/editors/space_nla/SConscript
@@ -3,7 +3,7 @@ Import ('env')
sources = env.Glob('*.c')
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
+incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../blenloader'
env.BlenderLib ( 'bf_editors_space_nla', sources, Split(incs), [], libtype=['core'], priority=[85] )
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 4392e49e5d7..5e1f2745559 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -45,6 +45,8 @@
#include "BLI_editVert.h"
#include "BLI_rand.h"
+#include "BLF_translation.h"
+
#include "BKE_nla.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -446,7 +448,8 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa)
// XXX for now, this will be a operator button which calls a temporary 'add modifier' operator
// FIXME: we need to set the only-active property so that this will only add modifiers for the active strip (not all selected)
- uiDefButO(block, BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, "Add Modifier", 10, 0, 150, 20, "Adds a new F-Modifier for the active NLA Strip");
+ uiDefButO(block, BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, UI_translate_do_iface(N_("Add Modifier")), 10, 0, 150, 20,
+ UI_translate_do_tooltip(N_("Adds a new F-Modifier for the active NLA Strip")));
/* copy/paste (as sub-row)*/
row= uiLayoutRow(row, 1);
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index c1b114d5436..e713ed5a678 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -303,7 +303,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
layout= uiBlockLayout(node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
- locx+NODE_DYS, dy, node->butr.xmax, NODE_DY, U.uistyles.first);
+ locx+NODE_DYS, dy, node->butr.xmax, NODE_DY, UI_GetStyle());
node->typeinfo->uifunc(layout, (bContext *)C, &ptr);
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index 7077f4a7497..996e05afdef 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -44,6 +44,8 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_screen.h"
@@ -216,6 +218,7 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
}
}
+#define IFACE_(msgid) UI_translate_do_iface(msgid)
static void node_menu_add(const bContext *C, Menu *menu)
{
SpaceNode *snode= CTX_wm_space_node(C);
@@ -225,39 +228,40 @@ static void node_menu_add(const bContext *C, Menu *menu)
uiLayoutSetActive(layout, 0);
if(snode->treetype==NTREE_SHADER) {
- uiItemMenuF(layout, "Input", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
- uiItemMenuF(layout, "Output", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
- uiItemMenuF(layout, "Color", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR));
- uiItemMenuF(layout, "Vector", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR));
- uiItemMenuF(layout, "Convertor", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
- uiItemMenuF(layout, "Group", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP));
- uiItemMenuF(layout, "Dynamic", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_DYNAMIC));
- uiItemMenuF(layout, "Layout", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT));
+ uiItemMenuF(layout, IFACE_(N_("Input")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
+ uiItemMenuF(layout, IFACE_(N_("Output")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
+ uiItemMenuF(layout, IFACE_(N_("Color")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR));
+ uiItemMenuF(layout, IFACE_(N_("Vector")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR));
+ uiItemMenuF(layout, IFACE_(N_("Convertor")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
+ uiItemMenuF(layout, IFACE_(N_("Group")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP));
+ uiItemMenuF(layout, IFACE_(N_("Dynamic")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_DYNAMIC));
+ uiItemMenuF(layout, IFACE_(N_("Layout")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT));
}
else if(snode->treetype==NTREE_COMPOSIT) {
- uiItemMenuF(layout, "Input", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
- uiItemMenuF(layout, "Output", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
- uiItemMenuF(layout, "Color", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR));
- uiItemMenuF(layout, "Vector", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR));
- uiItemMenuF(layout, "Filter", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_FILTER));
- uiItemMenuF(layout, "Convertor", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
- uiItemMenuF(layout, "Matte", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_MATTE));
- uiItemMenuF(layout, "Distort", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT));
- uiItemMenuF(layout, "Group", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP));
- uiItemMenuF(layout, "Layout", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT));
+ uiItemMenuF(layout, IFACE_(N_("Input")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
+ uiItemMenuF(layout, IFACE_(N_("Output")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
+ uiItemMenuF(layout, IFACE_(N_("Color")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR));
+ uiItemMenuF(layout, IFACE_(N_("Vector")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR));
+ uiItemMenuF(layout, IFACE_(N_("Filter")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_FILTER));
+ uiItemMenuF(layout, IFACE_(N_("Convertor")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
+ uiItemMenuF(layout, IFACE_(N_("Matte")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_MATTE));
+ uiItemMenuF(layout, IFACE_(N_("Distort")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT));
+ uiItemMenuF(layout, IFACE_(N_("Group")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP));
+ uiItemMenuF(layout, IFACE_(N_("Layout")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT));
}
else if(snode->treetype==NTREE_TEXTURE) {
- uiItemMenuF(layout, "Input", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
- uiItemMenuF(layout, "Output", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
- uiItemMenuF(layout, "Color", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR));
- uiItemMenuF(layout, "Patterns", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_PATTERN));
- uiItemMenuF(layout, "Textures", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE));
- uiItemMenuF(layout, "Convertor", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
- uiItemMenuF(layout, "Distort", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT));
- uiItemMenuF(layout, "Group", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP));
- uiItemMenuF(layout, "Layout", 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT));
+ uiItemMenuF(layout, IFACE_(N_("Input")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
+ uiItemMenuF(layout, IFACE_(N_("Output")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
+ uiItemMenuF(layout, IFACE_(N_("Color")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR));
+ uiItemMenuF(layout, IFACE_(N_("Patterns")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_PATTERN));
+ uiItemMenuF(layout, IFACE_(N_("Textures")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE));
+ uiItemMenuF(layout, IFACE_(N_("Convertor")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
+ uiItemMenuF(layout, IFACE_(N_("Distort")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT));
+ uiItemMenuF(layout, IFACE_(N_("Group")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP));
+ uiItemMenuF(layout, IFACE_(N_("Layout")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT));
}
}
+#undef IFACE_
void node_menus_register(void)
{
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 980e27ce116..0776ca752a9 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -47,6 +47,8 @@
#include "BLI_editVert.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_effect.h"
@@ -269,16 +271,29 @@ void VIEW3D_OT_layers(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "toggle", 1, "Toggle", "Toggle the layer");
}
+static int modeselect_addmode(char *str, const char *title, int id, int icon)
+{
+ static char formatstr[] = "|%s %%x%d %%i%d";
+
+ if(UI_translate_iface())
+ return sprintf(str, formatstr, BLF_gettext(title), id, icon);
+ else
+ return sprintf(str, formatstr, title, id, icon);
+}
+
static char *view3d_modeselect_pup(Scene *scene)
{
Object *ob= OBACT;
static char string[256];
- static char formatstr[] = "|%s %%x%d %%i%d";
+ const char *title= N_("Mode: %%t");
char *str = string;
- str += sprintf(str, "Mode: %%t");
+ if(U.transopts&USER_TR_IFACE)
+ title= BLF_gettext(title);
+
+ sprintf(str, title);
- str += sprintf(str, formatstr, "Object Mode", OB_MODE_OBJECT, ICON_OBJECT_DATA);
+ str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA);
if(ob==NULL || ob->data==NULL) return string;
if(ob->id.lib) return string;
@@ -289,31 +304,31 @@ static char *view3d_modeselect_pup(Scene *scene)
|| (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
|| (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
- str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT);
+ str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
}
else if (ob->type == OB_ARMATURE) {
if (ob->mode & OB_MODE_POSE)
- str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT);
+ str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT);
else
- str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT);
+ str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
}
if (ob->type == OB_MESH) {
- str += sprintf(str, formatstr, "Sculpt Mode", OB_MODE_SCULPT, ICON_SCULPTMODE_HLT);
- str += sprintf(str, formatstr, "Vertex Paint", OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT);
- str += sprintf(str, formatstr, "Texture Paint", OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT);
- str += sprintf(str, formatstr, "Weight Paint", OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT);
+ str += modeselect_addmode(str, N_("Sculpt Mode"), OB_MODE_SCULPT, ICON_SCULPTMODE_HLT);
+ str += modeselect_addmode(str, N_("Vertex Paint"), OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT);
+ str += modeselect_addmode(str, N_("Texture Paint"), OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT);
+ str += modeselect_addmode(str, N_("Weight Paint"), OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT);
}
}
/* if active object is an armature */
if (ob->type==OB_ARMATURE) {
- str += sprintf(str, formatstr, "Pose Mode", OB_MODE_POSE, ICON_POSE_HLT);
+ str += modeselect_addmode(str, N_("Pose Mode"), OB_MODE_POSE, ICON_POSE_HLT);
}
if (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody)) {
- str += sprintf(str, formatstr, "Particle Mode", OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE);
+ str += modeselect_addmode(str, N_("Particle Mode"), OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE);
}
(void)str;
return (string);
@@ -455,6 +470,7 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
}
}
+#define TIP_(msgid) UI_translate_do_tooltip(msgid)
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
{
bScreen *screen= CTX_wm_screen(C);
@@ -488,7 +504,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiBlockBeginAlign(block);
uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) ,
- 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, "Mode");
+ 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_(N_("Mode")));
uiBlockEndAlign(block);
/* Draw type */
@@ -522,11 +538,11 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
block= uiLayoutGetBlock(row);
if(v3d->twflag & V3D_USE_MANIPULATOR) {
- but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode");
+ but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Translate manipulator mode")));
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
- but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode");
+ but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Rotate manipulator mode")));
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
- but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode");
+ but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Scale manipulator mode")));
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
}
@@ -534,8 +550,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
v3d->twmode = 0;
}
- str_menu = BIF_menustringTransformOrientation(C, "Orientation");
- but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation");
+ str_menu = BIF_menustringTransformOrientation(C, N_("Orientation"));
+ but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_(N_("Transform Orientation")));
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
MEM_freeN((void *)str_menu);
}
@@ -555,4 +571,4 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiTemplateEditModeSelection(layout, C);
}
-
+#undef TIP_
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index a2aed67821d..ddea89e1cdb 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -48,6 +48,8 @@
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_idprop.h"
#include "BKE_global.h"
@@ -80,7 +82,7 @@ static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa)
wmOperator *op= WM_operator_last_redo(C);
if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
- else BLI_strncpy(pa->drawname, "Operator", sizeof(pa->drawname));
+ else BLI_strncpy(pa->drawname, N_("Operator"), sizeof(pa->drawname));
}
static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op)
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index e44cc1f5df3..c4305ed6a9f 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -21,6 +21,7 @@
set(INC
../include
+ ../../blenfont
../../blenkernel
../../blenlib
../../blenloader
diff --git a/source/blender/editors/transform/SConscript b/source/blender/editors/transform/SConscript
index edc2156a07b..f2d5baecfb3 100644
--- a/source/blender/editors/transform/SConscript
+++ b/source/blender/editors/transform/SConscript
@@ -3,7 +3,7 @@ Import ('env')
sources = env.Glob('*.c')
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../render/extern/include'
incs += ' ../../gpu ../../makesrna ../../blenloader'
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 7556c5ae110..cd4cbc77c49 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -50,6 +50,8 @@
#include "BLI_editVert.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
//#include "BIF_editmesh.h"
//#include "BIF_interface.h"
//#include "BIF_space.h"
@@ -60,6 +62,8 @@
#include "RNA_define.h"
+#include "UI_interface.h"
+
#include "transform.h"
/* *********************** TransSpace ************************** */
@@ -406,14 +410,18 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C)
}
const char * BIF_menustringTransformOrientation(const bContext *C, const char *title) {
- char menu[] = "%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3";
+ const char* menu = N_("%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3");
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
TransformOrientation *ts;
int i = V3D_MANIP_CUSTOM;
char *str_menu, *p;
+
+ if(UI_translate_iface()) {
+ title= BLF_gettext(title);
+ menu= BLF_gettext(menu);
+ }
-
- str_menu = MEM_callocN(strlen(menu) + strlen(title) + 1 + 40 * BIF_countTransformOrientation(C), "UserTransSpace from matrix");
+ str_menu = MEM_callocN(strlen(menu) + strlen(title) + 1 + 40 * BIF_countTransformOrientation(C), UI_translate_do_tooltip(N_("UserTransSpace from matrix")));
p = str_menu;
p += sprintf(str_menu, "%s", title);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index d3ac09dc812..05b16f869a8 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -510,8 +510,8 @@ extern UserDef U; /* from blenkernel blender.c */
/* transopts */
#define USER_TR_TOOLTIPS (1 << 0)
-#define USER_TR_BUTTONS (1 << 1)
-#define USER_TR_MENUS (1 << 2)
+#define USER_TR_IFACE (1 << 1)
+/*#define USER_TR_MENUS (1 << 2) deprecated*/
/*#define USER_TR_FILESELECT (1 << 3) deprecated*/
/*#define USER_TR_TEXTEDIT (1 << 4) deprecated*/
#define USER_DOTRANSLATE (1 << 5)
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 8af4fe7b76b..26bae68d5a4 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -49,7 +49,10 @@ struct Scene;
extern BlenderRNA BLENDER_RNA;
extern StructRNA RNA_Action;
extern StructRNA RNA_ActionConstraint;
+extern StructRNA RNA_ActionFCurves;
extern StructRNA RNA_ActionGroup;
+extern StructRNA RNA_ActionGroups;
+extern StructRNA RNA_ActionPoseMarkers;
extern StructRNA RNA_Actuator;
extern StructRNA RNA_ActuatorSensor;
extern StructRNA RNA_Addon;
@@ -190,6 +193,7 @@ extern StructRNA RNA_DelaySensor;
extern StructRNA RNA_DisplaceModifier;
extern StructRNA RNA_DistortedNoiseTexture;
extern StructRNA RNA_DomainFluidSettings;
+extern StructRNA RNA_DopeSheet;
extern StructRNA RNA_Driver;
extern StructRNA RNA_DriverTarget;
extern StructRNA RNA_DriverVariable;
@@ -260,11 +264,13 @@ extern StructRNA RNA_Key;
extern StructRNA RNA_KeyConfig;
extern StructRNA RNA_KeyMap;
extern StructRNA RNA_KeyMapItem;
+extern StructRNA RNA_KeyMapItems;
extern StructRNA RNA_KeyboardSensor;
extern StructRNA RNA_Keyframe;
extern StructRNA RNA_KeyingSet;
extern StructRNA RNA_KeyingSetInfo;
extern StructRNA RNA_KeyingSetPath;
+extern StructRNA RNA_KeyingSetsAll;
extern StructRNA RNA_KinematicConstraint;
extern StructRNA RNA_Lamp;
extern StructRNA RNA_LampSkySettings;
@@ -552,6 +558,7 @@ extern StructRNA RNA_UnknownType;
extern StructRNA RNA_UserPreferences;
extern StructRNA RNA_UserPreferencesEdit;
extern StructRNA RNA_UserPreferencesFilePaths;
+extern StructRNA RNA_UserPreferencesInput;
extern StructRNA RNA_UserPreferencesSystem;
extern StructRNA RNA_UserPreferencesView;
extern StructRNA RNA_UserSolidLight;
@@ -573,13 +580,13 @@ extern StructRNA RNA_WipeSequence;
extern StructRNA RNA_WoodTexture;
extern StructRNA RNA_World;
extern StructRNA RNA_WorldAmbientOcclusion;
+extern StructRNA RNA_WorldLighting;
extern StructRNA RNA_WorldMistSettings;
extern StructRNA RNA_WorldStarsSettings;
extern StructRNA RNA_WorldTextureSlot;
extern StructRNA RNA_XnorController;
extern StructRNA RNA_XorController;
-
/* Pointer
*
* These functions will fill in RNA pointers, this can be done in three ways:
@@ -689,6 +696,7 @@ int RNA_enum_name(EnumPropertyItem *item, const int value, const char **name);
int RNA_enum_description(EnumPropertyItem *item, const int value, const char **description);
void RNA_property_enum_items(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free);
+void RNA_property_enum_items_gettexted(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free);
int RNA_property_enum_value(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value);
int RNA_property_enum_identifier(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier);
int RNA_property_enum_name(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name);
diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript
index 10b20fc795a..d0002eda30b 100644
--- a/source/blender/makesrna/SConscript
+++ b/source/blender/makesrna/SConscript
@@ -62,4 +62,7 @@ if env['OURPLATFORM'] == 'linux':
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('INTERNATIONAL')
+
env.BlenderLib ( 'bf_rna', objs, Split(incs), defines=defs, libtype=['core','player'], priority = [165,20] )
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index c2b46a3b69a..966bc8f100c 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -219,6 +219,10 @@ if(WITH_OPENCOLLADA)
add_definitions(-DWITH_COLLADA)
endif()
+if(WITH_INTERNATIONAL)
+ add_definitions(-DINTERNATIONAL)
+endif()
+
# Build makesrna executable
blender_include_dirs(
.
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index 5c2580e4b90..ef05875fe86 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -98,6 +98,9 @@ if env['OURPLATFORM'] == 'linux':
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('INTERNATIONAL')
+
makesrna_tool.Append(CPPDEFINES=defs)
makesrna_tool.Append (CPPPATH = Split(incs))
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 5dad7112eb9..b7709416a75 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -43,6 +43,9 @@
#include "BLI_dynstr.h"
#include "BLI_ghash.h"
+#include "BLF_api.h"
+#include "BLF_translation.h"
+
#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_idprop.h"
@@ -449,8 +452,10 @@ static const char *rna_ensure_property_identifier(PropertyRNA *prop)
static const char *rna_ensure_property_description(PropertyRNA *prop)
{
+ const char *description= NULL;
+
if(prop->magic == RNA_MAGIC)
- return prop->description;
+ description= prop->description;
else {
/* attempt to get the local ID values */
IDProperty *idp_ui= rna_idproperty_ui(prop);
@@ -458,19 +463,36 @@ static const char *rna_ensure_property_description(PropertyRNA *prop)
if(idp_ui) {
IDProperty *item= IDP_GetPropertyTypeFromGroup(idp_ui, "description", IDP_STRING);
if(item)
- return IDP_String(item);
+ description= IDP_String(item);
}
- return ((IDProperty*)prop)->name; /* XXX - not correct */
+ if(description == NULL)
+ description= ((IDProperty*)prop)->name; /* XXX - not correct */
}
+
+#ifdef INTERNATIONAL
+ if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS))
+ description= BLF_gettext(description);
+#endif
+
+ return description;
}
static const char *rna_ensure_property_name(PropertyRNA *prop)
{
+ const char *name;
+
if(prop->magic == RNA_MAGIC)
- return prop->name;
+ name= prop->name;
else
- return ((IDProperty*)prop)->name;
+ name= ((IDProperty*)prop)->name;
+
+#ifdef INTERNATIONAL
+ if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE))
+ name= BLF_gettext(name);
+#endif
+
+ return name;
}
/* Structs */
@@ -1125,6 +1147,7 @@ void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, En
*totitem= tot;
}
+
}
else {
*item= eprop->item;
@@ -1133,6 +1156,45 @@ void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, En
}
}
+void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free)
+{
+ RNA_property_enum_items(C, ptr, prop, item, totitem, free);
+
+#ifdef INTERNATIONAL
+ if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) {
+ int i;
+ EnumPropertyItem *nitem;
+
+ if(*free) {
+ nitem= *item;
+ } else {
+ int totitem= 0;
+
+ /* count */
+ for(i=0; (*item)[i].identifier; i++)
+ totitem++;
+
+ nitem= MEM_callocN(sizeof(EnumPropertyItem)*(totitem+1), "enum_items_gettexted");
+
+ for(i=0; (*item)[i].identifier; i++)
+ nitem[i]= (*item)[i];
+
+ *free= 1;
+ }
+
+ for(i=0; nitem[i].identifier; i++) {
+ if( nitem[i].name )
+ nitem[i].name = BLF_gettext(nitem[i].name);
+ if( nitem[i].description )
+ nitem[i].description = BLF_gettext(nitem[i].description);
+ }
+
+ *item= nitem;
+ }
+#endif
+}
+
+
int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value)
{
EnumPropertyItem *item, *item_array;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 7a5899afd73..b9a53acd6f4 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -44,6 +44,7 @@
#include "WM_types.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
#include "BKE_sound.h"
@@ -76,6 +77,11 @@ static void rna_userdef_dpi_update(Main *bmain, Scene *scene, PointerRNA *ptr)
WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); /* refresh region sizes */
}
+static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+{
+ BLF_lang_set(NULL);
+}
+
static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
UserDef *userdef = (UserDef *)ptr->data;
@@ -2463,30 +2469,35 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
/* hardcoded here, could become dynamic somehow */
+ /* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */
+ /* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */
static EnumPropertyItem language_items[] = {
- {0, "ENGLISH", 0, "English", ""},
- {1, "JAPANESE", 0, "Japanese", ""},
- {2, "DUTCH", 0, "Dutch", ""},
- {3, "ITALIAN", 0, "Italian", ""},
- {4, "GERMAN", 0, "German", ""},
- {5, "FINNISH", 0, "Finnish", ""},
- {6, "SWEDISH", 0, "Swedish", ""},
- {7, "FRENCH", 0, "French", ""},
- {8, "SPANISH", 0, "Spanish", ""},
- {9, "CATALAN", 0, "Catalan", ""},
- {10, "CZECH", 0, "Czech", ""},
- {11, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese", ""},
- {12, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese", ""},
- {13, "RUSSIAN", 0, "Russian", ""},
- {14, "CROATIAN", 0, "Croatian", ""},
- {15, "SERBIAN", 0, "Serbian", ""},
- {16, "UKRAINIAN", 0, "Ukrainian", ""},
- {17, "POLISH", 0, "Polish", ""},
- {18, "ROMANIAN", 0, "Romanian", ""},
- {19, "ARABIC", 0, "Arabic", ""},
- {20, "BULGARIAN", 0, "Bulgarian", ""},
- {21, "GREEK", 0, "Greek", ""},
- {22, "KOREAN", 0, "Korean", ""},
+ {0, "DEFAULT", 0, N_("Default (Default)"), ""},
+ {1, "ENGLISH", 0, N_("English (English)"), "en_US"},
+ {2, "JAPANESE", 0, N_("Japanese (日本語)"), "ja_JP"},
+ {3, "DUTCH", 0, N_("Dutch (Nederlandse taal)"), "nl_NL"},
+ {4, "ITALIAN", 0, N_("Italian (Italiano)"), "it_IT"},
+ {5, "GERMAN", 0, N_("German (Deutsch)"), "de_DE"},
+ {6, "FINNISH", 0, N_("Finnish (Suomi)"), "fi_FI"},
+ {7, "SWEDISH", 0, N_("Swedish (Svenska)"), "sv_SE"},
+ {8, "FRENCH", 0, N_("French (Française)"), "fr_FR"},
+ {9, "SPANISH", 0, N_("Spanish (Español)"), "es_ES"},
+ {10, "CATALAN", 0, N_("Catalan (Català)"), "ca_AD"},
+ {11, "CZECH", 0, N_("Czech (Český)"), "cs_CZ"},
+ {12, "BRAZILIAN_PORTUGUESE", 0, N_("Brazilian Portuguese (Português do Brasil)"), "pt_BR"},
+ {13, "SIMPLIFIED_CHINESE", 0, N_("Simplified Chinese (简体中文)"), "zh_CN"},
+ {14, "TRADITIONAL_CHINESE", 0, N_("Traditional Chinese (繁體中文)"), "zh_TW"},
+ {15, "RUSSIAN", 0, N_("Russian (Русский)"), "ru_RU"},
+ {16, "CROATIAN", 0, N_("Croatian (Hrvatski)"), "hr_HR"},
+ {17, "SERBIAN", 0, N_("Serbian (Српском језику)"), "sr_RS"},
+ {18, "UKRAINIAN", 0, N_("Ukrainian (Український)"), "uk_UA"},
+ {19, "POLISH", 0, N_("Polish (Polski)"), "pl_PL"},
+ {20, "ROMANIAN", 0, N_("Romanian (Român)"), "ro_RO"},
+ {21, "ARABIC", 0, N_("Arabic (العربية)"), "ar_EG"},
+ {22, "BULGARIAN", 0, N_("Bulgarian (Български)"), "bg_BG"},
+ {23, "GREEK", 0, N_("Greek (Ελληνικά)"), "el_GR"},
+ {24, "KOREAN", 0, N_("Korean (한국 언어)"), "ko_KR"},
+ /*{25, "Nepali", 0, N_("Nepali (नेपाली)"), "ne_NP"},*/
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL);
@@ -2499,7 +2510,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_international_fonts", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_DOTRANSLATE);
RNA_def_property_ui_text(prop, "International Fonts", "Use international fonts");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
prop= RNA_def_property(srna, "dpi", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "dpi");
@@ -2522,21 +2533,16 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop= RNA_def_property(srna, "language", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, language_items);
RNA_def_property_ui_text(prop, "Language", "Language use for translation");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
prop= RNA_def_property(srna, "use_translate_tooltips", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_TOOLTIPS);
RNA_def_property_ui_text(prop, "Translate Tooltips", "Translate Tooltips");
RNA_def_property_update(prop, 0, "rna_userdef_update");
- prop= RNA_def_property(srna, "use_translate_buttons", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_BUTTONS);
- RNA_def_property_ui_text(prop, "Translate Buttons", "Translate button labels");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop= RNA_def_property(srna, "use_translate_toolbox", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_MENUS);
- RNA_def_property_ui_text(prop, "Translate Toolbox", "Translate toolbox menu");
+ prop= RNA_def_property(srna, "use_translate_interface", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_IFACE);
+ RNA_def_property_ui_text(prop, "Translate Interface", "Translate Interface");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "use_textured_fonts", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript
index 9d7928c4432..5cc3f3bedc4 100644
--- a/source/blender/python/SConscript
+++ b/source/blender/python/SConscript
@@ -17,6 +17,9 @@ defs = []
if is_debug:
defs.append('_DEBUG')
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('INTERNATIONAL')
+
sources = env.Glob('generic/*.c')
env.BlenderLib( libname = 'bf_python_ext', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [363,165]) # ketsji is 360
diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt
index 8dfbf476995..0a49036c15d 100644
--- a/source/blender/python/generic/CMakeLists.txt
+++ b/source/blender/python/generic/CMakeLists.txt
@@ -48,5 +48,8 @@ set(SRC
py_capi_utils.h
)
+if(WITH_INTERNATIONAL)
+ add_definitions(-DINTERNATIONAL)
+endif()
blender_add_lib(bf_python_ext "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index 3cf0b0f1f27..abf5ee7bada 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -31,9 +31,13 @@
#include "blf_py_api.h"
#include "../../blenfont/BLF_api.h"
+#include "../../blenfont/BLF_translation.h"
#include "BLI_utildefines.h"
+#ifdef INTERNATIONAL
+#include "DNA_userdef_types.h" /* is it bad level? */
+#endif
PyDoc_STRVAR(py_blf_position_doc,
@@ -367,6 +371,34 @@ static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
return PyLong_FromLong(BLF_load(filename));
}
+#ifdef INTERNATIONAL
+PyDoc_STRVAR(py_blf_gettext_doc,
+".. function:: gettext(msgid)\n"
+"\n"
+" Get a msg in local language.\n"
+"\n"
+" :arg msgid: the source string.\n"
+" :type msgid: string\n"
+" :return: the localized string.\n"
+" :rtype: string\n"
+);
+static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *value)
+{
+ if ((U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE)) {
+ const char *msgid= _PyUnicode_AsString(value);
+ if(msgid == NULL) {
+ PyErr_SetString(PyExc_TypeError, "blf.gettext expects a single string argument");
+ return NULL;
+ }
+
+ return PyUnicode_FromString(BLF_gettext(msgid));
+ }
+ else {
+ return Py_INCREF(value), value;
+ }
+}
+#endif /* INTERNATIONAL */
+
/*----------------------------MODULE INIT-------------------------*/
static PyMethodDef BLF_methods[] = {
{"aspect", (PyCFunction) py_blf_aspect, METH_VARARGS, py_blf_aspect_doc},
@@ -382,6 +414,9 @@ static PyMethodDef BLF_methods[] = {
{"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc},
{"size", (PyCFunction) py_blf_size, METH_VARARGS, py_blf_size_doc},
{"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc},
+#ifdef INTERNATIONAL
+ {"gettext", (PyCFunction) py_blf_gettext, METH_O, py_blf_gettext_doc},
+#endif
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript
index 80c526f8649..c60752b85f8 100644
--- a/source/blender/windowmanager/SConscript
+++ b/source/blender/windowmanager/SConscript
@@ -39,4 +39,7 @@ if env['OURPLATFORM'] != 'darwin' or env['WITH_GHOST_COCOA']:
if env['BF_BUILDINFO']:
defs.append('WITH_BUILDINFO')
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('INTERNATIONAL')
+
env.BlenderLib ( 'bf_windowmanager', sources, Split(incs), defines=defs, libtype=['core'], priority=[5] )
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 6b3a574b6b6..f862af6173a 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -59,6 +59,8 @@
#include "BLI_utildefines.h"
#include "BLI_callbacks.h"
+#include "BLF_translation.h"
+
#include "DNA_anim_types.h"
#include "DNA_ipo_types.h" // XXX old animation system
#include "DNA_object_types.h"
@@ -429,16 +431,17 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
else if(retval == BKE_READ_EXOTIC_OK_OTHER)
BKE_write_undo(C, "Import file");
else if(retval == BKE_READ_EXOTIC_FAIL_OPEN) {
- BKE_reportf(reports, RPT_ERROR, "Can't read file: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unable to open the file");
+ BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("Can't read file: \"%s\", %s.")), filepath,
+ errno ? strerror(errno) : UI_translate_do_iface(N_("Unable to open the file")));
}
else if(retval == BKE_READ_EXOTIC_FAIL_FORMAT) {
- BKE_reportf(reports, RPT_ERROR, "File format is not supported in file: \"%s\".", filepath);
+ BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("File format is not supported in file: \"%s\".")), filepath);
}
else if(retval == BKE_READ_EXOTIC_FAIL_PATH) {
- BKE_reportf(reports, RPT_ERROR, "File path invalid: \"%s\".", filepath);
+ BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("File path invalid: \"%s\".")), filepath);
}
else {
- BKE_reportf(reports, RPT_ERROR, "Unknown error loading: \"%s\".", filepath);
+ BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("Unknown error loading: \"%s\".")), filepath);
BLI_assert(!"invalid 'retval'");
}
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 837b7eb1f2f..1819fbe00c9 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -99,6 +99,7 @@
#include "UI_interface.h"
#include "BLF_api.h"
+#include "BLF_translation.h"
#include "GPU_buffers.h"
#include "GPU_extensions.h"
@@ -143,6 +144,8 @@ void WM_init(bContext *C, int argc, const char **argv)
/* get the default database, plus a wm */
WM_read_homefile(C, NULL, G.factory_startup);
+ BLF_lang_set(NULL);
+
/* note: there is a bug where python needs initializing before loading the
* startup.blend because it may contain PyDrivers. It also needs to be after
* initializing space types and other internal data.
@@ -379,7 +382,7 @@ void WM_exit_ext(bContext *C, const short do_python)
BIF_freeTemplates(C);
free_ttfont(); /* bke_font.h */
-
+
free_openrecent();
BKE_freecubetable();
@@ -399,6 +402,7 @@ void WM_exit_ext(bContext *C, const short do_python)
free_posebuf();
BLF_exit();
+ BLF_free_unifont();
ANIM_keyingset_infos_exit();
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 5e4505abaa5..320dc2ecdda 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -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"
@@ -78,6 +78,7 @@
#include "BIF_gl.h"
#include "BIF_glutil.h" /* for paint cursor */
+#include "BLF_api.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -150,12 +151,11 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType*))
opfunc(ot);
if(ot->name==NULL) {
- static char dummy_name[] = "Dummy Name";
fprintf(stderr, "ERROR: Operator %s has no name property!\n", ot->idname);
- ot->name= dummy_name;
+ ot->name= UI_translate_do_iface(N_("Dummy Name"));
}
- RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:"(undocumented operator)"); // XXX All ops should have a description but for now allow them not to.
+ RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:UI_translate_do_iface(N_("(undocumented operator)"))); // XXX All ops should have a description but for now allow them not to.
RNA_def_struct_identifier(ot->srna, ot->idname);
BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
@@ -168,7 +168,7 @@ void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType*, void*), void *us
ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
opfunc(ot, userdata);
- RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:"(undocumented operator)");
+ RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:UI_translate_do_iface(N_("(undocumented operator)")));
RNA_def_struct_identifier(ot->srna, ot->idname);
BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
@@ -362,7 +362,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
ot->poll= NULL;
if(!ot->description)
- ot->description= "(undocumented operator)";
+ ot->description= UI_translate_do_iface(N_("(undocumented operator)"));
RNA_def_struct_ui_text(ot->srna, ot->name, ot->description); // XXX All ops should have a description but for now allow them not to.
RNA_def_struct_identifier(ot->srna, ot->idname);
@@ -387,7 +387,7 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType*, void*), vo
ot->poll= NULL;
if(!ot->description)
- ot->description= "(undocumented operator)";
+ ot->description= UI_translate_do_iface(N_("(undocumented operator)"));
opfunc(ot, userdata);
@@ -784,7 +784,7 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, const char *message
else
properties= NULL;
- pup= uiPupMenuBegin(C, "OK?", ICON_QUESTION);
+ pup= uiPupMenuBegin(C, UI_translate_do_iface(N_("OK?")), ICON_QUESTION);
layout= uiPupMenuLayout(pup);
uiItemFullO(layout, op->type->idname, message, ICON_NONE, properties, WM_OP_EXEC_REGION_WIN, 0);
uiPupMenuEnd(C, pup);
@@ -865,10 +865,10 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
void WM_operator_properties_select_all(wmOperatorType *ot) {
static EnumPropertyItem select_all_actions[] = {
- {SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"},
- {SEL_SELECT, "SELECT", 0, "Select", "Select all elements"},
- {SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"},
- {SEL_INVERT, "INVERT", 0, "Invert", "Invert selection of all elements"},
+ {SEL_TOGGLE, "TOGGLE", 0, N_("Toggle"), "Toggle selection for all elements"},
+ {SEL_SELECT, "SELECT", 0, N_("Select"), "Select all elements"},
+ {SEL_DESELECT, "DESELECT", 0, N_("Deselect"), "Deselect all elements"},
+ {SEL_INVERT, "INVERT", 0, N_("Invert"), "Invert selection of all elements"},
{0, NULL, 0, NULL, NULL}
};
@@ -877,25 +877,25 @@ void WM_operator_properties_select_all(wmOperatorType *ot) {
void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend)
{
- RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, N_("Gesture Mode"), "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, N_("X Min"), "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, N_("X Max"), "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, N_("Y Min"), "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, N_("Y Max"), "", INT_MIN, INT_MAX);
if(extend)
- RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
+ RNA_def_boolean(ot->srna, "extend", 1, _("Extend"), _("Extend selection instead of deselecting everything first"));
}
void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
{
- RNA_def_int(ot->srna, "xstart", 0, INT_MIN, INT_MAX, "X Start", "", INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "xend", 0, INT_MIN, INT_MAX, "X End", "", INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, "Y Start", "", INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, "Y End", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "xstart", 0, INT_MIN, INT_MAX, N_("X Start"), "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "xend", 0, INT_MIN, INT_MAX, N_("X End"), "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, N_("Y Start"), "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, N_("Y End"), "", INT_MIN, INT_MAX);
if(cursor)
- RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, "Cursor", "Mouse cursor style to use during the modal operator", 0, INT_MAX);
+ RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, N_("Cursor"), N_("Mouse cursor style to use during the modal operator"), 0, INT_MAX);
}
@@ -924,7 +924,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
wmOperator *op= arg_op;
uiBlock *block;
uiLayout *layout;
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
int width= 300;
@@ -1002,7 +1002,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
wmOperator *op= data->op;
uiBlock *block;
uiLayout *layout;
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
block = uiBeginBlock(C, ar, "operator dialog", UI_EMBOSS);
uiBlockClearFlag(block, UI_BLOCK_LOOP);
@@ -1026,7 +1026,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
col= uiLayoutColumn(layout, FALSE);
col_block= uiLayoutGetBlock(col);
/* Create OK button, the callback of which will execute op */
- btn= uiDefBut(col_block, BUT, 0, "OK", 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ btn= uiDefBut(col_block, BUT, 0, UI_translate_do_iface(N_("OK")), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiButSetFunc(btn, dialog_exec_cb, data, col_block);
}
@@ -1043,7 +1043,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
wmOperator *op= data->op;
uiBlock *block;
uiLayout *layout;
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
block= uiBeginBlock(C, ar, "opui_popup", UI_EMBOSS);
uiBlockClearFlag(block, UI_BLOCK_LOOP);
@@ -1213,7 +1213,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiBlock *block;
uiBut *but;
uiLayout *layout, *split, *col;
- uiStyle *style= U.uistyles.first;
+ uiStyle *style= UI_GetStyle();
struct RecentFile *recent;
int i;
MenuType *mt= WM_menutype_find("USERPREF_MT_splash", TRUE);
@@ -1272,19 +1272,19 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
split = uiLayoutSplit(layout, 0, 0);
col = uiLayoutColumn(split, 0);
uiItemL(col, "Links", ICON_NONE);
- uiItemStringO(col, "Donations", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment");
- uiItemStringO(col, "Credits", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits");
- uiItemStringO(col, "Release Log", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-259");
- uiItemStringO(col, "Manual", ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual");
- uiItemStringO(col, "Blender Website", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org");
- uiItemStringO(col, "User Community", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community");
+ uiItemStringO(col, UI_translate_do_iface(N_("Donations")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment");
+ uiItemStringO(col, UI_translate_do_iface(N_("Credits")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits");
+ uiItemStringO(col, UI_translate_do_iface(N_("Release Log")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-259");
+ uiItemStringO(col, UI_translate_do_iface(N_("Manual")), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual");
+ uiItemStringO(col, UI_translate_do_iface(N_("Blender Website")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org");
+ uiItemStringO(col, UI_translate_do_iface(N_("User Community")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community");
if(strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release")==0) {
BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION/100, BLENDER_VERSION%100);
}
else {
BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d_%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
}
- uiItemStringO(col, "Python API Reference", ICON_URL, "WM_OT_url_open", "url", url);
+ uiItemStringO(col, UI_translate_do_iface(N_("Python API Reference")), ICON_URL, "WM_OT_url_open", "url", url);
uiItemL(col, "", ICON_NONE);
col = uiLayoutColumn(split, 0);
@@ -1294,7 +1294,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiItemS(col);
}
- uiItemL(col, "Recent", ICON_NONE);
+ uiItemL(col, UI_translate_do_iface(N_("Recent")), ICON_NONE);
for(recent = G.recent_files.first, i=0; (i<5) && (recent); recent = recent->next, i++) {
uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
}
@@ -3304,13 +3304,13 @@ static void redraw_timer_window_swap(bContext *C)
}
static EnumPropertyItem redraw_timer_type_items[] = {
- {0, "DRAW", 0, "Draw Region", "Draw Region"},
- {1, "DRAW_SWAP", 0, "Draw Region + Swap", "Draw Region and Swap"},
- {2, "DRAW_WIN", 0, "Draw Window", "Draw Window"},
- {3, "DRAW_WIN_SWAP", 0, "Draw Window + Swap", "Draw Window and Swap"},
- {4, "ANIM_STEP", 0, "Anim Step", "Animation Steps"},
- {5, "ANIM_PLAY", 0, "Anim Play", "Animation Playback"},
- {6, "UNDO", 0, "Undo/Redo", "Undo/Redo"},
+ {0, "DRAW", 0, N_("Draw Region"), N_("Draw Region")},
+ {1, "DRAW_SWAP", 0, N_("Draw Region + Swap"), N_("Draw Region and Swap")},
+ {2, "DRAW_WIN", 0, N_("Draw Window"), N_("Draw Window")},
+ {3, "DRAW_WIN_SWAP", 0, N_("Draw Window + Swap"), N_("Draw Window and Swap")},
+ {4, "ANIM_STEP", 0, N_("Anim Step"), N_("Animation Steps")},
+ {5, "ANIM_PLAY", 0, N_("Anim Play"), N_("Animation Playback")},
+ {6, "UNDO", 0, N_("Undo/Redo"), N_("Undo/Redo")},
{0, NULL, 0, NULL, NULL}};
static int redraw_timer_exec(bContext *C, wmOperator *op)
@@ -3543,14 +3543,14 @@ void wm_operatortype_init(void)
static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
- {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
- {GESTURE_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
- {GESTURE_MODAL_CIRCLE_ADD, "ADD", 0, "Add", ""},
- {GESTURE_MODAL_CIRCLE_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""},
+ {GESTURE_MODAL_CONFIRM, "CONFIRM", 0, N_("Confirm"), ""},
+ {GESTURE_MODAL_CIRCLE_ADD, "ADD", 0, N_("Add"), ""},
+ {GESTURE_MODAL_CIRCLE_SUB, "SUBTRACT", 0, N_("Subtract"), ""},
- {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
- {GESTURE_MODAL_DESELECT,"DESELECT", 0, "DeSelect", ""},
- {GESTURE_MODAL_NOP,"NOP", 0, "No Operation", ""},
+ {GESTURE_MODAL_SELECT, "SELECT", 0, N_("Select"), ""},
+ {GESTURE_MODAL_DESELECT,"DESELECT", 0, N_("DeSelect"), ""},
+ {GESTURE_MODAL_NOP,"NOP", 0, N_("No Operation"), ""},
{0, NULL, 0, NULL, NULL}};
@@ -3596,9 +3596,9 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
- {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
- {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
- {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
+ {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""},
+ {GESTURE_MODAL_SELECT, "SELECT", 0, N_("Select"), ""},
+ {GESTURE_MODAL_BEGIN, "BEGIN", 0, N_("Begin"), ""},
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Straight Line");
@@ -3624,10 +3624,10 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
- {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
- {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
- {GESTURE_MODAL_DESELECT,"DESELECT", 0, "DeSelect", ""},
- {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
+ {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""},
+ {GESTURE_MODAL_SELECT, "SELECT", 0, N_("Select"), ""},
+ {GESTURE_MODAL_DESELECT,"DESELECT", 0, N_("DeSelect"), ""},
+ {GESTURE_MODAL_BEGIN, "BEGIN", 0, N_("Begin"), ""},
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Border");
@@ -3679,10 +3679,10 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
{
static EnumPropertyItem modal_items[] = {
- {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
- {GESTURE_MODAL_IN, "IN", 0, "In", ""},
- {GESTURE_MODAL_OUT, "OUT", 0, "Out", ""},
- {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
+ {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""},
+ {GESTURE_MODAL_IN, "IN", 0, N_("In"), ""},
+ {GESTURE_MODAL_OUT, "OUT", 0, N_("Out"), ""},
+ {GESTURE_MODAL_BEGIN, "BEGIN", 0, N_("Begin"), ""},
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Zoom Border");
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 7d6010786d2..d9ca275c819 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -48,6 +48,8 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_blender.h"
#include "BKE_context.h"
#include "BKE_library.h"
@@ -73,6 +75,8 @@
#include "GPU_draw.h"
#include "GPU_extensions.h"
+#include "UI_interface.h"
+
/* the global to talk to ghost */
static GHOST_SystemHandle g_system= NULL;
@@ -504,11 +508,11 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
ED_screen_set(C, win->screen);
if(sa->spacetype==SPACE_IMAGE)
- GHOST_SetTitle(win->ghostwin, "Blender Render");
+ GHOST_SetTitle(win->ghostwin, UI_translate_do_iface(N_("Blender Render")));
else if(ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
- GHOST_SetTitle(win->ghostwin, "Blender User Preferences");
+ GHOST_SetTitle(win->ghostwin, UI_translate_do_iface(N_("Blender User Preferences")));
else if(sa->spacetype==SPACE_FILE)
- GHOST_SetTitle(win->ghostwin, "Blender File View");
+ GHOST_SetTitle(win->ghostwin, UI_translate_do_iface(N_("Blender File View")));
else
GHOST_SetTitle(win->ghostwin, "Blender");
}