From f85d68aa70279738a6c884a15b1329e77a0f8ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 3 Mar 2015 15:03:35 +0100 Subject: [PATCH] util: Filter out message context of untranslated strings Commit 5a47ad837b changed the definition of NC_() to include the message context, so that gettext can correctly disambiguate strings like "S". However this does only work when gettext actually returns a translation from the catalogue; if the string is not found, we need to strip the context again to not have it show up in the UI. https://bugzilla.gnome.org/show_bug.cgi?id=745521 --- src/shell-util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shell-util.c b/src/shell-util.c index e263083ed..f922f6eb5 100644 --- a/src/shell-util.c +++ b/src/shell-util.c @@ -223,11 +223,13 @@ shell_util_translate_time_string (const char *str) { const char *locale = g_getenv ("LC_TIME"); const char *res; + char *sep; if (locale) setlocale (LC_MESSAGES, locale); - res = gettext (str); + sep = strchr (str, '\004'); + res = g_dpgettext (NULL, str, sep ? str - sep : 0); setlocale (LC_MESSAGES, "");