[pitivi] Fix translations not being used



commit 7c9ea96974074cf607a9eded0b1087e48d937af3
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Wed Dec 28 02:19:40 2016 +0100

    Fix translations not being used
    
    Reviewed-by: Thibault Saunier <tsaunier gnome org>
    Differential Revision: https://phabricator.freedesktop.org/D1585

 pitivi/check.py                  |    6 ++--
 pitivi/dialogs/clipmediaprops.py |    2 +-
 pitivi/dialogs/startupwizard.py  |    2 +-
 pitivi/mainwindow.py             |   39 ++++++++++++++++++++-----------------
 pitivi/project.py                |    4 +-
 pitivi/render.py                 |    6 ++--
 pitivi/timeline/ruler.py         |    2 +-
 7 files changed, 32 insertions(+), 29 deletions(-)
---
diff --git a/pitivi/check.py b/pitivi/check.py
index 76eaa5d..e05fde4 100644
--- a/pitivi/check.py
+++ b/pitivi/check.py
@@ -106,11 +106,11 @@ class Dependency(object):
 
         if not self.component:
             # Translators: %s is a Python module name or another os component
-            message = _("- %s not found on the system" % self.modulename)
+            message = _("- %s not found on the system") % self.modulename
         else:
             # Translators: %s is a Python module name or another os component
-            message = _("- %s version %s is installed but Pitivi requires at least version %s" % (
-                self.modulename, self.version_installed, self.version_required_string))
+            message = _("- %s version %s is installed but Pitivi requires at least version %s") % (
+                self.modulename, self.version_installed, self.version_required_string)
 
         if self.additional_message is not None:
             message += "\n    -> " + self.additional_message
diff --git a/pitivi/dialogs/clipmediaprops.py b/pitivi/dialogs/clipmediaprops.py
index b2a4cbd..75444ab 100644
--- a/pitivi/dialogs/clipmediaprops.py
+++ b/pitivi/dialogs/clipmediaprops.py
@@ -109,7 +109,7 @@ class ClipMediaPropsDialog(object):
                 else:
                     foo = str(framerate_num) + "/" + str(framerate_denom)
                     # Translators: a label showing an invalid framerate value
-                    self.frame_rate.set_text(_("invalid (%s fps)" % foo))
+                    self.frame_rate.set_text(_("invalid (%s fps)") % foo)
                     self.framerate_checkbutton.set_active(False)
                     # For consistency, insensitize the checkbox AND value
                     # labels
diff --git a/pitivi/dialogs/startupwizard.py b/pitivi/dialogs/startupwizard.py
index 77440da..74679d2 100644
--- a/pitivi/dialogs/startupwizard.py
+++ b/pitivi/dialogs/startupwizard.py
@@ -160,7 +160,7 @@ class StartUpWizard(object):
 
         # increment counter, create infobar and show info
         self.app.settings.displayCounter = self.app.settings.displayCounter + 1
-        text = _("Pitivi %s is available." % latest_version)
+        text = _("Pitivi %s is available.") % latest_version
         label = Gtk.Label(label=text)
         self.infobar.get_content_area().add(label)
         self.infobar.set_message_type(Gtk.MessageType.INFO)
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 72048e7..8f4b3cf 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -604,15 +604,15 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
         abt.set_website(APPURL)
 
         if in_devel():
-            version_str = _("Development version: %s" % GITVERSION)
+            version_str = _("Development version: %s") % GITVERSION
         elif not self.app.isLatest():
-            version_str = _("Version %(cur_ver)s — %(new_ver)s is available" %
-                            {"cur_ver": GITVERSION,
-                             "new_ver": self.app.getLatest()})
+            version_str = _("Version %(cur_ver)s — %(new_ver)s is available") % \
+                {"cur_ver": GITVERSION,
+                 "new_ver": self.app.getLatest()}
         elif GITVERSION:
-            version_str = _("Version %s" % GITVERSION)
+            version_str = _("Version %s") % GITVERSION
         else:
-            version_str = _("Version %s" % VERSION)
+            version_str = _("Version %s") % VERSION
         abt.set_version(version_str)
 
         comments = ["",
@@ -646,6 +646,9 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
                      "Or you can run: git shortlog -s -n")
                    % "http://ohloh.net/p/pitivi/contributors";, ]
         abt.set_authors(authors)
+        # Translators: See
+        # https://developer.gnome.org/gtk3/stable/GtkAboutDialog.html#gtk-about-dialog-set-translator-credits
+        # for details on how this is used.
         translators = _("translator-credits")
         if translators != "translator-credits":
             abt.set_translator_credits(translators)
@@ -812,12 +815,12 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
             last_saved = max(
                 os.path.getmtime(path), project_manager.time_loaded)
             time_delta = time() - last_saved
-            secondary.props.label = _("If you don't save, "
-                                      "the changes from the last %s will be lost."
-                                      % beautify_time_delta(time_delta))
+            message = _("If you don't save, "
+                        "the changes from the last %s will be lost.") % \
+                beautify_time_delta(time_delta)
         else:
-            secondary.props.label = _("If you don't save, "
-                                      "your changes will be lost.")
+            message = _("If you don't save, your changes will be lost.")
+        secondary.props.label = message
 
         # put the text in a vbox
         vbox = Gtk.Box(homogeneous=False, spacing=SPACING * 2)
@@ -952,13 +955,13 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
         if asset.get_duration() == Gst.CLOCK_TIME_NONE:
             # The file is probably an image, not video or audio.
             text = _('The following file has moved: "<b>%s</b>"'
-                     '\nPlease specify its new location:'
-                     % info_name(asset))
+                     '\nPlease specify its new location:') % \
+                info_name(asset)
         else:
             length = beautify_length(asset.get_duration())
             text = _('The following file has moved: "<b>%s</b>" (duration: %s)'
-                     '\nPlease specify its new location:'
-                     % (info_name(asset), length))
+                     '\nPlease specify its new location:') % \
+                (info_name(asset), length)
 
         label = Gtk.Label()
         label.set_markup(text)
@@ -980,7 +983,7 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
         filter_ = Gtk.FileFilter()
         # Translators: this is a format filter in a filechooser. Ex: "AVI
         # files"
-        filter_.set_name(_("%s files" % extension))
+        filter_.set_name(_("%s files") % extension)
         filter_.add_pattern("*%s" % extension.lower())
         filter_.add_pattern("*%s" % extension.upper())
         default = Gtk.FileFilter()
@@ -1010,8 +1013,8 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
                 # You have to do this *after* successfully creating a blank project,
                 # or the startupwizard will still be connected to that signal too.
                 reason = _('No replacement file was provided for "<i>%s</i>".\n\n'
-                           'Pitivi does not currently support partial projects.'
-                           % info_name(asset))
+                           'Pitivi does not currently support partial projects.') % \
+                    info_name(asset)
                 project_manager.emit("new-project-failed", project.uri, reason)
 
         dialog.destroy()
diff --git a/pitivi/project.py b/pitivi/project.py
index 7123102..5b037e4 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -267,8 +267,8 @@ class ProjectManager(GObject.Object, Loggable):
 
         message = _("An autosaved version of your project file was found. "
                     "It is %s newer than the saved project.\n\n"
-                    "Would you like to load it instead?"
-                    % beautify_time_delta(time_diff))
+                    "Would you like to load it instead?") % \
+            beautify_time_delta(time_diff)
         primary.props.label = message
 
         # put the text in a vbox
diff --git a/pitivi/render.py b/pitivi/render.py
index 24ccec5..4810d76 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -683,12 +683,12 @@ class RenderDialog(Loggable):
         # If it's in the giga range (10⁹) instead of mega (10⁶), use 2 decimals
         if estimated_size > 10e8:
             gigabytes = estimated_size / (10 ** 9)
-            return _("%.2f GB" % gigabytes)
+            return _("%.2f GB") % gigabytes
         else:
             megabytes = int(estimated_size / (10 ** 6))
             if megabytes > 30:
                 megabytes = int(round(megabytes, -1))  # -1 means round to 10
-            return _("%d MB" % megabytes)
+            return _("%d MB") % megabytes
 
     def updateFilename(self, basename):
         """Updates the filename UI element to show the specified file name."""
@@ -1042,7 +1042,7 @@ class RenderDialog(Loggable):
             self.progress.setFilesizeEstimate(None)
             if not self.progress.window.is_active():
                 notification = _(
-                    '"%s" has finished rendering.' % self.fileentry.get_text())
+                    '"%s" has finished rendering.') % self.fileentry.get_text()
                 self.notification = self.app.system.desktopMessage(
                     _("Render complete"), notification, "pitivi")
             self._maybe_play_finished_sound()
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index 6729bb4..08e760a 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -221,7 +221,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
 
         human_time = beautify_length(position)
         cur_frame = int(position / self.ns_per_frame) + 1
-        self.set_tooltip_text(human_time + "\n" + _("Frame #%d" % cur_frame))
+        self.set_tooltip_text(human_time + "\n" + _("Frame #%d") % cur_frame)
         return False
 
     def do_scroll_event(self, event):


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