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:
Diffstat (limited to 'source/blender/blenfont/intern/blf_translation.c')
-rw-r--r--source/blender/blenfont/intern/blf_translation.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index 2a4a152f0eb..5d828d9b7be 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -46,7 +46,9 @@
#include "DNA_userdef_types.h" /* For user settings. */
+#ifdef WITH_PYTHON
#include "BPY_extern.h"
+#endif
#ifdef WITH_INTERNATIONAL
@@ -152,9 +154,11 @@ const char *BLF_pgettext(const char *msgctxt, const char *msgid)
/* We assume if the returned string is the same (memory level) as the msgid, no translation was found,
* and we can try py scripts' ones!
*/
+#ifdef WITH_PYTHON
if (ret == msgid) {
ret = BPY_app_translations_py_pgettext(msgctxt, msgid);
}
+#endif
}
return ret;
@@ -164,6 +168,15 @@ const char *BLF_pgettext(const char *msgctxt, const char *msgid)
#endif
}
+bool BLF_translate(void)
+{
+#ifdef WITH_INTERNATIONAL
+ return (U.transopts & USER_DOTRANSLATE) != 0;
+#else
+ return false;
+#endif
+}
+
bool BLF_translate_iface(void)
{
#ifdef WITH_INTERNATIONAL
@@ -191,6 +204,21 @@ bool BLF_translate_new_dataname(void)
#endif
}
+const char *BLF_translate_do(const char *msgctxt, const char *msgid)
+{
+#ifdef WITH_INTERNATIONAL
+ if (BLF_translate()) {
+ return BLF_pgettext(msgctxt, msgid);
+ }
+ else {
+ return msgid;
+ }
+#else
+ (void)msgctxt;
+ return msgid;
+#endif
+}
+
const char *BLF_translate_do_iface(const char *msgctxt, const char *msgid)
{
#ifdef WITH_INTERNATIONAL