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>2016-05-24 17:48:10 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-05-24 17:48:10 +0300
commitfaec4309147988fbab7b7d7ec661f5130358d169 (patch)
tree0c839f8f88fe80f4a3762980adb5efe729ce1b44 /source/blender/blentranslation
parentf85745b17bfe68673bf5f799e98c617d9471ddf1 (diff)
parente1dd83b399d46d81ea51f6c41725eec5c1a1db7a (diff)
Merge branch 'master' into blender2.8
Conflicts: intern/cycles/blender/blender_curves.cpp source/blender/blenkernel/intern/dynamicpaint.c source/blender/blenkernel/intern/particle.c source/blender/blenloader/intern/versioning_270.c source/blender/editors/physics/particle_edit.c source/blender/editors/transform/transform_snap_object.c source/blender/editors/util/undo.c source/blender/makesrna/intern/rna_object_force.c
Diffstat (limited to 'source/blender/blentranslation')
-rw-r--r--source/blender/blentranslation/BLT_translation.h1
-rw-r--r--source/blender/blentranslation/CMakeLists.txt6
-rw-r--r--source/blender/blentranslation/intern/blt_lang.c34
3 files changed, 41 insertions, 0 deletions
diff --git a/source/blender/blentranslation/BLT_translation.h b/source/blender/blentranslation/BLT_translation.h
index a2d1b6a82e8..e7538ec5324 100644
--- a/source/blender/blentranslation/BLT_translation.h
+++ b/source/blender/blentranslation/BLT_translation.h
@@ -54,6 +54,7 @@ const char *BLT_translate_do_iface(const char *msgctxt, const char *msgid);
const char *BLT_translate_do_tooltip(const char *msgctxt, const char *msgid);
const char *BLT_translate_do_new_dataname(const char *msgctxt, const char *msgid);
+bool BLT_lang_is_ime_supported(void);
/* The "translation-marker" macro. */
#define N_(msgid) msgid
diff --git a/source/blender/blentranslation/CMakeLists.txt b/source/blender/blentranslation/CMakeLists.txt
index 59bd7f0adfa..a3e85344027 100644
--- a/source/blender/blentranslation/CMakeLists.txt
+++ b/source/blender/blentranslation/CMakeLists.txt
@@ -53,4 +53,10 @@ if(WITH_PYTHON)
)
endif()
+if(WIN32)
+ if(WITH_INPUT_IME)
+ add_definitions(-DWITH_INPUT_IME)
+ endif()
+endif()
+
blender_add_lib(bf_blentranslation "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/blentranslation/intern/blt_lang.c b/source/blender/blentranslation/intern/blt_lang.c
index 1ad62fa5869..74c2b4b7472 100644
--- a/source/blender/blentranslation/intern/blt_lang.c
+++ b/source/blender/blentranslation/intern/blt_lang.c
@@ -54,6 +54,10 @@
#include "MEM_guardedalloc.h"
+/* Cached IME support flags */
+static bool ime_is_lang_supported = false;
+static void blt_lang_check_ime_supported(void);
+
#ifdef WITH_INTERNATIONAL
#include "boost_locale_wrapper.h"
@@ -280,6 +284,7 @@ void BLT_lang_set(const char *str)
#else
(void)str;
#endif
+ blt_lang_check_ime_supported();
}
/* Get the current locale (short code, e.g. es_ES). */
@@ -355,3 +360,32 @@ void BLT_lang_locale_explode(
MEM_freeN(_t);
}
}
+
+/* Test if the translation context allows IME input - used to
+ * avoid weird character drawing if IME inputs non-ascii chars.
+ */
+static void blt_lang_check_ime_supported(void)
+{
+#ifdef WITH_INPUT_IME
+ const char *uilng = BLT_lang_get();
+ if (U.transopts & USER_DOTRANSLATE) {
+ ime_is_lang_supported = STREQ(uilng, "zh_CN") ||
+ STREQ(uilng, "zh_TW") ||
+ STREQ(uilng, "ja_JP");
+ }
+ else {
+ ime_is_lang_supported = false;
+ }
+#else
+ ime_is_lang_supported = false;
+#endif
+}
+
+bool BLT_lang_is_ime_supported(void)
+{
+#ifdef WITH_INPUT_IME
+ return ime_is_lang_supported;
+#else
+ return false;
+#endif
+}