diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-16 22:38:03 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-16 22:38:03 +0400 |
commit | 92436c94d3adbbfc285bd7b3041db36e66dae5d5 (patch) | |
tree | 2083c8ad4fa810a781e9631161aa88b12008453d /source/blender/blenfont | |
parent | 90ed5ea4ea278b4aadf9187e4e2b92ef3221001b (diff) | |
parent | fda8927d01ba719963154a56b45952ee541a869d (diff) |
Merged changes in the trunk up to revision 54594.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r-- | source/blender/blenfont/BLF_translation.h | 11 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_translation.c | 6 |
2 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h index 5b2c4e87165..8a99f486783 100644 --- a/source/blender/blenfont/BLF_translation.h +++ b/source/blender/blenfont/BLF_translation.h @@ -112,9 +112,13 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid); /* Default, void context. * WARNING! The "" context is not the same as no (NULL) context at mo/boost::locale level! + * NOTE: We translate BLF_I18NCONTEXT_DEFAULT as BLF_I18NCONTEXT_DEFAULT_BPY in Python, as we can’t use "natural" + * None value in rna string properties... :/ + * For perf reason, we only use the first char to detect this context, so other contexts should never start + * with the same char! */ -#define BLF_I18NCONTEXT_DEFAULT NULL /* Translated as None in Python. */ -#define BLF_I18NCONTEXT_DEFAULT_BPY_INTERN "" /* Only used in code, never exposed to user! */ +#define BLF_I18NCONTEXT_DEFAULT NULL +#define BLF_I18NCONTEXT_DEFAULT_BPY "*" /* Default context for operator names/labels. */ #define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator" @@ -168,7 +172,8 @@ typedef struct #define BLF_I18NCONTEXTS_ITEM(ctxt_id, py_id) {#ctxt_id, py_id, ctxt_id} #define BLF_I18NCONTEXTS_DESC { \ - BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT, "default"), \ + BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT, "default_real"), \ + BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT_BPY, "default"), \ BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "operator_default"), \ BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ACTION, "id_action"), \ BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ARMATURE, "id_armature"), \ diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c index a77b464822b..b5b72b68677 100644 --- a/source/blender/blenfont/intern/blf_translation.c +++ b/source/blender/blenfont/intern/blf_translation.c @@ -94,9 +94,9 @@ const char *BLF_pgettext(const char *msgctxt, const char *msgid) const char *ret; /*if (msgctxt && !strcmp(msgctxt, BLF_I18NCONTEXT_DEFAULT_BPY_INTERN)) { */ - if (msgctxt && !msgctxt[0]) { - /* BLF_I18NCONTEXT_DEFAULT_BPY_INTERN context is reserved and considered the same as default NULL one. */ - msgctxt = NULL; + if (msgctxt && msgctxt[0] == BLF_I18NCONTEXT_DEFAULT_BPY[0]) { + /* BLF_I18NCONTEXT_DEFAULT_BPY context is reserved and considered the same as default NULL one. */ + msgctxt = BLF_I18NCONTEXT_DEFAULT; } ret = bl_locale_pgettext(msgctxt, msgid); /* We assume if the returned string is the same (memory level) as the msgid, no translation was found, |