[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54413] trunk/blender/source/blender/ makesrna/intern/rna_ui_api.c: Translation of 'text' parameter of UI functions: disables context search in RNA property ( see comment in code for details).
Bastien Montagne
montagne29 at wanadoo.fr
Sat Feb 9 19:17:20 CET 2013
Revision: 54413
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54413
Author: mont29
Date: 2013-02-09 18:17:20 +0000 (Sat, 09 Feb 2013)
Log Message:
-----------
Translation of 'text' parameter of UI functions: disables context search in RNA property (see comment in code for details).
Also made some minor optimization.
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_ui_api.c
Modified: trunk/blender/source/blender/makesrna/intern/rna_ui_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_ui_api.c 2013-02-09 16:54:10 UTC (rev 54412)
+++ trunk/blender/source/blender/makesrna/intern/rna_ui_api.c 2013-02-09 18:17:20 UTC (rev 54413)
@@ -63,25 +63,36 @@
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,
More information about the Bf-blender-cvs
mailing list