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>2012-03-16 19:39:25 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-03-16 19:39:25 +0400
commit2caa507b7eaa7d55a0be7bda513f08ecfe4791f1 (patch)
tree86e65a98805030b6191643571c2eea1962da9ea7 /source/blender/makesrna/intern/rna_access.c
parent4e6669cee38ed81dc2e9be52f2900885295506f3 (diff)
i18n stuff: adds translation_context to RNA structs (used for there ui name), and a first default "Operator" one for all operators' label.
The fact is, operators' label are nearly always verbs, while properties labels are nearly always nouns. So this should already solve many translations' problems regarding noun/verb confusion. This commit also simplifies a bit i18n usage: *Now IFACE_ and TIP_ macros (or there context versions, CTX_IFACE_/TIP_) are used nearly everywhere (with one exception, where code is a bit complex and needs to manually test whether ui/tip translations is allowed, so no need to redo it later through those macros). *Also, those macros are now defined to NOP in case WITH_INTERNATIONAL is false, which avoid testing that define everywhere in code!
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 543824eb5d5..76d33ea9b9a 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -474,12 +474,7 @@ static const char *rna_ensure_property_description(PropertyRNA *prop)
description = ((IDProperty*)prop)->name; /* XXX - not correct */
}
-#ifdef WITH_INTERNATIONAL
- if (description && BLF_translate_tooltips())
- description = BLF_gettext(description);
-#endif
-
- return description;
+ return TIP_(description);
}
static const char *rna_ensure_property_name(PropertyRNA *prop)
@@ -491,16 +486,7 @@ static const char *rna_ensure_property_name(PropertyRNA *prop)
else
name = ((IDProperty*)prop)->name;
-#ifdef WITH_INTERNATIONAL
- if (BLF_translate_iface()) {
- if (prop->translation_context)
- name = BLF_pgettext(prop->translation_context, name);
- else
- name = BLF_gettext(name);
- }
-#endif
-
- return name;
+ return CTX_IFACE_(prop->translation_context, name);
}
/* Structs */
@@ -523,7 +509,7 @@ const char *RNA_struct_identifier(StructRNA *type)
const char *RNA_struct_ui_name(StructRNA *type)
{
- return type->name;
+ return CTX_IFACE_(type->translation_context, type->name);
}
int RNA_struct_ui_icon(StructRNA *type)
@@ -536,7 +522,7 @@ int RNA_struct_ui_icon(StructRNA *type)
const char *RNA_struct_ui_description(StructRNA *type)
{
- return type->description;
+ return TIP_(type->description);
}
PropertyRNA *RNA_struct_name_property(StructRNA *type)
@@ -1182,6 +1168,7 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA
RNA_property_enum_items(C, ptr, prop, item, totitem, free);
#ifdef WITH_INTERNATIONAL
+ /* Note: keep directly using BLF_gettext here, has we have already done tests like BLF_translate_iface... */
if (BLF_translate_iface()) {
int i;
EnumPropertyItem *nitem;