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>2013-03-15 18:32:29 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-03-15 18:32:29 +0400
commit284e59d608a90589956780fe1dd81ecc2ba11362 (patch)
tree040b073ce22a2f2f9a7863ce2c3d15e46f12eceb /source/blender/blenfont
parent87919be4f6f83900b03bb68bcc2b21455f8a00c9 (diff)
Add the possibility to define the translation context for py rna classes (operators, panels and menus).
Thanks to Campell and Brecht for the reviews!
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/BLF_translation.h2
-rw-r--r--source/blender/blenfont/intern/blf_translation.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index 2f40cc3f571..db449995b8f 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -110,12 +110,14 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
* All i18n contexts must be defined here.
* This is a nice way to be sure not to use a context twice for different
* things, and limit the number of existing contexts!
+ * WARNING! Contexts should not be longer than BKE_ST_MAXNAME - 1!
*/
/* 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... :/
+ * The void string "" is also interpreted as BLF_I18NCONTEXT_DEFAULT.
* For perf reason, we only use the first char to detect this context, so other contexts should never start
* with the same char!
*/
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index 2483c59d3ec..4e9408c512a 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -132,7 +132,7 @@ const char *BLF_pgettext(const char *msgctxt, const char *msgid)
if (msgid && msgid[0]) {
/*if (msgctxt && !strcmp(msgctxt, BLF_I18NCONTEXT_DEFAULT_BPY_INTERN)) { */
- if (msgctxt && msgctxt[0] == BLF_I18NCONTEXT_DEFAULT_BPY[0]) {
+ if (msgctxt && (!msgctxt[0] || 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;
}