From 152be4473b94af474e80b15f4182c7eef4fe4c23 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 19 Sep 2017 12:45:02 +0200 Subject: [PATCH] Fix some strings for a better translation --- gajim/command_system/implementation/standard.py | 3 ++- gajim/common/check_paths.py | 2 +- gajim/common/config.py | 2 +- gajim/common/connection.py | 5 +++-- gajim/common/jingle_rtp.py | 12 +++++++----- gajim/common/passwords.py | 2 +- gajim/config.py | 7 ++++--- gajim/data/gui/accounts_window.ui | 2 +- gajim/dialogs.py | 12 +++++++----- gajim/gui_interface.py | 13 +++++++------ gajim/history_sync.py | 3 ++- gajim/roster_window.py | 8 ++++---- test/runtests.py | 2 +- 13 files changed, 41 insertions(+), 32 deletions(-) diff --git a/gajim/command_system/implementation/standard.py b/gajim/command_system/implementation/standard.py index aeec4e7d5..87b068e73 100644 --- a/gajim/command_system/implementation/standard.py +++ b/gajim/command_system/implementation/standard.py @@ -298,7 +298,8 @@ class StandardGroupChatCommands(CommandContainer): @doc(_("Invite a user to a room for a reason")) def invite(self, jid, reason): self.connection.send_invite(self.room_jid, jid, reason) - return _("Invited %s to %s") % (jid, self.room_jid) + return _("Invited %(jid)s to %(room_jid)s") % {'jid': jid, + 'room_jid': self.room_jid} @command(raw=True, empty=True) @doc(_("Join a group chat given by a jid, optionally using given nickname")) diff --git a/gajim/common/check_paths.py b/gajim/common/check_paths.py index d9f8f3311..cdd547003 100644 --- a/gajim/common/check_paths.py +++ b/gajim/common/check_paths.py @@ -250,7 +250,7 @@ def check_and_possibly_move_config(): continue if not os.path.exists(src): continue - print(_('moving %s to %s') % (src, dst)) + print(_('moving %(src)s to %(dst)s') % {'src': src, 'dst': dst}) shutil.move(src, dst) app.logger.init_vars() app.logger.attach_cache_database() diff --git a/gajim/common/config.py b/gajim/common/config.py index f8ad19b2a..bb6fd060b 100644 --- a/gajim/common/config.py +++ b/gajim/common/config.py @@ -194,7 +194,7 @@ class Config: 'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')], 'version': [ opt_str, defs.version ], # which version created the config 'search_engine': [opt_str, 'https://www.google.com/search?&q=%s&sourceid=gajim'], - 'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom url with %s in it where %s is the word/phrase or 'WIKTIONARY' which means use wiktionary.")], + 'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom url with %%s in it where %%s is the word/phrase or 'WIKTIONARY' which means use wiktionary.")], 'always_english_wikipedia': [opt_bool, False], 'always_english_wiktionary': [opt_bool, True], 'remote_control': [opt_bool, False, _('If checked, Gajim can be controlled remotely using gajim-remote.'), True], diff --git a/gajim/common/connection.py b/gajim/common/connection.py index 835cf1b0a..923aff9ce 100644 --- a/gajim/common/connection.py +++ b/gajim/common/connection.py @@ -2078,8 +2078,9 @@ class Connection(CommonConnection, ConnectionHandlers): return if type_ == 'message': if len(contacts) == 1: - msg = _('Sent contact: "%s" (%s)') % (contacts[0].get_full_jid(), - contacts[0].get_shown_name()) + msg = _('Sent contact: "%(jid)s" (%(name)s)') % { + 'jid': contacts[0].get_full_jid(), + 'name': contacts[0].get_shown_name()} else: msg = _('Sent contacts:') for contact in contacts: diff --git a/gajim/common/jingle_rtp.py b/gajim/common/jingle_rtp.py index b6ead263e..08bcf0353 100644 --- a/gajim/common/jingle_rtp.py +++ b/gajim/common/jingle_rtp.py @@ -121,8 +121,10 @@ class JingleRTPContent(JingleContent): InformationEvent( None, conn=self.session.connection, level='error', pri_txt=_('%s configuration error') % text.capitalize(), - sec_txt=_('Couldn’t setup %s. Check your configuration.\n\n' - 'Pipeline was:\n%s\n\nError was:\n%s') % (text, pipeline, str(e)))) + sec_txt=_('Couldn’t setup %(text)s. Check your ' + 'configuration.\n\nPipeline was:\n%(pipeline)s\n\n' + 'Error was:\n%(error)s') % {'text': text, + 'pipeline': pipeline, 'error': str(e)})) raise JingleContentSetupException def add_remote_candidates(self, candidates): @@ -228,9 +230,9 @@ class JingleRTPContent(JingleContent): InformationEvent( None, conn=self.session.connection, level='error', pri_txt=_('GStreamer error'), - sec_txt=_('Error: %s\nDebug: %s' % - (message.get_structure().get_value('gerror'), - message.get_structure().get_value('debug'))))) + sec_txt=_('Error: %(error)s\nDebug: %(debug)s' % { + 'error': message.get_structure().get_value('gerror'), + 'debug': message.get_structure().get_value('debug')}))) sink_pad = self.p2psession.get_property('sink-pad') diff --git a/gajim/common/passwords.py b/gajim/common/passwords.py index c97996e0f..8f305f2ee 100644 --- a/gajim/common/passwords.py +++ b/gajim/common/passwords.py @@ -78,7 +78,7 @@ class LibSecretPasswordStorage(PasswordStorage): def save_password(self, account_name, password, update=True): server = app.config.get_per('accounts', account_name, 'hostname') user = app.config.get_per('accounts', account_name, 'name') - display_name = _('XMPP account %s@%s') % (user, server) + display_name = _('XMPP account %s') % user + '@' + server attributes = {'user': user, 'server': server, 'protocol': 'xmpp'} return self.Secret.password_store_sync(self.GAJIM_SCHEMA, attributes, self.Secret.COLLECTION_DEFAULT, display_name, password or '', None) diff --git a/gajim/config.py b/gajim/config.py index f1d743dd1..eed528b9e 100644 --- a/gajim/config.py +++ b/gajim/config.py @@ -2693,9 +2693,10 @@ class AccountCreationWizardWindow: 'hostname': hostname, 'error': obj.ssl_msg}) if obj.errnum in (18, 27): text = _('Add this certificate to the list of trusted ' - 'certificates.\nSHA-1 fingerprint of the certificate:\n%s' - '\nSHA-256 fingerprint of the certificate:\n%s') \ - % (obj.ssl_fingerprint_sha1, obj.ssl_fingerprint_sha256) + 'certificates.\nSHA-1 fingerprint of the certificate:\n' + '%(sha1)s\nSHA-256 fingerprint of the certificate:\n' + '%(sha256)s') % {'sha1': obj.ssl_fingerprint_sha1, + 'sha256': obj.ssl_fingerprint_sha256} self.xml.get_object('ssl_checkbutton').set_label(text) else: self.xml.get_object('ssl_checkbutton').set_no_show_all(True) diff --git a/gajim/data/gui/accounts_window.ui b/gajim/data/gui/accounts_window.ui index 60416ad0c..290f96458 100644 --- a/gajim/data/gui/accounts_window.ui +++ b/gajim/data/gui/accounts_window.ui @@ -61,7 +61,7 @@ main - page0 + page0 diff --git a/gajim/dialogs.py b/gajim/dialogs.py index 8a3739e5e..3d7c2f1c7 100644 --- a/gajim/dialogs.py +++ b/gajim/dialogs.py @@ -894,7 +894,7 @@ class AddNewContactWindow: 'group_comboboxentry', 'auto_authorize_checkbutton'): self.__dict__[w] = self.xml.get_object(w) if account and len(app.connections) >= 2: - self.default_desc = _('Please fill in the data of the contact you want\n' + self.default_desc = _('Please fill in the data of the contact you want ' 'to add to your account %s') % account else: self.default_desc = _('Please fill in the data of the contact you ' @@ -1276,7 +1276,8 @@ class AddNewContactWindow: if obj.stanza.getError(): ErrorDialog(_('Error while adding transport contact'), _('This error occured while adding a contact for transport ' - '%s:\n\n%s') % (transport, obj.stanza.getErrorMsg())) + '%(transport)s:\n\n%(error)s') % {'transport': transport, + 'error': obj.stanza.getErrorMsg()}) return if obj.prompt_jid: self._add_jid(obj.prompt_jid, type_) @@ -2636,9 +2637,10 @@ class JoinGroupchatWindow: if app.contacts.get_contact(self.account, room_jid) and \ not app.contacts.get_contact(self.account, room_jid).is_groupchat(): ErrorDialog(_('This is not a group chat'), - _('%s is already in your roster. Please check if %s is a ' - 'correct group chat name. If it is, delete it from your roster ' - 'and try joining the group chat again.') % (room_jid, room_jid)) + _('%(room_jid)s is already in your roster. Please check if ' + '%(room_jid)s is a correct group chat name. If it is, delete ' + 'it from your roster and try joining the group chat again.') % \ + {'room_jid': room_jid, 'room_jid': room_jid}) return full_jid = room_jid + '/' + nickname diff --git a/gajim/gui_interface.py b/gajim/gui_interface.py index 60331e942..078a88cfc 100644 --- a/gajim/gui_interface.py +++ b/gajim/gui_interface.py @@ -1360,9 +1360,9 @@ class Interface: 'server?') % {'error': obj.error_text} if obj.error_num in (18, 27): checktext1 = _('Add this certificate to the list of trusted ' - 'certificates.\nSHA-1 fingerprint of the certificate:\n%s' - '\nSHA256 fingerprint of the certificate:\n%s') % \ - (obj.fingerprint_sha1, obj.fingerprint_sha256) + 'certificates.\nSHA-1 fingerprint of the certificate:\n%(sha1)s' + '\nSHA256 fingerprint of the certificate:\n%(sha256)s') % \ + {'sha1': obj.fingerprint_sha1, 'sha256': obj.fingerprint_sha256} else: checktext1 = '' checktext2 = _('Ignore this error for this certificate.') @@ -1967,9 +1967,10 @@ class Interface: if app.contacts.get_contact(account, room_jid) and \ not app.contacts.get_contact(account, room_jid).is_groupchat(): dialogs.ErrorDialog(_('This is not a group chat'), - _('%s is already in your roster. Please check if %s is a ' - 'correct group chat name. If it is, delete it from your roster ' - 'and try joining the group chat again.') % (room_jid, room_jid)) + _('%(room_jid)s is already in your roster. Please check ' + 'if %(room_jid)s is a correct group chat name. If it is, ' + 'delete it from your roster and try joining the group chat ' + 'again.') % {'room_jid': room_jid, 'room_jid': room_jid}) return if not nick: diff --git a/gajim/history_sync.py b/gajim/history_sync.py index 9ea237087..51d0e7dad 100644 --- a/gajim/history_sync.py +++ b/gajim/history_sync.py @@ -283,7 +283,8 @@ class DownloadHistoryPage(Gtk.Box): self.received += 1 if self.count: self.progress.set_fraction(self.received / self.count) - self.progress.set_text(_('%s of %s' % (self.received, self.count))) + self.progress.set_text(_('%(received)s of %(max)s' % { + 'received': self.received, 'max': self.count})) else: self.progress.pulse() self.progress.set_text(_('Downloaded %s Messages' % self.received)) diff --git a/gajim/roster_window.py b/gajim/roster_window.py index b7f70cf5e..bf613da4a 100644 --- a/gajim/roster_window.py +++ b/gajim/roster_window.py @@ -4642,8 +4642,8 @@ class RosterWindow: # c_dest is None if jid_dest doesn't belong to account return menu = Gtk.Menu() - item = Gtk.MenuItem.new_with_label(_('Send %s to %s') % ( - c_source.get_shown_name(), c_dest.get_shown_name())) + item = Gtk.MenuItem.new_with_label(_('Send %(from)s to %(to)s') % { + 'from': c_source.get_shown_name(), 'to': c_dest.get_shown_name()}) item.set_use_underline(False) item.connect('activate', self.on_drop_rosterx, account_source, c_source, account_dest, c_dest, is_big_brother, context, etime) @@ -4660,8 +4660,8 @@ class RosterWindow: item.set_use_underline(False) else: item = Gtk.MenuItem.new_with_label( - _('Make %s and %s metacontacts') % ( - c_source.get_shown_name(), c_dest.get_shown_name())) + _('Make %(contact1)s and %(contact2)s metacontacts') % { + 'contact1': c_source.get_shown_name(), 'contact2': c_dest.get_shown_name()}) item.set_use_underline(False) item.connect('activate', self.on_drop_in_contact, account_source, diff --git a/test/runtests.py b/test/runtests.py index c6fc503a3..857ba8e63 100755 --- a/test/runtests.py +++ b/test/runtests.py @@ -57,7 +57,7 @@ for mod in modules: suite = unittest.defaultTestLoader.loadTestsFromName(mod) result = unittest.TextTestRunner(verbosity=verbose).run(suite) if use_x: - # Wait 1s to be sure all timeout_add will be called before we cleanup main loop + # Wait 500ms to be sure all timeout_add will be called before we cleanup main loop import time time.sleep(0.5) # Clean main loop