[gnome-tweak-tool] Use string.format() instead of printf formatting



commit 0eb9551d17c19c48db56fd4b0ab27fd309cb9ab7
Author: Khaled Hosny <khaledhosny eglug org>
Date:   Tue Oct 31 17:25:47 2017 +0200

    Use string.format() instead of printf formatting
    
    This allows translations to drop the placeholder if needed (eg. in the
    first 3 Arabic plural forms).

 gtweak/tweaks/tweak_group_windows.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_windows.py b/gtweak/tweaks/tweak_group_windows.py
index 49516ab..f67748d 100644
--- a/gtweak/tweaks/tweak_group_windows.py
+++ b/gtweak/tweaks/tweak_group_windows.py
@@ -258,12 +258,12 @@ class WindowScalingFactorTweak(Gtk.Box, Tweak):
             return False
 
         self._update_countdown_message()
-        self._dialog.format_secondary_text(self._second_message % self._countdown)
+        self._dialog.format_secondary_text(self._second_message.format(self._countdown))
         return True
 
     def _update_countdown_message(self):
-        self._second_message = gettext.ngettext("Settings will be reverted in %d second",
-                                                "Settings will be reverted in %d seconds",
+        self._second_message = gettext.ngettext("Settings will be reverted in {0} second",
+                                                "Settings will be reverted in {0} seconds",
                                                 self._countdown)
 
     def _close(self):
@@ -287,7 +287,7 @@ class WindowScalingFactorTweak(Gtk.Box, Tweak):
                                text=first_message)
         self._dialog.add_buttons(_("Revert Settings"), Gtk.ResponseType.NO,
                                 _("Keep Changes"), Gtk.ResponseType.YES)
-        self._dialog.format_secondary_text(self._second_message % self._countdown)
+        self._dialog.format_secondary_text(self._second_message.format(self._countdown))
 
         self._source = GLib.timeout_add_seconds(interval=1, function=self._timeout_func)
 


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