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:
authorBastien Montagne <montagne29@wanadoo.fr>2013-02-09 22:17:20 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-02-09 22:17:20 +0400
commit1083a069004490b0ed8679679adb2a7ea881ba62 (patch)
tree57635b0c360f24b378898751c5259df1cb3b7160 /source/blender/makesrna/intern/rna_ui_api.c
parentd1136ba2efab8c4a1475b1778eb7b2bd9c8c8658 (diff)
Translation of 'text' parameter of UI functions: disables context search in RNA property (see comment in code for details).
Also made some minor optimization.
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 4070e6c0a9f..2043832a3f8 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -63,25 +63,36 @@ EnumPropertyItem icon_items[] = {
static const char *rna_translate_ui_text(const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop,
int translate)
{
- if (!text || !text[0] || !translate) {
+ /* Also return text if UI labels translation is disabled. */
+ if (!text || !text[0] || !translate || !BLF_translate_iface()) {
return text;
}
/* If a text_ctxt is specified, use it! */
if (text_ctxt && text_ctxt[0]) {
- return CTX_IFACE_(text_ctxt, text);
+ return BLF_pgettext(text_ctxt, text);
}
/* Else, if an RNA type or property is specified, use its context. */
+#if 0
+ /* XXX Disabled for now. Unfortunately, their is absolutely no way from py code to get the RNA struct corresponding
+ * to the 'data' (in functions like prop() & co), as this is pure runtime data. Hence, messages extraction
+ * script can't determine the correct context it should use for such 'text' messages...
+ * So for now, one have to explicitly specify the 'text_ctxt' when using prop() etc. functions,
+ * if default context is not suitable.
+ */
if (prop) {
- return CTX_IFACE_(RNA_property_translation_context(prop), text);
+ return BLF_pgettext(RNA_property_translation_context(prop), text);
}
+#else
+ (void)prop;
+#endif
if (type) {
- return CTX_IFACE_(RNA_struct_translation_context(type), text);
+ return BLF_pgettext(RNA_struct_translation_context(type), text);
}
- /* Else, no context! */
- return IFACE_(text);
+ /* Else, default context! */
+ return BLF_pgettext(BLF_I18NCONTEXT_DEFAULT, text);
}
static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt,