gnucash maint: [core-utils.i] Use g_dpgettext2 instead of g_dpgettext
Christopher Lam
clam at code.gnucash.org
Fri Apr 1 22:24:48 EDT 2022
Updated via https://github.com/Gnucash/gnucash/commit/11458bf8 (commit)
from https://github.com/Gnucash/gnucash/commit/842c4879 (commit)
commit 11458bf8b37f874fa5929d269814e9cb6da570f6
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Apr 2 09:08:19 2022 +0800
[core-utils.i] Use g_dpgettext2 instead of g_dpgettext
avoids using \004 context and msg separator.
Discussed in dae2ea8356931a34e198c83c7dac6858fee61248
diff --git a/bindings/core-utils.i b/bindings/core-utils.i
index f8c9edb3c..6cef88a98 100644
--- a/bindings/core-utils.i
+++ b/bindings/core-utils.i
@@ -171,16 +171,11 @@ extern const char* ngettext (const char *msgid1, const char *msgid2,
extern const char* gettext(const char*);
%rename ("gnc:C_gettext") wrap_C_;
%inline %{
- /* This helper function wraps the C_() macro in to a function.
- Direct wrapping results in a compiler error on direct string concatenation
- inside the macro expansion, so I'm making a detour via g_strconcat */
+ /* This helper function wraps the C_() macro in a function. */
const char* wrap_C_(const char* context, const char* msg);
const char* wrap_C_(const char* context, const char* msg)
{
- gchar* combo = g_strconcat (context, "\004", msg, NULL);
- const gchar* translated = g_dpgettext (NULL, combo, strlen (context) + 1);
- g_free (combo);
- return translated;
+ return g_dpgettext2 (NULL, context, msg);
}
%}
%rename ("gnc-utf8?") wrap_gnc_utf8_validate;
Summary of changes:
bindings/core-utils.i | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
More information about the gnucash-changes
mailing list