diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-01-21 14:52:34 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-01-21 14:52:34 +0400 |
commit | 3aa499f3f7ab750d8f0f647f8976a02967c7b040 (patch) | |
tree | 6137e31f2dc14958f23244ff654b85be7aa7275e /source/blender/blenfont/intern/blf_translation.c | |
parent | 22b5f097d2fbfbd3ce815bfef57d11e08fd67102 (diff) |
I18n fix: "" context is not the same as NULL context!
This bug did not appear earlier because the "" default context was actually never used, always NULL context was passed instead. But bpy.app.translations uses "" as default context in its keys (simplifies the hash/comp functions of internal py messages cache)...
So now, Blender prefers NULL (None in python) as default context value, but understands also "" as such.
Diffstat (limited to 'source/blender/blenfont/intern/blf_translation.c')
-rw-r--r-- | source/blender/blenfont/intern/blf_translation.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c index 6394d1169cf..a77b464822b 100644 --- a/source/blender/blenfont/intern/blf_translation.c +++ b/source/blender/blenfont/intern/blf_translation.c @@ -91,7 +91,14 @@ const char *BLF_pgettext(const char *msgctxt, const char *msgid) { #ifdef WITH_INTERNATIONAL if (msgid && msgid[0]) { - const char *ret = bl_locale_pgettext(msgctxt, 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; + } + ret = bl_locale_pgettext(msgctxt, 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! */ |