From fa2d983354511e6777b12b7d99d22b9e18c1f4d1 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 1 Aug 2008 09:30:36 +0000 Subject: [PATCH] better transltion strings. see #4166 --- src/chat_control.py | 10 +++--- src/common/config.py | 4 +-- src/common/connection.py | 11 +++--- src/common/zeroconf/connection_zeroconf.py | 5 +-- src/config.py | 8 ++--- src/dialogs.py | 19 +++++----- src/disco.py | 11 +++--- src/gajim.py | 42 ++++++++++++---------- 8 files changed, 60 insertions(+), 50 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index aafb12466..a98b233ea 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1660,9 +1660,9 @@ class ChatControl(ChatControlBase): self.print_conversation(_('Usage: /%s, hide the chat buttons.') % \ command, 'info') elif command == 'me': - self.print_conversation(_('Usage: /%s , sends action to the ' - 'current group chat. Use third person. (e.g. /%s explodes.)') % \ - (command, command), 'info') + self.print_conversation(_('Usage: /%(command)s , sends action ' + 'to the current group chat. Use third person. (e.g. /%s explodes.)' + ) % {'command': command}, 'info') elif command == 'ping': self.print_conversation(_('Usage: /%s, sends a ping to the contact') %\ command, 'info') @@ -2590,8 +2590,8 @@ class ChatControl(ChatControlBase): self.update_ui() self.parent_win.redraw_tab(self) - self.print_conversation(_('%s is now %s') % (name, uf_show), - 'status') + self.print_conversation(_('%(name)s is now %(status)s') % {'name': name, + 'status': uf_show}, 'status') if status: self.print_conversation(' (', 'status', simple=True) diff --git a/src/common/config.py b/src/common/config.py index d6d9b3c9a..5978b11b8 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -167,7 +167,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, 'http://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, True, _('If checked, Gajim can be controlled remotely using gajim-remote.'), True], @@ -650,4 +650,4 @@ class Config: self.set_per('defaultstatusmsg', status, 'enabled', default[0]) self.set_per('defaultstatusmsg', status, 'message', default[1]) -# vim: se ts=3: \ No newline at end of file +# vim: se ts=3: diff --git a/src/common/connection.py b/src/common/connection.py index 4a440f249..f555e412d 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -269,8 +269,8 @@ class Connection(ConnectionHandlers): # it's a new account if not data[1]: # wrong answer self.dispatch('ACC_NOT_OK', ( - _('Server %s answered wrongly to register request: %s')\ - % (data[0], data[3]))) + _('Server %(name)s answered wrongly to register request: ' + '%(error)s') % {'name': data[0], 'error': data[3]})) return is_form = data[2] conf = data[1] @@ -335,8 +335,8 @@ class Connection(ConnectionHandlers): return if not data[1]: # wrong answer self.dispatch('ERROR', (_('Invalid answer'), - _('Transport %s answered wrongly to register request: %s') % \ - (data[0], data[3]))) + _('Transport %(name)s answered wrongly to register request: ' + '%(error)s') % {'name': data[0], 'error': data[3]})) return is_form = data[2] conf = data[1] @@ -1182,7 +1182,8 @@ class Connection(ConnectionHandlers): if original_message != None: log_msg = original_message if subject: - log_msg = _('Subject: %s\n%s') % (subject, msg) + log_msg = _('Subject: %(subject)s\n%(message)s') % \ + {'subject': subject, 'message': msg} if log_msg: if type == 'chat': kind = 'chat_msg_sent' diff --git a/src/common/zeroconf/connection_zeroconf.py b/src/common/zeroconf/connection_zeroconf.py index 1bc3bda31..ba0b2e054 100644 --- a/src/common/zeroconf/connection_zeroconf.py +++ b/src/common/zeroconf/connection_zeroconf.py @@ -442,7 +442,8 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): ji not in no_log_for: log_msg = msg if subject: - log_msg = _('Subject: %s\n%s') % (subject, msg) + log_msg = _('Subject: %(subject)s\n%(message)s') % \ + {'subject': subject, 'message': msg} if log_msg: if type == 'chat': kind = 'chat_msg_sent' @@ -554,4 +555,4 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): # END ConnectionZeroconf -# vim: se ts=3: \ No newline at end of file +# vim: se ts=3: diff --git a/src/config.py b/src/config.py index 2f5410a90..cc001fc0c 100644 --- a/src/config.py +++ b/src/config.py @@ -3243,10 +3243,10 @@ class AccountCreationWizardWindow: # An SSL warning occured, show it hostname = gajim.connections[self.account].new_account_info['hostname'] self.xml.get_widget('ssl_label').set_markup(_('Security Warning' - '\n\nThe authenticity of the %s SSL certificate could be invalid.\n' - 'SSL Error: %s\n' - 'Do you still want to connect to this server?') % (hostname, - ssl_msg)) + '\n\nThe authenticity of the %(hostname)s SSL certificate could be ' + 'invalid.\nSSL Error: %(error)s\n' + 'Do you still want to connect to this server?') % { + 'hostname': hostname, 'error': ssl_msg}) if ssl_err in (18, 27): text = _('Add this certificate to the list of trusted certificates.\nSHA1 fingerprint of the certificate:\n%s') % ssl_fingerprint self.xml.get_widget('ssl_checkbutton').set_label(text) diff --git a/src/dialogs.py b/src/dialogs.py index b0bd43f7f..2ae46b136 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -1591,8 +1591,9 @@ class SubscriptionRequestWindow: self.account = account self.user_nick = user_nick if len(gajim.connections) >= 2: - prompt_text = _('Subscription request for account %s from %s')\ - % (account, self.jid) + prompt_text = \ + _('Subscription request for account %(account)s from %(jid)s')\ + % {'account': account, 'jid': self.jid} else: prompt_text = _('Subscription request from %s') % self.jid xml.get_widget('from_label').set_text(prompt_text) @@ -2606,11 +2607,13 @@ class PrivacyListWindow: self.global_rules = {} for rule in rules: if rule.has_key('type'): - text_item = _('Order: %s, action: %s, type: %s, value: %s') % \ - (rule['order'], rule['action'], rule['type'], rule['value']) + text_item = _('Order: %(order)s, action: %(action)s, type: %(type)s' + ', value: %(value)s') % {'order': rule['order'], + 'action': rule['action'], 'type': rule['type'], + 'value': rule['value']} else: - text_item = _('Order: %s, action: %s') % (rule['order'], - rule['action']) + text_item = _('Order: %(order)s, action: %(action)s') % \ + {'order': rule['order'], 'action': rule['action']} self.global_rules[text_item] = rule self.list_of_rules_combobox.append_text(text_item) if len(rules) == 0: @@ -3808,7 +3811,7 @@ class ESessionInfoWindow: self.window.show_all() def update_info(self): - labeltext = _('''Your chat session with %s is encrypted.\n\nThis session's Short Authentication String is: %s''') % (self.session.jid, self.session.sas) + labeltext = _('''Your chat session with %(jid)s is encrypted.\n\nThis session's Short Authentication String is: %(sas)s''') % {'jid': self.session.jid, 'sas': self.session.sas} if self.session.verified_identity: labeltext += '\n\n' + _('''You have already verified this contact's identity.''') @@ -3827,7 +3830,7 @@ class ESessionInfoWindow: def on_verify_now_button_clicked(self, widget): pritext = _('''Have you verified the remote contact's identity?''') - sectext = _('''To prevent a man-in-the-middle attack, you should speak to %s directly (in person or on the phone) and verify that they see the same Short Authentication String (SAS) as you.\n\nThis session's Short Authentication String: %s''') % (self.session.jid, self.session.sas) + sectext = _('''To prevent a man-in-the-middle attack, you should speak to %(jid)s directly (in person or on the phone) and verify that they see the same Short Authentication String (SAS) as you.\n\nThis session's Short Authentication String: %(sas)s''') % {'jid': self.session.jid, 'sas': self.session.sas} sectext += '\n\n' + _('Did you talk to the remote contact and verify the SAS?') dialog = YesNoDialog(pritext, sectext) diff --git a/src/disco.py b/src/disco.py index 258be8bbd..4196643ec 100644 --- a/src/disco.py +++ b/src/disco.py @@ -735,8 +735,9 @@ class AgentBrowser: def _set_initial_title(self): '''Set the initial window title based on agent address.''' - self.window.window.set_title(_('Browsing %s using account %s') % \ - (self._get_agent_address(), self.account)) + self.window.window.set_title(_('Browsing %(address)s using account ' + '%(account)s') % {'address': self._get_agent_address(), + 'account': self.account}) self.window._set_window_banner_text(self._get_agent_address()) def _create_treemodel(self): @@ -1368,8 +1369,8 @@ class ToplevelAgentBrowser(AgentBrowser): fraction = 0 if self._total_items: - self.window.progressbar.set_text(_("Scanning %d / %d..") %\ - (self._progress, self._total_items)) + self.window.progressbar.set_text(_("Scanning %(current)d / %(total)d.." + ) % {'current': self._progress, 'total': self._total_items}) fraction = float(self._progress) / float(self._total_items) if self._progress >= self._total_items: # We show the progressbar for just a bit before hiding it. @@ -1996,4 +1997,4 @@ class DiscussionGroupsBrowser(AgentBrowser): # Fill the global agent type info dictionary _agent_type_info = _gen_agent_type_info() -# vim: se ts=3: \ No newline at end of file +# vim: se ts=3: diff --git a/src/gajim.py b/src/gajim.py index b58131208..fc49f640c 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -463,8 +463,8 @@ class PassphraseRequest: def create_dialog(self, account): title = _('Passphrase Required') - second = _('Enter GPG key passphrase for key %s (account %s).' - ) % (self.keyid, account) + second = _('Enter GPG key passphrase for key %(keyid)s (account ' + '%(account)s).') % {'kayid': self.keyid, 'account': account} def _cancel(): # user cancelled, continue without GPG @@ -544,9 +544,9 @@ class Interface: sec_msg = _('Do you accept this request on account %s?') % account if data[4]: sec_msg = data[4] + '\n' + sec_msg - self.dialog = dialogs.YesNoDialog(_('HTTP (%s) Authorization for %s (id: %s)') \ - % (data[0], data[1], data[2]), sec_msg, - on_response_yes=(on_yes, account, data[3]), + self.dialog = dialogs.YesNoDialog(_('HTTP (%(method)s) Authorization for ' + '%(url)s (id: %(id)s)') % {'method': data[0], 'url': data[1], + 'id': data[2]}, sec_msg, on_response_yes=(on_yes, account, data[3]), on_response_no=(response, account, data[3], 'no')) def handle_event_error_answer(self, account, array): @@ -935,11 +935,12 @@ class Interface: name = nick, show = show) ctrl = self.new_private_chat(gc_c, account, session) - ctrl.print_conversation('Error %s: %s' % (array[1], array[2]), - 'status') + ctrl.print_conversation(_('Error %(code)s: %(msg)s') % { + 'error': array[1], 'msg': array[2]}, 'status') return - gc_control.print_conversation('Error %s: %s' % (array[1], array[2])) + gc_control.print_conversation(_('Error %(code)s: %(msg)s') % { + 'error': array[1], 'msg': array[2]}, 'status') if gc_control.parent_win and gc_control.parent_win.get_active_jid() == jid: gc_control.set_subject(gc_control.subject) return @@ -948,7 +949,8 @@ class Interface: jid = jid.replace('@', '') msg = array[2] if array[3]: - msg = _('error while sending %s ( %s )') % (array[3], msg) + msg = _('error while sending %(message)s ( %(error)s )') % { + 'message': array[3], 'error': msg} array[5].roster_message(jid, msg, array[4], msg_type='error') def handle_event_msgsent(self, account, array): @@ -960,7 +962,8 @@ class Interface: def handle_event_msgnotsent(self, account, array): #('MSGNOTSENT', account, (jid, ierror_msg, msg, time, session)) - msg = _('error while sending %s ( %s )') % (array[2], array[1]) + msg = _('error while sending %(message)s ( %(error)s )') % { + 'message': array[2], 'error': array[1]} array[4].roster_message(array[0], msg, array[3], account, msg_type='error') @@ -1231,8 +1234,8 @@ class Interface: statusCode = array[9] if '303' in statusCode: new_nick = array[10] - ctrl.print_conversation(_('%s is now known as %s') % (nick, - new_nick), 'status') + ctrl.print_conversation(_('%(nick)s is now known as %(new_nick)s') \ + % {'nick': nick, 'new_nick': new_nick}, 'status') gc_c = gajim.contacts.get_gc_contact(account, room_jid, new_nick) c = gajim.contacts.contact_from_gc_contact(gc_c) ctrl.gc_contact = gc_c @@ -1246,8 +1249,8 @@ class Interface: contact.show = show contact.status = status uf_show = helpers.get_uf_show(show) - ctrl.print_conversation(_('%s is now %s') % (nick, uf_show), - 'status') + ctrl.print_conversation(_('%(nick)s is now %(status)s') % { + 'nick': nick, 'status': uf_show}, 'status') if status: ctrl.print_conversation(' (', 'status', simple=True) ctrl.print_conversation('%s' % (status), 'status', simple=True) @@ -2024,10 +2027,10 @@ class Interface: self.handle_event_status(account, 'offline') pritext = _('SSL certificate error') sectext = _('It seems the SSL certificate has changed or your connection ' - 'is being hacked.\nOld fingerprint: %s\nNew fingerprint: %s\n\nDo you ' - 'still want to connect and update the fingerprint of the certificate?'\ - ) % (gajim.config.get_per('accounts', account, 'ssl_fingerprint_sha1'), - data[0]) + 'is being hacked.\nOld fingerprint: %(old)s\nNew fingerprint: %(new)s' + '\n\nDo you still want to connect and update the fingerprint of the ' + 'certificate?') % {'old': gajim.config.get_per('accounts', account, + 'ssl_fingerprint_sha1'), 'new': data[0]} dialog = dialogs.YesNoDialog(pritext, sectext, on_response_yes=on_yes, on_response_no=on_no) @@ -2094,7 +2097,8 @@ class Interface: # ('PUBSUB_NODE_NOT_REMOVED', account, (jid, node, msg)) if data[0] == gajim.get_jid_from_account(account): dialogs.WarningDialog(_('PEP node was not removed'), - _('PEP node %s was not removed: %s') % (data[1], data[2])) + _('PEP node %(node)s was not removed: %(message)s') % { + 'node': data[1], 'message': data[2]}) def register_handlers(self): self.handlers = {