From 11458bf8b37f874fa5929d269814e9cb6da570f6 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sat, 2 Apr 2022 09:08:19 +0800 Subject: [PATCH] [core-utils.i] Use g_dpgettext2 instead of g_dpgettext avoids using \004 context and msg separator. Discussed in dae2ea8356931a34e198c83c7dac6858fee61248 --- bindings/core-utils.i | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bindings/core-utils.i b/bindings/core-utils.i index f8c9edb3c5..6cef88a988 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;