[gnome-control-center/benzea/i18n-fixes] printers: Add context to Resolution printing option



commit bec0f5f588e82bb178ee0a2027293d395ec77c8e
Author: Benjamin Berg <bberg redhat com>
Date:   Tue Feb 26 18:50:25 2019 +0100

    printers: Add context to Resolution printing option
    
    For now, this patch only adds the context to the Resolution option to
    disambiguate it from the display panel. This makes the code more complex
    though, and will be changed again to add the context to all options
    (making the strings identical to the ones in GTK+).
    
    Fixes #394 for the printing panel

 panels/printers/pp-options-dialog.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/panels/printers/pp-options-dialog.c b/panels/printers/pp-options-dialog.c
index a6747cfe2..d95e84371 100644
--- a/panels/printers/pp-options-dialog.c
+++ b/panels/printers/pp-options-dialog.c
@@ -76,16 +76,23 @@ enum
 };
 
 /* These lists come from Gtk+ */
+/* TODO: Only "Resolution" currently has a context to disambiguate it from
+ *       the display settings. All of these should have contexts, but it
+ *       was late in the release cycle and this partial solution was
+ *       preferable. See:
+ *       https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/414#note_446778
+ */
 static const struct {
   const char *keyword;
+  const char *translation_context;
   const char *translation;
 } ppd_option_translations[] = {
-  { "Duplex", N_("Two Sided") },
-  { "MediaType", N_("Paper Type") },
-  { "InputSlot", N_("Paper Source") },
-  { "OutputBin", N_("Output Tray") },
-  { "Resolution", N_("Resolution") },
-  { "PreFilter", N_("GhostScript pre-filtering") },
+  { "Duplex", NULL, N_("Two Sided") },
+  { "MediaType", NULL, N_("Paper Type") },
+  { "InputSlot", NULL, N_("Paper Source") },
+  { "OutputBin", NULL, N_("Output Tray") },
+  { "Resolution", "printing option", NC_("printing option", "Resolution") },
+  { "PreFilter", NULL, N_("GhostScript pre-filtering") },
 };
 
 /* keep sorted when changing */
@@ -277,7 +284,12 @@ ppd_option_name_translate (ppd_option_t *option)
   for (i = 0; i < G_N_ELEMENTS (ppd_option_translations); i++)
     {
       if (g_strcmp0 (ppd_option_translations[i].keyword, option->keyword) == 0)
-       return _(ppd_option_translations[i].translation);
+        {
+          if (ppd_option_translations[i].translation_context)
+            return g_dpgettext2(NULL, ppd_option_translations[i].translation_context, 
ppd_option_translations[i].translation);
+          else
+            return _(ppd_option_translations[i].translation);
+        }
     }
 
   return option->text;


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