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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesrna/RNA_types.h1
-rw-r--r--source/blender/makesrna/intern/makesrna.c1
-rw-r--r--source/blender/makesrna/intern/rna_define.c14
-rw-r--r--source/blender/makesrna/intern/rna_rna.c1
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c6
-rw-r--r--source/blender/python/intern/CMakeLists.txt4
-rw-r--r--source/blender/python/intern/bpy_props.c1
-rw-r--r--source/blender/python/intern/bpy_rna.c10
8 files changed, 35 insertions, 3 deletions
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 4a18518dde9..8e8a2133b89 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -110,6 +110,7 @@ typedef enum PropertySubType {
PROP_FILEPATH = 1,
PROP_DIRPATH = 2,
PROP_FILENAME = 3,
+ PROP_TRANSLATE = 4, /* a string which should be translated */
/* numbers */
PROP_UNSIGNED = 13,
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 23100fa8bd7..80352d3f03e 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -1815,6 +1815,7 @@ static const char *rna_property_subtypename(PropertySubType type)
case PROP_FILEPATH: return "PROP_FILEPATH";
case PROP_FILENAME: return "PROP_FILENAME";
case PROP_DIRPATH: return "PROP_DIRPATH";
+ case PROP_TRANSLATE: return "PROP_TRANSLATE";
case PROP_UNSIGNED: return "PROP_UNSIGNED";
case PROP_PERCENTAGE: return "PROP_PERCENTAGE";
case PROP_FACTOR: return "PROP_FACTOR";
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 758ddc9ac6a..8af65b97ffc 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -2240,6 +2240,20 @@ PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *id
return prop;
}
+PropertyRNA *RNA_def_string_translate(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen,
+ const char *ui_name, const char *ui_description)
+{
+ ContainerRNA *cont= cont_;
+ PropertyRNA *prop;
+
+ prop= RNA_def_property(cont, identifier, PROP_STRING, PROP_TRANSLATE);
+ if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
+ if(default_value) RNA_def_property_string_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+
+ return prop;
+}
+
PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value,
const char *ui_name, const char *ui_description)
{
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 7f85a2fa1d7..95c6b066510 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -53,6 +53,7 @@ EnumPropertyItem property_subtype_items[] = {
{PROP_FILEPATH, "FILEPATH", 0, "File Path", ""},
{PROP_DIRPATH, "DIRPATH", 0, "Directory Path", ""},
{PROP_FILENAME, "FILENAME", 0, "File Name", ""},
+ {PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
/* numbers */
{PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""},
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 84568d914af..816a7ba9cd4 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -84,7 +84,7 @@ static void api_ui_item_common(FunctionRNA *func)
{
PropertyRNA *prop;
- RNA_def_string(func, "text", "", 0, "", "Override automatic text of the item");
+ prop= RNA_def_string_translate(func, "text", "", 0, "", "Override automatic text of the item");
prop= RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, icon_items);
@@ -309,7 +309,7 @@ void RNA_api_ui_layout(StructRNA *srna)
parm= RNA_def_string(func, "type_property", "", 0, "",
"Identifier of property in data giving the type of the ID-blocks to use");
RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_string(func, "text", "", 0, "", "Custom label to display in UI");
+ RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");
func= RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder");
parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
@@ -318,7 +318,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
- RNA_def_string(func, "text", "", 0, "", "Custom label to display in UI");
+ RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");
func= RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index acdee5328e7..e628ea10e9c 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -95,4 +95,8 @@ if(WITH_AUDASPACE)
add_definitions(-DWITH_AUDASPACE)
endif()
+if(WITH_INTERNATIONAL)
+ add_definitions(-DINTERNATIONAL)
+endif()
+
blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 5da142aeea7..a3d5bc99ad8 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -72,6 +72,7 @@ static EnumPropertyItem property_subtype_string_items[]= {
{PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""},
{PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""},
{PROP_FILENAME, "FILENAME", 0, "Filename", ""},
+ {PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
{PROP_NONE, "NONE", 0, "None", ""},
{0, NULL, 0, NULL, NULL}};
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index a63cee4e505..013eac7fd58 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -73,6 +73,10 @@
#include "../generic/IDProp.h" /* for IDprop lookups */
#include "../generic/py_capi_utils.h"
+#ifdef INTERNATIONAL
+#include "UI_interface.h" /* bad level call into editors */
+#endif
+
#define USE_PEDANTIC_WRITE
#define USE_MATHUTILS
#define USE_STRING_COERCE
@@ -1519,6 +1523,12 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
else {
param= _PyUnicode_AsString(value);
+#ifdef INTERNATIONAL
+ if(subtype == PROP_TRANSLATE) {
+ param= UI_translate_do_iface(param);
+ }
+#endif // INTERNATIONAL
+
}
#else // USE_STRING_COERCE
param= _PyUnicode_AsString(value);