diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-03-19 23:37:22 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-03-19 23:37:22 +0400 |
commit | d39c6fdf2d7efbb3560038184f43f6bf882c5049 (patch) | |
tree | 2850fde8813f530a89094b675976ca94415b4166 /source/blender/makesrna/intern/rna_access.c | |
parent | 5c48eb3bb9c42ba06f40d7b6d1c83b76d90d6a67 (diff) |
Various cleanup around default i18n context.
Issue is that the real default context is NULL, however, in python and RNA, this value can't be used easily. So we use a specific string instead ("*"), defined as BLF_I18NCONTEXT_DEFAULT_BPYRNA.
From now on, all bpy/rna code should only use the BLF_I18NCONTEXT_DEFAULT_BPYRNA value, while all "usual" C code should use the BLF_I18NCONTEXT_DEFAULT value (BLF_pgettext is still able to "understand" both, anyway).
Also added BLF_is_default_context helper func, so that we can keep that check in a single place!
Finally, we should no need anymore to understand the void string "" as default context too - two values for a same thing are more than enough!
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 92ce8122597..b9ee9b6ad1c 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -554,7 +554,7 @@ const char *RNA_struct_ui_description_raw(StructRNA *type) const char *RNA_struct_translation_context(StructRNA *type) { - return type->translation_context ? type->translation_context : BLF_I18NCONTEXT_DEFAULT; + return type->translation_context; } PropertyRNA *RNA_struct_name_property(StructRNA *type) @@ -1283,7 +1283,6 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA for (i = 0; nitem[i].identifier; i++) { if (nitem[i].name && do_iface) { - /* note: prop->translation_context may be NULL, this just means we use the default "" context */ nitem[i].name = BLF_pgettext(prop->translation_context, nitem[i].name); } if (nitem[i].description && do_tooltip) { @@ -1446,7 +1445,7 @@ const char *RNA_property_ui_description_raw(PropertyRNA *prop) const char *RNA_property_translation_context(PropertyRNA *_prop) { PropertyRNA *prop = rna_ensure_property(_prop); - return prop->translation_context ? prop->translation_context : BLF_I18NCONTEXT_DEFAULT; + return prop->translation_context; } int RNA_property_ui_icon(PropertyRNA *prop) |