[gnome-shell] util: Filter out message context of untranslated strings



commit f85d68aa70279738a6c884a15b1329e77a0f8ab5
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Mar 3 15:03:35 2015 +0100

    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 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/shell-util.c b/src/shell-util.c
index e263083..f922f6e 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, "");
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]