[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51301] trunk/blender: Add translation of reports messages (only direct uses of BKE_report(f)/ BKE_reports_append(f) funcs for now).
Bastien Montagne
montagne29 at wanadoo.fr
Sat Oct 13 15:55:14 CEST 2012
Revision: 51301
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51301
Author: mont29
Date: 2012-10-13 13:55:14 +0000 (Sat, 13 Oct 2012)
Log Message:
-----------
Add translation of reports messages (only direct uses of BKE_report(f)/BKE_reports_append(f) funcs for now). Already adds quite a bunch of new msgids!
Modified Paths:
--------------
trunk/blender/release/scripts/modules/bl_i18n_utils/settings.py
trunk/blender/source/blender/blenkernel/intern/report.c
Modified: trunk/blender/release/scripts/modules/bl_i18n_utils/settings.py
===================================================================
--- trunk/blender/release/scripts/modules/bl_i18n_utils/settings.py 2012-10-13 13:40:05 UTC (rev 51300)
+++ trunk/blender/release/scripts/modules/bl_i18n_utils/settings.py 2012-10-13 13:55:14 UTC (rev 51301)
@@ -98,7 +98,9 @@
tuple((r"{}\(\s*" + _msg_re + r"\s*\)").format(it)
for it in ("IFACE_", "TIP_", "N_")) +
tuple((r"{}\(\s*" + _ctxt_re + r"\s*,\s*" + _msg_re + r"\s*\)").format(it)
- for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_N_"))
+ for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_N_")) +
+ tuple(("{}\\([^\"',]+,(?:[^\"',]+,)?\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
+ for it in ("BKE_report", "BKE_reportf", "BKE_reports_prepend", "BKE_reports_prependf"))
)
ESCAPE_RE = (
Modified: trunk/blender/source/blender/blenkernel/intern/report.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/report.c 2012-10-13 13:40:05 UTC (rev 51300)
+++ trunk/blender/source/blender/blenkernel/intern/report.c 2012-10-13 13:55:14 UTC (rev 51301)
@@ -34,6 +34,8 @@
#include "BLI_dynstr.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_report.h"
#include "BKE_global.h" /* G.background only */
@@ -87,10 +89,11 @@
reports->list.first = reports->list.last = NULL;
}
-void BKE_report(ReportList *reports, ReportType type, const char *message)
+void BKE_report(ReportList *reports, ReportType type, const char *_message)
{
Report *report;
int len;
+ const char *message = TIP_(_message);
/* in background mode always print otherwise there are cases the errors wont be displayed,
* but still add to the report list since this is used for python exception handling */
@@ -114,14 +117,15 @@
}
}
-void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
+void BKE_reportf(ReportList *reports, ReportType type, const char *_format, ...)
{
DynStr *ds;
Report *report;
va_list args;
+ const char *format = TIP_(_format);
if (G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) {
- va_start(args, format);
+ va_start(args, _format);
vprintf(format, args);
va_end(args);
fprintf(stdout, "\n"); /* otherise each report needs to include a \n */
@@ -132,7 +136,7 @@
report = MEM_callocN(sizeof(Report), "Report");
ds = BLI_dynstr_new();
- va_start(args, format);
+ va_start(args, _format);
BLI_dynstr_vappendf(ds, format, args);
va_end(args);
@@ -147,10 +151,11 @@
}
}
-void BKE_reports_prepend(ReportList *reports, const char *prepend)
+void BKE_reports_prepend(ReportList *reports, const char *_prepend)
{
Report *report;
DynStr *ds;
+ const char *prepend = TIP_(_prepend);
if (!reports)
return;
@@ -169,18 +174,19 @@
}
}
-void BKE_reports_prependf(ReportList *reports, const char *prepend, ...)
+void BKE_reports_prependf(ReportList *reports, const char *_prepend, ...)
{
Report *report;
DynStr *ds;
va_list args;
+ const char *prepend = TIP_(_prepend);
if (!reports)
return;
for (report = reports->list.first; report; report = report->next) {
ds = BLI_dynstr_new();
- va_start(args, prepend);
+ va_start(args, _prepend);
BLI_dynstr_vappendf(ds, prepend, args);
va_end(args);
More information about the Bf-blender-cvs
mailing list