static const char *rna_translate_ui_text(const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, int translate) { /* Also return text if UI labels translation is disabled. */ if (!text || !text[0] || !translate || !BLT_translate_iface()) { return text; } /* If a text_ctxt is specified, use it! */ if (text_ctxt && text_ctxt[0]) { return BLT_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 BLT_pgettext(RNA_property_translation_context(prop), text); } #else (void)prop; #endif if (type) { return BLT_pgettext(RNA_struct_translation_context(type), text); } /* Else, default context! */ return BLT_pgettext(BLT_I18NCONTEXT_DEFAULT, text); }
const char *BLT_translate_do_new_dataname(const char *msgctxt, const char *msgid) { #ifdef WITH_INTERNATIONAL if (BLT_translate_new_dataname()) { return BLT_pgettext(msgctxt, msgid); } else { return msgid; } #else (void)msgctxt; return msgid; #endif }