[gnome-lirc-properties] Internationalization corrections. Bug #603020



commit 0a815d2ae23b61059667ed730fdf0192a55d9b07
Author: Marek Ä?ernocký <marek manet cz>
Date:   Fri Dec 4 17:37:55 2009 +0100

    Internationalization corrections. Bug #603020
    
    I send the patch to solve 2 bugs in i18n.
    
    1. Bad gettext initialization
    Current code don't fully initialze gettext and UI stay untranslated.
    
    2. Trimmed strings in POT
    Some long strings are split to more lines with operator plus now. But msgmerge
    extract only the first part so string in POT/PO is trimmed.

 bin/gnome-lirc-properties.in                       |    6 ++++-
 gnome_lirc_properties/backend.py                   |   10 +-------
 gnome_lirc_properties/ui/CustomConfiguration.py    |   14 +++++-------
 .../ui/RemoteControlProperties.py                  |   23 +++++++-------------
 4 files changed, 21 insertions(+), 32 deletions(-)
---
diff --git a/bin/gnome-lirc-properties.in b/bin/gnome-lirc-properties.in
index d9860aa..b919fee 100644
--- a/bin/gnome-lirc-properties.in
+++ b/bin/gnome-lirc-properties.in
@@ -1,6 +1,6 @@
 #! PYTHON@
 
-import gettext, locale, os.path, sys
+import gettext, locale, os.path, sys, gtk.glade
 
 locale.setlocale(locale.LC_ALL, '')
 
@@ -18,7 +18,11 @@ if os.path.isfile(probe):
 
 else:
     localedir = os.path.join(datadir, 'locale')
+    gtk.glade.bindtextdomain('@GETTEXT_PACKAGE@', localedir)
+    gtk.glade.textdomain ('@GETTEXT_PACKAGE@');
     gettext.bindtextdomain('@GETTEXT_PACKAGE@', localedir)
+    gettext.bind_textdomain_codeset ('@GETTEXT_PACKAGE@', 'UTF-8');
+    gettext.textdomain ('@GETTEXT_PACKAGE@');
 
     datadir = os.path.join(datadir, '@PACKAGE@')
 
diff --git a/gnome_lirc_properties/backend.py b/gnome_lirc_properties/backend.py
index 2475b21..b9e11f0 100644
--- a/gnome_lirc_properties/backend.py
+++ b/gnome_lirc_properties/backend.py
@@ -370,11 +370,7 @@ class DetectParametersDriver(IrRecordDriver):
 
             self.RequestAction(
                 _('Press random buttons on your remote control.'),
-                _('When you press the Start button, it is very important '
-                  'that you press many different buttons and hold them down ' +
-                  'for approximately one second. Each button should move the ' +
-                  'progress bar by at least one step, but in no case by more ' +
-                  'than ten steps.'))
+                _('When you press the Start button, it is very important that you press many different buttons and hold them down for approximately one second. Each button should move the progress bar by at least one step, but in no case by more than ten steps.'))
 
             return
 
@@ -385,9 +381,7 @@ class DetectParametersDriver(IrRecordDriver):
         if line.startswith(self._token_wait_toggle_mask):
             self.RequestAction(
                 _('Press a button repeatedly as fast as possible.'),
-                _('Make sure you keep pressing the <b>same</b> button and that you ' +
-                  '<b>do not hold</b> the button down.\nWait a little between button ' +
-                  'presses if you cannot see any progress.'))
+                _('Make sure you keep pressing the <b>same</b> button and that you <b>do not hold</b> the button down.\nWait a little between button presses if you cannot see any progress.'))
 
             return
 
diff --git a/gnome_lirc_properties/ui/CustomConfiguration.py b/gnome_lirc_properties/ui/CustomConfiguration.py
index 51ae86d..298db56 100644
--- a/gnome_lirc_properties/ui/CustomConfiguration.py
+++ b/gnome_lirc_properties/ui/CustomConfiguration.py
@@ -401,16 +401,14 @@ class CustomConfiguration(object):
         keys_model = self.__treeview_keys.get_model()
 
         if 0 == keys_model.count_keys(lirc.KeyCodeCategory.DEFAULT):
-            if configuration_problem(_('This configuration has no keys for the default ' +
-                                       'namespace. Most applications won\'t be able to ' +
-                                       'use this configuration.')):
-                return
+            if configuration_problem(
+                _('This configuration has no keys for the default namespace. Most applications won\'t be able to use this configuration.')):
+                    return
 
         elif 0 != keys_model.count_keys(lirc.KeyCodeCategory.CUSTOM):
-            if configuration_problem(_('Some keys in this configuration have names ' +
-                                       'which do not belong to any standardized namespace.' +
-                                       'Most applications won\'t be able to use those keys.')):
-                return
+            if configuration_problem(
+                _('Some keys in this configuration have names which do not belong to any standardized namespace. Most applications won\'t be able to use those keys.')):
+                    return
 
         self.__dialog.set_sensitive(False)
 
diff --git a/gnome_lirc_properties/ui/RemoteControlProperties.py b/gnome_lirc_properties/ui/RemoteControlProperties.py
index e65af35..8c2fb88 100644
--- a/gnome_lirc_properties/ui/RemoteControlProperties.py
+++ b/gnome_lirc_properties/ui/RemoteControlProperties.py
@@ -242,10 +242,8 @@ class RemoteControlProperties(object):
         return (
             gtk.RESPONSE_ACCEPT == show_message(self.__dialog,
             _('Invalid IR Configuration'),
-            _('Your configuration files seems to be incorrect. ' +
-              'Should this program try to restore your settings, ' +
-              'for a %s %s remote?') % (
-            remote.vendor, remote.product), buttons=responses))
+            _('Your configuration files seems to be incorrect. Should this program try to restore your settings, for a %s %s remote?') % 
+            (remote.vendor, remote.product), buttons=responses))
 
     def __restore_hardware_settings(self):
         '''Restore hardware settings from configuration files.'''
@@ -324,9 +322,8 @@ class RemoteControlProperties(object):
 
         else:
             self.__label_preview_result.hide()
-            self.__label_preview_status.set_markup(_('<b>Warning:</b> Remote control daemon ' +
-                                                     'not running. Cannot test buttons.\n' + 
-                                                     'This could be due to a configuration error. Try changing the configuration.'))
+            self.__label_preview_status.set_markup(
+                _('<b>Warning:</b> Remote control daemon not running. Cannot test buttons.\nThis could be due to a configuration error. Try changing the configuration.'))
 
     # pylint: disable-msg=W0613,R0913
     def __on_lirc_key_pressed(self, listener, remote, repeat, name, code):
@@ -401,8 +398,7 @@ class RemoteControlProperties(object):
 
             elif httplib.NOT_MODIFIED == getattr(content, 'code', None):
                 show_message(self.__dialog, progress_window.title,
-                             details=_('No updates available. Your remote control configuration ' +
-                                       'files are already up-to-date.'),
+                             details=_('No updates available. Your remote control configuration files are already up-to-date.'),
                              message_type=gtk.MESSAGE_INFO)
 
             else:
@@ -665,10 +661,7 @@ class RemoteControlProperties(object):
             if (gtk.RESPONSE_REJECT ==
                 show_message(self.__dialog,
                              _('No IR Receivers Found'),
-                             _('Could not find any IR receiver. Is your device attached?\n\n' +
-                             'Note that some devices, such as homebrew serial port ' +
-                             'receivers must be selected manually since there is no ' +
-                             'way to detect them automatically.'),
+                             _('Could not find any IR receiver. Is your device attached?\n\nNote that some devices, such as homebrew serial port receivers must be selected manually since there is no way to detect them automatically.'),
                              buttons=responses)):
 
                 self._on_button_auto_detect_clicked()
@@ -890,8 +883,8 @@ class RemoteControlProperties(object):
 
         except OSError, ex:
             if errno.ENOENT == ex.errno:
-                error_message = _('Cannot display help since the GNOME Help ' +
-                                  'Browser ("yelp") cannot be found.')
+                error_message = 
+                    _('Cannot display help since the GNOME Help Browser ("yelp") cannot be found.')
 
             else:
                 error_message = _('Cannot display help for unexpected reason: %s') % ex.strerror



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