From dd98aa44a5084f0590645f5ee9565ab962e6c844 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 10 May 2015 10:37:00 +0200 Subject: =?UTF-8?q?Remove=20gettext=20support,=20as=20we=20don=E2=80=99t?= =?UTF-8?q?=20want=20to=20translate=20poezio,=20and=20it=20takes=20more=20?= =?UTF-8?q?than=201ms=20per=20call.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tabs/adhoc_commands_list.py | 6 +- src/tabs/basetabs.py | 56 +++--- src/tabs/bookmarkstab.py | 18 +- src/tabs/conversationtab.py | 38 ++-- src/tabs/listtab.py | 6 +- src/tabs/muclisttab.py | 6 +- src/tabs/muctab.py | 388 ++++++++++++++++++++-------------------- src/tabs/privatetab.py | 26 ++- src/tabs/rostertab.py | 206 +++++++++++---------- src/tabs/xmltab.py | 42 +++-- 10 files changed, 386 insertions(+), 406 deletions(-) (limited to 'src/tabs') diff --git a/src/tabs/adhoc_commands_list.py b/src/tabs/adhoc_commands_list.py index 7f5abf6a..10ebf22b 100644 --- a/src/tabs/adhoc_commands_list.py +++ b/src/tabs/adhoc_commands_list.py @@ -4,8 +4,6 @@ select one of them and start executing it, or just close the tab and do nothing. """ -from gettext import gettext as _ - import logging log = logging.getLogger(__name__) @@ -20,7 +18,7 @@ class AdhocCommandsListTab(ListTab): def __init__(self, jid): ListTab.__init__(self, jid.full, "“Enter”: execute selected command.", - _('Ad-hoc commands of JID %s (Loading)') % jid, + 'Ad-hoc commands of JID %s (Loading)' % jid, (('Node', 0), ('Description', 1))) self.key_func['^M'] = self.execute_selected_command @@ -50,7 +48,7 @@ class AdhocCommandsListTab(ListTab): yield item items = [(item['node'], item['name'] or '', item['jid']) for item in get_items()] self.listview.set_lines(items) - self.info_header.message = _('Ad-hoc commands of JID %s') % self.name + self.info_header.message = 'Ad-hoc commands of JID %s' % self.name if self.core.current_tab() is self: self.refresh() else: diff --git a/src/tabs/basetabs.py b/src/tabs/basetabs.py index 1938cb65..30ddf239 100644 --- a/src/tabs/basetabs.py +++ b/src/tabs/basetabs.py @@ -13,8 +13,6 @@ This module also defines ChatTabs, the parent class for all tabs revolving around chats. """ -from gettext import gettext as _ - import logging log = logging.getLogger(__name__) @@ -281,9 +279,9 @@ class Tab(object): if self.missing_command_callback is not None: error_handled = self.missing_command_callback(low) if not error_handled: - self.core.information(_("Unknown command (%s)") % - (command), - _('Error')) + self.core.information("Unknown command (%s)" % + (command), + 'Error') if command in ('correct', 'say'): # hack arg = xhtml.convert_simple_to_full_colors(arg) else: @@ -455,16 +453,16 @@ class ChatTab(Tab): self.key_func['M-/'] = self.last_words_completion self.key_func['^M'] = self.on_enter self.register_command('say', self.command_say, - usage=_(''), - shortdesc=_('Send the message.')) + usage='', + shortdesc='Send the message.') self.register_command('xhtml', self.command_xhtml, - usage=_(''), - shortdesc=_('Send custom XHTML.')) + usage='', + shortdesc='Send custom XHTML.') self.register_command('clear', self.command_clear, - shortdesc=_('Clear the current buffer.')) + shortdesc='Clear the current buffer.') self.register_command('correct', self.command_correct, - desc=_('Fix the last message with whatever you want.'), - shortdesc=_('Correct the last message.'), + desc='Fix the last message with whatever you want.', + shortdesc='Correct the last message.', completion=self.completion_correct) self.chat_state = None self.update_commands() @@ -492,7 +490,7 @@ class ChatTab(Tab): """ name = safeJID(self.name).bare if not logger.log_message(name, nickname, txt, date=time, typ=typ): - self.core.information(_('Unable to write in the log file'), 'Error') + self.core.information('Unable to write in the log file', 'Error') def add_message(self, txt, time=None, nickname=None, forced_user=None, nick_color=None, identifier=None, jid=None, history=None, @@ -647,7 +645,7 @@ class ChatTab(Tab): self.core.command_help('correct') return if not self.last_sent_message: - self.core.information(_('There is no message to correct.')) + self.core.information('There is no message to correct.') return self.command_say(line, correct=True) @@ -729,9 +727,9 @@ class OneToOneTab(ChatTab): nope = get_theme().CHAR_EMPTY support = ok if value else nope if value: - msg = _('\x19%s}Contact supports chat states [%s].') + msg = '\x19%s}Contact supports chat states [%s].' else: - msg = _('\x19%s}Contact does not support chat states [%s].') + msg = '\x19%s}Contact does not support chat states [%s].' color = dump_tuple(get_theme().COLOR_INFORMATION_TEXT) msg = msg % (color, support) self.add_message(msg, typ=0) @@ -798,11 +796,11 @@ class OneToOneTab(ChatTab): return False if command_name == 'correct': - feature = _('message correction') + feature = 'message correction' elif command_name == 'attention': - feature = _('attention requests') - msg = _('%s does not support %s, therefore the /%s ' - 'command is currently disabled in this tab.') + feature = 'attention requests' + msg = ('%s does not support %s, therefore the /%s ' + 'command is currently disabled in this tab.') msg = msg % (self.name, feature, command_name) self.core.information(msg, 'Info') return True @@ -812,11 +810,11 @@ class OneToOneTab(ChatTab): if 'urn:xmpp:attention:0' in features: self.remote_supports_attention = True self.register_command('attention', self.command_attention, - usage=_('[message]'), - shortdesc=_('Request the attention.'), - desc=_('Attention: Request the attention of ' - 'the contact. Can also send a message' - ' along with the attention.')) + usage='[message]', + shortdesc='Request the attention.', + desc='Attention: Request the attention of ' + 'the contact. Can also send a message' + ' along with the attention.') else: self.remote_supports_attention = False return self.remote_supports_attention @@ -828,8 +826,8 @@ class OneToOneTab(ChatTab): del self.commands['correct'] elif not 'correct' in self.commands: self.register_command('correct', self.command_correct, - desc=_('Fix the last message with whatever you want.'), - shortdesc=_('Correct the last message.'), + desc='Fix the last message with whatever you want.', + shortdesc='Correct the last message.', completion=self.completion_correct) return 'correct' in self.commands @@ -866,8 +864,8 @@ class OneToOneTab(ChatTab): attention = ok if attention else nope receipts = ok if receipts else nope - msg = _('\x19%s}Contact supports: correction [%s], ' - 'attention [%s], receipts [%s].') + msg = ('\x19%s}Contact supports: correction [%s], ' + 'attention [%s], receipts [%s].') color = dump_tuple(get_theme().COLOR_INFORMATION_TEXT) msg = msg % (color, correct, attention, receipts) self.add_message(msg, typ=0) diff --git a/src/tabs/bookmarkstab.py b/src/tabs/bookmarkstab.py index 68cbbf40..7f5069ea 100644 --- a/src/tabs/bookmarkstab.py +++ b/src/tabs/bookmarkstab.py @@ -10,8 +10,6 @@ from bookmarks import Bookmark, BookmarkList, stanza_storage from tabs import Tab from common import safeJID -from gettext import gettext as _ - class BookmarksTab(Tab): """ @@ -32,10 +30,10 @@ class BookmarksTab(Tab): self.bookmarks_win = windows.BookmarksWin(self.bookmarks, self.height-4, self.width, 1, 0) - self.help_win = windows.HelpText(_('Ctrl+Y: save, Ctrl+G: cancel, ' - '↑↓: change lines, tab: change ' - 'column, M-a: add bookmark, C-k' - ': delete bookmark')) + self.help_win = windows.HelpText('Ctrl+Y: save, Ctrl+G: cancel, ' + '↑↓: change lines, tab: change ' + 'column, M-a: add bookmark, C-k' + ': delete bookmark') self.info_header = windows.BookmarksInfoWin() self.key_func['KEY_UP'] = self.bookmarks_win.go_to_previous_line_input self.key_func['KEY_DOWN'] = self.bookmarks_win.go_to_next_line_input @@ -66,14 +64,14 @@ class BookmarksTab(Tab): def on_save(self): self.bookmarks_win.save() if find_duplicates(self.new_bookmarks): - self.core.information(_('Duplicate bookmarks in list (saving aborted)'), 'Error') + self.core.information('Duplicate bookmarks in list (saving aborted)', 'Error') return for bm in self.new_bookmarks: if safeJID(bm.jid): if not self.bookmarks[bm.jid]: self.bookmarks.append(bm) else: - self.core.information(_('Invalid JID for bookmark: %s/%s') % (bm.jid, bm.nick), 'Error') + self.core.information('Invalid JID for bookmark: %s/%s' % (bm.jid, bm.nick), 'Error') return for bm in self.removed_bookmarks: @@ -82,9 +80,9 @@ class BookmarksTab(Tab): def send_cb(success): if success: - self.core.information(_('Bookmarks saved.'), 'Info') + self.core.information('Bookmarks saved.', 'Info') else: - self.core.information(_('Remote bookmarks not saved.'), 'Error') + self.core.information('Remote bookmarks not saved.', 'Error') log.debug('alerte %s', str(stanza_storage(self.bookmarks.bookmarks))) self.bookmarks.save(self.core.xmpp, callback=send_cb) self.core.close_tab() diff --git a/src/tabs/conversationtab.py b/src/tabs/conversationtab.py index f9c0f07c..1d8c60a4 100644 --- a/src/tabs/conversationtab.py +++ b/src/tabs/conversationtab.py @@ -11,8 +11,6 @@ There are two different instances of a ConversationTab: the time. """ -from gettext import gettext as _ - import logging log = logging.getLogger(__name__) @@ -54,18 +52,18 @@ class ConversationTab(OneToOneTab): self.key_func['^I'] = self.completion # commands self.register_command('unquery', self.command_unquery, - shortdesc=_('Close the tab.')) + shortdesc='Close the tab.') self.register_command('close', self.command_unquery, - shortdesc=_('Close the tab.')) + shortdesc='Close the tab.') self.register_command('version', self.command_version, - desc=_('Get the software version of the current interlocutor (usually its XMPP client and Operating System).'), - shortdesc=_('Get the software version of the user.')) + desc='Get the software version of the current interlocutor (usually its XMPP client and Operating System).', + shortdesc='Get the software version of the user.') self.register_command('info', self.command_info, - shortdesc=_('Get the status of the contact.')) + shortdesc='Get the status of the contact.') self.register_command('last_activity', self.command_last_activity, - usage=_('[jid]'), - desc=_('Get the last activity of the given or the current contact.'), - shortdesc=_('Get the activity.'), + usage='[jid]', + desc='Get the last activity of the given or the current contact.', + shortdesc='Get the activity.', completion=self.core.completion_last_activity) self.resize() self.update_commands() @@ -199,7 +197,7 @@ class ConversationTab(OneToOneTab): else: resource = None if resource: - status = (_('Status: %s') % resource.status) if resource.status else '' + status = ('Status: %s' % resource.status) if resource.status else '' self._text_buffer.add_message("\x19%(info_col)s}Show: %(show)s, %(status)s\x19o" % { 'show': resource.show or 'available', 'status': status, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}) return True @@ -220,9 +218,9 @@ class ConversationTab(OneToOneTab): if not res: return self.core.information('Could not get the software version from %s' % (jid,), 'Warning') version = '%s is running %s version %s on %s' % (jid, - res.get('name') or _('an unknown software'), - res.get('version') or _('unknown'), - res.get('os') or _('an unknown platform')) + res.get('name') or 'an unknown software', + res.get('version') or 'unknown', + res.get('os') or 'an unknown platform') self.core.information(version, 'Info') if args: return self.core.command_version(args[0]) @@ -380,7 +378,7 @@ class DynamicConversationTab(ConversationTab): self.info_header = windows.DynamicConversationInfoWin() ConversationTab.__init__(self, jid) self.register_command('unlock', self.unlock_command, - shortdesc=_('Unlock the conversation from a particular resource.')) + shortdesc='Unlock the conversation from a particular resource.') def lock(self, resource): """ @@ -392,8 +390,8 @@ class DynamicConversationTab(ConversationTab): info = '\x19%s}' % dump_tuple(get_theme().COLOR_INFORMATION_TEXT) jid_c = '\x19%s}' % dump_tuple(get_theme().COLOR_MUC_JID) - message = _('%(info)sConversation locked to ' - '%(jid_c)s%(jid)s/%(resource)s%(info)s.') % { + message = ('%(info)sConversation locked to ' + '%(jid_c)s%(jid)s/%(resource)s%(info)s.') % { 'info': info, 'jid_c': jid_c, 'jid': self.name, @@ -417,14 +415,14 @@ class DynamicConversationTab(ConversationTab): jid_c = '\x19%s}' % dump_tuple(get_theme().COLOR_MUC_JID) if from_: - message = _('%(info)sConversation unlocked (received activity' - ' from %(jid_c)s%(jid)s%(info)s).') % { + message = ('%(info)sConversation unlocked (received activity' + ' from %(jid_c)s%(jid)s%(info)s).') % { 'info': info, 'jid_c': jid_c, 'jid': from_} self.add_message(message, typ=0) else: - message = _('%sConversation unlocked.') % info + message = '%sConversation unlocked.' % info self.add_message(message, typ=0) def get_dest_jid(self): diff --git a/src/tabs/listtab.py b/src/tabs/listtab.py index c5aab5eb..7021c8e3 100644 --- a/src/tabs/listtab.py +++ b/src/tabs/listtab.py @@ -4,8 +4,6 @@ sortable list. It should be inherited, to actually provide methods that insert items in the list, and that lets the user interact with them. """ -from gettext import gettext as _ - import logging log = logging.getLogger(__name__) @@ -52,7 +50,7 @@ class ListTab(Tab): self.key_func['KEY_RIGHT'] = self.list_header.sel_column_right self.key_func[' '] = self.sort_by self.register_command('close', self.close, - shortdesc=_('Close this tab.')) + shortdesc='Close this tab.') self.resize() self.update_keys() self.update_commands() @@ -121,7 +119,7 @@ class ListTab(Tab): """ If there's an error (retrieving the values etc) """ - self._error_message = _('Error: %(code)s - %(msg)s: %(body)s') % {'msg':msg, 'body':body, 'code':code} + self._error_message = 'Error: %(code)s - %(msg)s: %(body)s' % {'msg':msg, 'body':body, 'code':code} self.info_header.message = self._error_message self.info_header.refresh() curses.doupdate() diff --git a/src/tabs/muclisttab.py b/src/tabs/muclisttab.py index 53586fcd..c26fb268 100644 --- a/src/tabs/muclisttab.py +++ b/src/tabs/muclisttab.py @@ -4,8 +4,6 @@ A MucListTab is a tab listing the rooms on a conference server. It has no functionnality except scrolling the list, and allowing the user to join the rooms. """ -from gettext import gettext as _ - import logging log = logging.getLogger(__name__) @@ -24,7 +22,7 @@ class MucListTab(ListTab): def __init__(self, server): ListTab.__init__(self, server.full, "“j”: join room.", - _('Chatroom list on server %s (Loading)') % server, + 'Chatroom list on server %s (Loading)' % server, (('node-part', 0), ('name', 2), ('users', 3))) self.key_func['j'] = self.join_selected self.key_func['J'] = self.join_selected_no_focus @@ -56,7 +54,7 @@ class MucListTab(ListTab): item[0], item[2] or '', '') for item in get_items()] self.listview.set_lines(items) - self.info_header.message = _('Chatroom list on server %s') % self.name + self.info_header.message = 'Chatroom list on server %s' % self.name if self.core.current_tab() is self: self.refresh() else: diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py index c84c92cc..1d82ec3a 100644 --- a/src/tabs/muctab.py +++ b/src/tabs/muctab.py @@ -7,8 +7,6 @@ It keeps track of many things such as part/joins, maintains an user list, and updates private tabs when necessary. """ -from gettext import gettext as _ - import logging log = logging.getLogger(__name__) @@ -37,11 +35,11 @@ from user import User SHOW_NAME = { - 'dnd': _('busy'), - 'away': _('away'), - 'xa': _('not available'), - 'chat': _('chatty'), - '': _('available') + 'dnd': 'busy', + 'away': 'away', + 'xa': 'not available', + 'chat': 'chatty', + '': 'available' } NS_MUC_USER = 'http://jabber.org/protocol/muc#user' @@ -87,112 +85,112 @@ class MucTab(ChatTab): self.key_func['M-p'] = self.go_to_prev_hl # commands self.register_command('ignore', self.command_ignore, - usage=_(''), - desc=_('Ignore a specified nickname.'), - shortdesc=_('Ignore someone'), + usage='', + desc='Ignore a specified nickname.', + shortdesc='Ignore someone', completion=self.completion_ignore) self.register_command('unignore', self.command_unignore, - usage=_(''), - desc=_('Remove the specified nickname from the ignore list.'), - shortdesc=_('Unignore someone.'), + usage='', + desc='Remove the specified nickname from the ignore list.', + shortdesc='Unignore someone.', completion=self.completion_unignore) self.register_command('kick', self.command_kick, - usage=_(' [reason]'), - desc=_('Kick the user with the specified nickname.' - ' You also can give an optional reason.'), - shortdesc=_('Kick someone.'), + usage=' [reason]', + desc='Kick the user with the specified nickname.' + ' You also can give an optional reason.', + shortdesc='Kick someone.', completion=self.completion_quoted) self.register_command('ban', self.command_ban, - usage=_(' [reason]'), - desc=_('Ban the user with the specified nickname.' - ' You also can give an optional reason.'), + usage=' [reason]', + desc='Ban the user with the specified nickname.' + ' You also can give an optional reason.', shortdesc='Ban someone', completion=self.completion_quoted) self.register_command('role', self.command_role, - usage=_(' [reason]'), - desc=_('Set the role of an user. Roles can be:' - ' none, visitor, participant, moderator.' - ' You also can give an optional reason.'), - shortdesc=_('Set the role of an user.'), + usage=' [reason]', + desc='Set the role of an user. Roles can be:' + ' none, visitor, participant, moderator.' + ' You also can give an optional reason.', + shortdesc='Set the role of an user.', completion=self.completion_role) self.register_command('affiliation', self.command_affiliation, - usage=_(' '), - desc=_('Set the affiliation of an user. Affiliations can be:' - ' outcast, none, member, admin, owner.'), - shortdesc=_('Set the affiliation of an user.'), + usage=' ', + desc='Set the affiliation of an user. Affiliations can be:' + ' outcast, none, member, admin, owner.', + shortdesc='Set the affiliation of an user.', completion=self.completion_affiliation) self.register_command('topic', self.command_topic, - usage=_(''), - desc=_('Change the subject of the room.'), - shortdesc=_('Change the subject.'), + usage='', + desc='Change the subject of the room.', + shortdesc='Change the subject.', completion=self.completion_topic) self.register_command('query', self.command_query, - usage=_(' [message]'), - desc=_('Open a private conversation with . This nick' - ' has to be present in the room you\'re currently in.' - ' If you specified a message after the nickname, it ' - 'will immediately be sent to this user.'), - shortdesc=_('Query an user.'), + usage=' [message]', + desc='Open a private conversation with . This nick' + ' has to be present in the room you\'re currently in.' + ' If you specified a message after the nickname, it ' + 'will immediately be sent to this user.', + shortdesc='Query an user.', completion=self.completion_quoted) self.register_command('part', self.command_part, - usage=_('[message]'), - desc=_('Disconnect from a room. You can' - ' specify an optional message.'), - shortdesc=_('Leave the room.')) + usage='[message]', + desc='Disconnect from a room. You can' + ' specify an optional message.', + shortdesc='Leave the room.') self.register_command('close', self.command_close, - usage=_('[message]'), - desc=_('Disconnect from a room and close the tab.' - ' You can specify an optional message if ' - 'you are still connected.'), - shortdesc=_('Close the tab.')) + usage='[message]', + desc='Disconnect from a room and close the tab.' + ' You can specify an optional message if ' + 'you are still connected.', + shortdesc='Close the tab.') self.register_command('nick', self.command_nick, - usage=_(''), - desc=_('Change your nickname in the current room.'), - shortdesc=_('Change your nickname.'), + usage='', + desc='Change your nickname in the current room.', + shortdesc='Change your nickname.', completion=self.completion_nick) self.register_command('recolor', self.command_recolor, - usage=_('[random]'), - desc=_('Re-assign a color to all participants of the' - ' current room, based on the last time they talked.' - ' Use this if the participants currently talking ' - 'have too many identical colors. Use /recolor random' - ' for a non-deterministic result.'), - shortdesc=_('Change the nicks colors.'), + usage='[random]', + desc='Re-assign a color to all participants of the' + ' current room, based on the last time they talked.' + ' Use this if the participants currently talking ' + 'have too many identical colors. Use /recolor random' + ' for a non-deterministic result.', + shortdesc='Change the nicks colors.', completion=self.completion_recolor) self.register_command('color', self.command_color, - usage=_(' '), - desc=_('Fix a color for a nick. Use "unset" instead of a color' - ' to remove the attribution'), - shortdesc=_('Fix a color for a nick.'), + usage=' ', + desc='Fix a color for a nick. Use "unset" instead of a color' + ' to remove the attribution', + shortdesc='Fix a color for a nick.', completion=self.completion_color) self.register_command('cycle', self.command_cycle, - usage=_('[message]'), - desc=_('Leave the current room and rejoin it immediately.'), - shortdesc=_('Leave and re-join the room.')) + usage='[message]', + desc='Leave the current room and rejoin it immediately.', + shortdesc='Leave and re-join the room.') self.register_command('info', self.command_info, - usage=_(''), - desc=_('Display some information about the user ' - 'in the MUC: its/his/her role, affiliation,' - ' status and status message.'), - shortdesc=_('Show an user\'s infos.'), + usage='', + desc='Display some information about the user ' + 'in the MUC: its/his/her role, affiliation,' + ' status and status message.', + shortdesc='Show an user\'s infos.', completion=self.completion_info) self.register_command('configure', self.command_configure, - desc=_('Configure the current room, through a form.'), - shortdesc=_('Configure the room.')) + desc='Configure the current room, through a form.', + shortdesc='Configure the room.') self.register_command('version', self.command_version, - usage=_(''), - desc=_('Get the software version of the given JID' - ' or nick in room (usually its XMPP client' - ' and Operating System).'), - shortdesc=_('Get the software version of a jid.'), + usage='', + desc='Get the software version of the given JID' + ' or nick in room (usually its XMPP client' + ' and Operating System).', + shortdesc='Get the software version of a jid.', completion=self.completion_version) self.register_command('names', self.command_names, - desc=_('Get the users in the room with their roles.'), - shortdesc=_('List the users.')) + desc='Get the users in the room with their roles.', + shortdesc='List the users.') self.register_command('invite', self.command_invite, - desc=_('Invite a contact to this room'), - usage=_(' [reason]'), - shortdesc=_('Invite a contact to this room'), + desc='Invite a contact to this room', + usage=' [reason]', + shortdesc='Invite a contact to this room', completion=self.completion_invite) if self.core.xmpp.boundjid.server == "gmail.com": #gmail sucks @@ -356,7 +354,7 @@ class MucTab(ChatTab): nick = args[0] user = self.get_user_by_name(nick) if not user: - return self.core.information(_("Unknown user: %s") % nick) + return self.core.information("Unknown user: %s" % nick) theme = get_theme() if user.jid: user_jid = ' (\x19%s}%s\x19o)' % ( @@ -364,8 +362,8 @@ class MucTab(ChatTab): user.jid) else: user_jid = '' - info = _('\x19%s}%s\x19o%s: show: \x19%s}%s\x19o, affiliation:' - ' \x19%s}%s\x19o, role: \x19%s}%s\x19o%s') % ( + info = ('\x19%s}%s\x19o%s: show: \x19%s}%s\x19o, affiliation:' + ' \x19%s}%s\x19o, role: \x19%s}%s\x19o%s') % ( dump_tuple(user.color), nick, user_jid, @@ -387,8 +385,8 @@ class MucTab(ChatTab): def on_form_received(form): if not form: self.core.information( - _('Could not retrieve the configuration form'), - _('Error')) + 'Could not retrieve the configuration form', + 'Error') return self.core.open_new_form(form, self.cancel_config, self.send_config) @@ -433,9 +431,9 @@ class MucTab(ChatTab): continue user.set_deterministic_color() if args[0] == 'random': - self.core.information(_('"random" was provided, but poezio is ' - 'configured to use deterministic colors'), - 'Warning') + self.core.information('"random" was provided, but poezio is ' + 'configured to use deterministic colors', + 'Warning') self.user_win.refresh(self.users) self.input.refresh() return @@ -477,13 +475,13 @@ class MucTab(ChatTab): color = args[1].lower() user = self.get_user_by_name(nick) if not color in xhtml.colors and color not in ('unset', 'random'): - return self.core.information(_("Unknown color: %s") % color, 'Error') + return self.core.information("Unknown color: %s" % color, 'Error') if user and user.nick == self.own_nick: - return self.core.information(_("You cannot change the color of your" - " own nick.", 'Error')) + return self.core.information("You cannot change the color of your" + " own nick.", 'Error') if color == 'unset': if config.remove_and_save(nick, 'muc_colors'): - self.core.information(_('Color for nick %s unset') % (nick)) + self.core.information('Color for nick %s unset' % (nick)) else: if color == 'random': color = random.choice(list(xhtml.colors)) @@ -512,14 +510,14 @@ class MucTab(ChatTab): """ def callback(res): if not res: - return self.core.information(_('Could not get the software ' - 'version from %s') % (jid,), - _('Warning')) - version = _('%s is running %s version %s on %s') % ( + return self.core.information('Could not get the software ' + 'version from %s' % (jid,), + 'Warning') + version = '%s is running %s version %s on %s' % ( jid, - res.get('name') or _('an unknown software'), - res.get('version') or _('unknown'), - res.get('os') or _('an unknown platform')) + res.get('name') or 'an unknown software', + res.get('version') or 'unknown', + res.get('os') or 'an unknown platform') self.core.information(version, 'Info') if args is None: return self.core.command_help('version') @@ -541,8 +539,8 @@ class MucTab(ChatTab): return self.core.command_help('nick') nick = args[0] if not self.joined: - return self.core.information(_('/nick only works in joined rooms'), - _('Info')) + return self.core.information('/nick only works in joined rooms', + 'Info') current_status = self.core.get_status() if not safeJID(self.name + '/' + nick): return self.core.information('Invalid nick', 'Info') @@ -569,24 +567,24 @@ class MucTab(ChatTab): color = 3 if arg: - msg = _('\x19%(color_spec)s}%(spec)s\x19%(info_col)s} ' - 'You (\x19%(color)s}%(nick)s\x19%(info_col)s})' - ' left the chatroom' - ' (\x19o%(reason)s\x19%(info_col)s})') % { - 'info_col': info_col, 'reason': arg, - 'spec': char_quit, 'color': color, - 'color_spec': spec_col, - 'nick': self.own_nick, - } + msg = ('\x19%(color_spec)s}%(spec)s\x19%(info_col)s} ' + 'You (\x19%(color)s}%(nick)s\x19%(info_col)s})' + ' left the chatroom' + ' (\x19o%(reason)s\x19%(info_col)s})') % { + 'info_col': info_col, 'reason': arg, + 'spec': char_quit, 'color': color, + 'color_spec': spec_col, + 'nick': self.own_nick, + } else: - msg = _('\x19%(color_spec)s}%(spec)s\x19%(info_col)s} ' - 'You (\x19%(color)s}%(nick)s\x19%(info_col)s})' - ' left the chatroom') % { - 'info_col': info_col, - 'spec': char_quit, 'color': color, - 'color_spec': spec_col, - 'nick': self.own_nick, - } + msg = ('\x19%(color_spec)s}%(spec)s\x19%(info_col)s} ' + 'You (\x19%(color)s}%(nick)s\x19%(info_col)s})' + ' left the chatroom') % { + 'info_col': info_col, + 'spec': char_quit, 'color': color, + 'color_spec': spec_col, + 'nick': self.own_nick, + } self.add_message(msg, typ=2) self.disconnect() @@ -621,7 +619,7 @@ class MucTab(ChatTab): self.core.current_tab().command_say( xhtml.convert_simple_to_full_colors(msg)) if not r: - self.core.information(_("Cannot find user: %s" % nick), 'Error') + self.core.information("Cannot find user: %s" % nick, 'Error') @command_args_parser.raw def command_topic(self, subject): @@ -630,7 +628,7 @@ class MucTab(ChatTab): """ if not subject: self._text_buffer.add_message( - _("\x19%s}The subject of the room is: %s %s") % + "\x19%s}The subject of the room is: %s %s" % (dump_tuple(get_theme().COLOR_INFORMATION_TEXT), self.topic, '(set by %s)' % self.topic_from if self.topic_from @@ -771,8 +769,8 @@ class MucTab(ChatTab): valid_roles = ('none', 'visitor', 'participant', 'moderator') if not self.joined or role not in valid_roles: - return self.core.information(_('The role must be one of ' + ', '.join(valid_roles)), - _('Error')) + return self.core.information('The role must be one of ' + ', '.join(valid_roles), + 'Error') if not safeJID(self.name + '/' + nick): return self.core.information('Invalid nick', 'Info') @@ -800,8 +798,8 @@ class MucTab(ChatTab): valid_affiliations = ('outcast', 'none', 'member', 'admin', 'owner') if affiliation not in valid_affiliations: - return self.core.information(_('The affiliation must be one of ' + ', '.join(valid_affiliations)), - _('Error')) + return self.core.information('The affiliation must be one of ' + ', '.join(valid_affiliations), + 'Error') if nick in [user.nick for user in self.users]: res = muc.set_user_affiliation(self.core.xmpp, self.name, @@ -812,7 +810,7 @@ class MucTab(ChatTab): affiliation, jid=safeJID(nick), callback=callback) if not res: - self.core.information(_('Could not set affiliation'), _('Error')) + self.core.information('Could not set affiliation', 'Error') @command_args_parser.raw def command_say(self, line, correct=False): @@ -871,12 +869,12 @@ class MucTab(ChatTab): nick = args[0] user = self.get_user_by_name(nick) if not user: - self.core.information(_('%s is not in the room') % nick) + self.core.information('%s is not in the room' % nick) elif user in self.ignores: - self.core.information(_('%s is already ignored') % nick) + self.core.information('%s is already ignored' % nick) else: self.ignores.append(user) - self.core.information(_("%s is now ignored") % nick, 'info') + self.core.information("%s is now ignored" % nick, 'info') @command_args_parser.quoted(1) def command_unignore(self, args): @@ -889,12 +887,12 @@ class MucTab(ChatTab): nick = args[0] user = self.get_user_by_name(nick) if not user: - self.core.information(_('%s is not in the room') % nick) + self.core.information('%s is not in the room' % nick) elif user not in self.ignores: - self.core.information(_('%s is not ignored') % nick) + self.core.information('%s is not ignored' % nick) else: self.ignores.remove(user) - self.core.information(_('%s is now unignored') % nick) + self.core.information('%s is now unignored' % nick) def completion_unignore(self, the_input): if the_input.get_argument_position() == 1: @@ -1118,9 +1116,9 @@ class MucTab(ChatTab): spec_col = dump_tuple(get_theme().COLOR_JOIN_CHAR) self.add_message( - _('\x19%(color_spec)s}%(spec)s\x19%(info_col)s} You ' - '(\x19%(nick_col)s}%(nick)s\x19%(info_col)s}) joined' - ' the chatroom') % + '\x19%(color_spec)s}%(spec)s\x19%(info_col)s} You ' + '(\x19%(nick_col)s}%(nick)s\x19%(info_col)s}) joined' + ' the chatroom' % { 'nick': from_nick, 'spec': get_theme().CHAR_JOIN, @@ -1131,21 +1129,21 @@ class MucTab(ChatTab): typ=2) if '201' in status_codes: self.add_message( - _('\x19%(info_col)s}Info: The room ' - 'has been created') % + '\x19%(info_col)s}Info: The room ' + 'has been created' % {'info_col': info_col}, typ=0) if '170' in status_codes: self.add_message( - _('\x19%(warn_col)s}Warning:\x19%(info_col)s}' - ' This room is publicly logged') % + '\x19%(warn_col)s}Warning:\x19%(info_col)s}' + ' This room is publicly logged' % {'info_col': info_col, 'warn_col': warn_col}, typ=0) if '100' in status_codes: self.add_message( - _('\x19%(warn_col)s}Warning:\x19%(info_col)s}' - ' This room is not anonymous.') % + '\x19%(warn_col)s}Warning:\x19%(info_col)s}' + ' This room is not anonymous.' % {'info_col': info_col, 'warn_col': warn_col}, typ=0) @@ -1205,8 +1203,8 @@ class MucTab(ChatTab): def on_non_member_kicked(self): """We have been kicked because the MUC is members-only""" self.add_message( - _('\x19%(info_col)s}You have been kicked because you ' - 'are not a member and the room is now members-only.') % { + '\x19%(info_col)s}You have been kicked because you ' + 'are not a member and the room is now members-only.' % { 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, typ=2) self.disconnect() @@ -1214,8 +1212,8 @@ class MucTab(ChatTab): def on_muc_shutdown(self): """We have been kicked because the MUC service is shutting down""" self.add_message( - _('\x19%(info_col)s}You have been kicked because the' - ' MUC service is shutting down.') % { + '\x19%(info_col)s}You have been kicked because the' + ' MUC service is shutting down.' % { 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, typ=2) self.disconnect() @@ -1240,17 +1238,17 @@ class MucTab(ChatTab): spec_col = dump_tuple(get_theme().COLOR_JOIN_CHAR) char_join = get_theme().CHAR_JOIN if not jid.full: - msg = _('\x19%(color_spec)s}%(spec)s \x19%(color)s}%(nick)s' - '\x19%(info_col)s} joined the chatroom') % { + msg = ('\x19%(color_spec)s}%(spec)s \x19%(color)s}%(nick)s' + '\x19%(info_col)s} joined the chatroom') % { 'nick': from_nick, 'spec': char_join, 'color': color, 'info_col': info_col, 'color_spec': spec_col, } else: - msg = _('\x19%(color_spec)s}%(spec)s \x19%(color)s}%(nick)s ' - '\x19%(info_col)s}(\x19%(jid_color)s}%(jid)s\x19' - '%(info_col)s}) joined the chatroom') % { + msg = ('\x19%(color_spec)s}%(spec)s \x19%(color)s}%(nick)s ' + '\x19%(info_col)s}(\x19%(jid_color)s}%(jid)s\x19' + '%(info_col)s}) joined the chatroom') % { 'spec': char_join, 'nick': from_nick, 'color':color, 'jid':jid.full, 'info_col': info_col, @@ -1281,8 +1279,8 @@ class MucTab(ChatTab): else: color = 3 info_col = dump_tuple(get_theme().COLOR_INFORMATION_TEXT) - self.add_message(_('\x19%(color)s}%(old)s\x19%(info_col)s} is' - ' now known as \x19%(color)s}%(new)s') % { + self.add_message('\x19%(color)s}%(old)s\x19%(info_col)s} is' + ' now known as \x19%(color)s}%(new)s' % { 'old':from_nick, 'new':new_nick, 'color':color, 'info_col': info_col}, typ=2) @@ -1305,13 +1303,13 @@ class MucTab(ChatTab): if from_nick == self.own_nick: # we are banned if by: - kick_msg = _('\x191}%(spec)s \x193}You\x19%(info_col)s}' - ' have been banned by \x194}%(by)s') % { + kick_msg = ('\x191}%(spec)s \x193}You\x19%(info_col)s}' + ' have been banned by \x194}%(by)s') % { 'spec': char_kick, 'by': by, 'info_col': info_col} else: - kick_msg = _('\x191}%(spec)s \x193}You\x19' - '%(info_col)s} have been banned.') % { + kick_msg = ('\x191}%(spec)s \x193}You\x19' + '%(info_col)s} have been banned.') % { 'spec': char_kick, 'info_col': info_col} self.core.disable_private_tabs(self.name, reason=kick_msg) self.disconnect() @@ -1340,20 +1338,20 @@ class MucTab(ChatTab): color = 3 if by: - kick_msg = _('\x191}%(spec)s \x19%(color)s}' - '%(nick)s\x19%(info_col)s} ' - 'has been banned by \x194}%(by)s') % { + kick_msg = ('\x191}%(spec)s \x19%(color)s}' + '%(nick)s\x19%(info_col)s} ' + 'has been banned by \x194}%(by)s') % { 'spec': char_kick, 'nick': from_nick, 'color': color, 'by': by, 'info_col': info_col} else: - kick_msg = _('\x191}%(spec)s \x19%(color)s}%(nick)s' - '\x19%(info_col)s} has been banned') % { + kick_msg = ('\x191}%(spec)s \x19%(color)s}%(nick)s' + '\x19%(info_col)s} has been banned') % { 'spec': char_kick, 'nick': from_nick, 'color': color, 'info_col': info_col} if reason is not None and reason.text: - kick_msg += _('\x19%(info_col)s} Reason: \x196}' - '%(reason)s\x19%(info_col)s}') % { + kick_msg += ('\x19%(info_col)s} Reason: \x196}' + '%(reason)s\x19%(info_col)s}') % { 'reason': reason.text, 'info_col': info_col} self.add_message(kick_msg, typ=2) @@ -1373,14 +1371,14 @@ class MucTab(ChatTab): by = actor_elem.get('nick') or actor_elem.get('jid') if from_nick == self.own_nick: # we are kicked if by: - kick_msg = _('\x191}%(spec)s \x193}You\x19' - '%(info_col)s} have been kicked' - ' by \x193}%(by)s') % { + kick_msg = ('\x191}%(spec)s \x193}You\x19' + '%(info_col)s} have been kicked' + ' by \x193}%(by)s') % { 'spec': char_kick, 'by': by, 'info_col': info_col} else: - kick_msg = _('\x191}%(spec)s \x193}You\x19%(info_col)s}' - ' have been kicked.') % { + kick_msg = ('\x191}%(spec)s \x193}You\x19%(info_col)s}' + ' have been kicked.') % { 'spec': char_kick, 'info_col': info_col} self.core.disable_private_tabs(self.name, reason=kick_msg) @@ -1409,19 +1407,19 @@ class MucTab(ChatTab): else: color = 3 if by: - kick_msg = _('\x191}%(spec)s \x19%(color)s}%(nick)s' - '\x19%(info_col)s} has been kicked by ' - '\x193}%(by)s') % { + kick_msg = ('\x191}%(spec)s \x19%(color)s}%(nick)s' + '\x19%(info_col)s} has been kicked by ' + '\x193}%(by)s') % { 'spec': char_kick, 'nick':from_nick, 'color':color, 'by':by, 'info_col': info_col} else: - kick_msg = _('\x191}%(spec)s \x19%(color)s}%(nick)s' - '\x19%(info_col)s} has been kicked') % { + kick_msg = ('\x191}%(spec)s \x19%(color)s}%(nick)s' + '\x19%(info_col)s} has been kicked') % { 'spec': char_kick, 'nick': from_nick, 'color':color, 'info_col': info_col} if reason is not None and reason.text: - kick_msg += _('\x19%(info_col)s} Reason: \x196}' - '%(reason)s') % { + kick_msg += ('\x19%(info_col)s} Reason: \x196}' + '%(reason)s') % { 'reason': reason.text, 'info_col': info_col} self.add_message(kick_msg, typ=2) @@ -1450,19 +1448,19 @@ class MucTab(ChatTab): spec_col = dump_tuple(get_theme().COLOR_QUIT_CHAR) if not jid.full: - leave_msg = _('\x19%(color_spec)s}%(spec)s \x19%(color)s}' - '%(nick)s\x19%(info_col)s} has left the ' - 'chatroom') % { + leave_msg = ('\x19%(color_spec)s}%(spec)s \x19%(color)s}' + '%(nick)s\x19%(info_col)s} has left the ' + 'chatroom') % { 'nick':from_nick, 'color':color, 'spec':get_theme().CHAR_QUIT, 'info_col': info_col, 'color_spec': spec_col} else: jid_col = dump_tuple(get_theme().COLOR_MUC_JID) - leave_msg = _('\x19%(color_spec)s}%(spec)s \x19%(color)s}' - '%(nick)s\x19%(info_col)s} (\x19%(jid_col)s}' - '%(jid)s\x19%(info_col)s}) has left the ' - 'chatroom') % { + leave_msg = ('\x19%(color_spec)s}%(spec)s \x19%(color)s}' + '%(nick)s\x19%(info_col)s} (\x19%(jid_col)s}' + '%(jid)s\x19%(info_col)s}) has left the ' + 'chatroom') % { 'spec':get_theme().CHAR_QUIT, 'nick':from_nick, 'color':color, 'jid':jid.full, 'info_col': info_col, @@ -1488,29 +1486,29 @@ class MucTab(ChatTab): else: color = 3 if from_nick == self.own_nick: - msg = _('\x19%(color)s}You\x19%(info_col)s} changed: ') % { - 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT), - 'color': color} + msg = '\x19%(color)s}You\x19%(info_col)s} changed: ' % { + 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT), + 'color': color} else: - msg = _('\x19%(color)s}%(nick)s\x19%(info_col)s} changed: ') % { - 'nick': from_nick, 'color': color, - 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)} + msg = '\x19%(color)s}%(nick)s\x19%(info_col)s} changed: ' % { + 'nick': from_nick, 'color': color, + 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)} if affiliation != user.affiliation: - msg += _('affiliation: %s, ') % affiliation + msg += 'affiliation: %s, ' % affiliation display_message = True if role != user.role: - msg += _('role: %s, ') % role + msg += 'role: %s, ' % role display_message = True if show != user.show and show in SHOW_NAME: - msg += _('show: %s, ') % SHOW_NAME[show] + msg += 'show: %s, ' % SHOW_NAME[show] display_message = True if status != user.status: # if the user sets his status to nothing if status: - msg += _('status: %s, ') % status + msg += 'status: %s, ' % status display_message = True elif show in SHOW_NAME and show == user.show: - msg += _('show: %s, ') % SHOW_NAME[show] + msg += 'show: %s, ' % SHOW_NAME[show] display_message = True if not display_message: return @@ -1561,8 +1559,8 @@ class MucTab(ChatTab): """ if time is None and self.joined: # don't log the history messages if not logger.log_message(self.name, nickname, txt, typ=typ): - self.core.information(_('Unable to write in the log file'), - _('Error')) + self.core.information('Unable to write in the log file', + 'Error') def do_highlight(self, txt, time, nickname): """ diff --git a/src/tabs/privatetab.py b/src/tabs/privatetab.py index a79d4961..a715a922 100644 --- a/src/tabs/privatetab.py +++ b/src/tabs/privatetab.py @@ -10,8 +10,6 @@ both participant’s nicks. It also has slightly different features than the ConversationTab (such as tab-completion on nicks from the room). """ -from gettext import gettext as _ - import logging log = logging.getLogger(__name__) @@ -49,15 +47,15 @@ class PrivateTab(OneToOneTab): self.key_func['^I'] = self.completion # commands self.register_command('info', self.command_info, - desc=_('Display some information about the user in the MUC: its/his/her role, affiliation, status and status message.'), - shortdesc=_('Info about the user.')) + desc='Display some information about the user in the MUC: its/his/her role, affiliation, status and status message.', + shortdesc='Info about the user.') self.register_command('unquery', self.command_unquery, - shortdesc=_('Close the tab.')) + shortdesc='Close the tab.') self.register_command('close', self.command_unquery, - shortdesc=_('Close the tab.')) + shortdesc='Close the tab.') self.register_command('version', self.command_version, - desc=_('Get the software version of the current interlocutor (usually its XMPP client and Operating System).'), - shortdesc=_('Get the software version of a jid.')) + desc='Get the software version of the current interlocutor (usually its XMPP client and Operating System).', + shortdesc='Get the software version of a jid.') self.resize() self.parent_muc = self.core.get_tab_by_name(safeJID(name).bare, MucTab) self.on = True @@ -95,7 +93,7 @@ class PrivateTab(OneToOneTab): Log the messages in the archives. """ if not logger.log_message(self.name, nickname, txt, date=time, typ=typ): - self.core.information(_('Unable to write in the log file'), 'Error') + self.core.information('Unable to write in the log file', 'Error') def on_close(self): self.parent_muc.privates.remove(self) @@ -201,9 +199,9 @@ class PrivateTab(OneToOneTab): if not res: return self.core.information('Could not get the software version from %s' % (jid,), 'Warning') version = '%s is running %s version %s on %s' % (jid, - res.get('name') or _('an unknown software'), - res.get('version') or _('unknown'), - res.get('os') or _('an unknown platform')) + res.get('name') or 'an unknown software', + res.get('version') or 'unknown', + res.get('os') or 'an unknown platform') self.core.information(version, 'Info') if args: return self.core.command_version(args[0]) @@ -325,9 +323,9 @@ class PrivateTab(OneToOneTab): """ self.deactivate() if not status_message: - self.add_message(_('\x191}%(spec)s \x193}%(nick)s\x19%(info_col)s} has left the room') % {'nick':from_nick, 'spec':get_theme().CHAR_QUIT, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, typ=2) + self.add_message('\x191}%(spec)s \x193}%(nick)s\x19%(info_col)s} has left the room' % {'nick':from_nick, 'spec':get_theme().CHAR_QUIT, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, typ=2) else: - self.add_message(_('\x191}%(spec)s \x193}%(nick)s\x19%(info_col)s} has left the room (%(status)s)"') % {'nick':from_nick, 'spec':get_theme().CHAR_QUIT, 'status': status_message, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, typ=2) + self.add_message('\x191}%(spec)s \x193}%(nick)s\x19%(info_col)s} has left the room (%(status)s)"' % {'nick':from_nick, 'spec':get_theme().CHAR_QUIT, 'status': status_message, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, typ=2) return self.core.current_tab() is self @refresh_wrapper.conditional diff --git a/src/tabs/rostertab.py b/src/tabs/rostertab.py index 349058a3..aaff7de3 100644 --- a/src/tabs/rostertab.py +++ b/src/tabs/rostertab.py @@ -5,8 +5,6 @@ rectangle shows the current contact info. This module also includes functions to match users in the roster. """ -from gettext import gettext as _ - import logging log = logging.getLogger(__name__) @@ -68,80 +66,80 @@ class RosterInfoTab(Tab): self.key_func["S"] = self.start_search_slow self.key_func["n"] = self.change_contact_name self.register_command('deny', self.command_deny, - usage=_('[jid]'), - desc=_('Deny your presence to the provided JID (or the ' - 'selected contact in your roster), who is asking' - 'you to be in his/here roster.'), - shortdesc=_('Deny an user your presence.'), + usage='[jid]', + desc='Deny your presence to the provided JID (or the ' + 'selected contact in your roster), who is asking' + 'you to be in his/here roster.', + shortdesc='Deny an user your presence.', completion=self.completion_deny) self.register_command('accept', self.command_accept, - usage=_('[jid]'), - desc=_('Allow the provided JID (or the selected contact ' - 'in your roster), to see your presence.'), - shortdesc=_('Allow an user your presence.'), + usage='[jid]', + desc='Allow the provided JID (or the selected contact ' + 'in your roster), to see your presence.', + shortdesc='Allow an user your presence.', completion=self.completion_deny) self.register_command('add', self.command_add, - usage=_(''), - desc=_('Add the specified JID to your roster, ask him to' - ' allow you to see his presence, and allow him to' - ' see your presence.'), - shortdesc=_('Add an user to your roster.')) + usage='', + desc='Add the specified JID to your roster, ask him to' + ' allow you to see his presence, and allow him to' + ' see your presence.', + shortdesc='Add an user to your roster.') self.register_command('name', self.command_name, - usage=_(' [name]'), - shortdesc=_('Set the given JID\'s name.'), + usage=' [name]', + shortdesc='Set the given JID\'s name.', completion=self.completion_name) self.register_command('groupadd', self.command_groupadd, - usage=_(' '), - desc=_('Add the given JID to the given group.'), - shortdesc=_('Add an user to a group'), + usage=' ', + desc='Add the given JID to the given group.', + shortdesc='Add an user to a group', completion=self.completion_groupadd) self.register_command('groupmove', self.command_groupmove, - usage=_(' '), - desc=_('Move the given JID from the old group to the new group.'), - shortdesc=_('Move an user to another group.'), + usage=' ', + desc='Move the given JID from the old group to the new group.', + shortdesc='Move an user to another group.', completion=self.completion_groupmove) self.register_command('groupremove', self.command_groupremove, - usage=_(' '), - desc=_('Remove the given JID from the given group.'), - shortdesc=_('Remove an user from a group.'), + usage=' ', + desc='Remove the given JID from the given group.', + shortdesc='Remove an user from a group.', completion=self.completion_groupremove) self.register_command('remove', self.command_remove, - usage=_('[jid]'), - desc=_('Remove the specified JID from your roster. This ' - 'will unsubscribe you from its presence, cancel ' - 'its subscription to yours, and remove the item ' - 'from your roster.'), - shortdesc=_('Remove an user from your roster.'), + usage='[jid]', + desc='Remove the specified JID from your roster. This ' + 'will unsubscribe you from its presence, cancel ' + 'its subscription to yours, and remove the item ' + 'from your roster.', + shortdesc='Remove an user from your roster.', completion=self.completion_remove) self.register_command('export', self.command_export, - usage=_('[/path/to/file]'), - desc=_('Export your contacts into /path/to/file if ' - 'specified, or $HOME/poezio_contacts if not.'), - shortdesc=_('Export your roster to a file.'), + usage='[/path/to/file]', + desc='Export your contacts into /path/to/file if ' + 'specified, or $HOME/poezio_contacts if not.', + shortdesc='Export your roster to a file.', completion=partial(self.completion_file, 1)) self.register_command('import', self.command_import, - usage=_('[/path/to/file]'), - desc=_('Import your contacts from /path/to/file if ' - 'specified, or $HOME/poezio_contacts if not.'), - shortdesc=_('Import your roster from a file.'), + usage='[/path/to/file]', + desc='Import your contacts from /path/to/file if ' + 'specified, or $HOME/poezio_contacts if not.', + shortdesc='Import your roster from a file.', completion=partial(self.completion_file, 1)) self.register_command('password', self.command_password, usage='', - shortdesc=_('Change your password')) + shortdesc='Change your password') self.register_command('reconnect', self.command_reconnect, - desc=_('Disconnect from the remote server if you are ' - 'currently connected and then connect to it again.'), - shortdesc=_('Disconnect and reconnect to the server.')) + desc='Disconnect from the remote server if you are ' + 'currently connected and then connect to it again.', + shortdesc='Disconnect and reconnect to the server.') self.register_command('disconnect', self.command_disconnect, - desc=_('Disconnect from the remote server.'), - shortdesc=_('Disconnect from the server.')) + desc='Disconnect from the remote server.', + shortdesc='Disconnect from the server.') self.register_command('clear', self.command_clear, - shortdesc=_('Clear the info buffer.')) + shortdesc='Clear the info buffer.') self.register_command('last_activity', self.command_last_activity, - usage=_(''), - desc=_('Informs you of the last activity of a JID.'), - shortdesc=_('Get the activity of someone.'), + usage='', + desc='Informs you of the last activity of a JID.', + shortdesc='Get the activity of someone.', completion=self.core.completion_last_activity) self.resize() @@ -151,51 +149,51 @@ class RosterInfoTab(Tab): def check_blocking(self, features): if 'urn:xmpp:blocking' in features and not self.core.xmpp.anon: self.register_command('block', self.command_block, - usage=_('[jid]'), - shortdesc=_('Prevent a JID from talking to you.'), + usage='[jid]', + shortdesc='Prevent a JID from talking to you.', completion=self.completion_block) self.register_command('unblock', self.command_unblock, - usage=_('[jid]'), - shortdesc=_('Allow a JID to talk to you.'), + usage='[jid]', + shortdesc='Allow a JID to talk to you.', completion=self.completion_unblock) self.register_command('list_blocks', self.command_list_blocks, - shortdesc=_('Show the blocked contacts.')) + shortdesc='Show the blocked contacts.') self.core.xmpp.del_event_handler('session_start', self.check_blocking) self.core.xmpp.add_event_handler('blocked_message', self.on_blocked_message) def check_saslexternal(self, features): if 'urn:xmpp:saslcert:1' in features and not self.core.xmpp.anon: self.register_command('certs', self.command_certs, - desc=_('List the fingerprints of certificates' - ' which can connect to your account.'), - shortdesc=_('List allowed client certs.')) + desc='List the fingerprints of certificates' + ' which can connect to your account.', + shortdesc='List allowed client certs.') self.register_command('cert_add', self.command_cert_add, - desc=_('Add a client certificate to the authorized ones. ' - 'It must have an unique name and be contained in ' - 'a PEM file. [management] is a boolean indicating' - ' if a client connected using this certificate can' - ' manage the certificates itself.'), - shortdesc=_('Add a client certificate.'), + desc='Add a client certificate to the authorized ones. ' + 'It must have an unique name and be contained in ' + 'a PEM file. [management] is a boolean indicating' + ' if a client connected using this certificate can' + ' manage the certificates itself.', + shortdesc='Add a client certificate.', usage=' [management]', completion=self.completion_cert_add) self.register_command('cert_disable', self.command_cert_disable, - desc=_('Remove a certificate from the list ' - 'of allowed ones. Clients currently ' - 'using this certificate will not be ' - 'forcefully disconnected.'), - shortdesc=_('Disable a certificate'), + desc='Remove a certificate from the list ' + 'of allowed ones. Clients currently ' + 'using this certificate will not be ' + 'forcefully disconnected.', + shortdesc='Disable a certificate', usage='') self.register_command('cert_revoke', self.command_cert_revoke, - desc=_('Remove a certificate from the list ' - 'of allowed ones. Clients currently ' - 'using this certificate will be ' - 'forcefully disconnected.'), - shortdesc=_('Revoke a certificate'), + desc='Remove a certificate from the list ' + 'of allowed ones. Clients currently ' + 'using this certificate will be ' + 'forcefully disconnected.', + shortdesc='Revoke a certificate', usage='') self.register_command('cert_fetch', self.command_cert_fetch, - desc=_('Retrieve a certificate with its ' - 'name. It will be stored in .'), - shortdesc=_('Fetch a certificate'), + desc='Retrieve a certificate with its ' + 'name. It will be stored in .', + shortdesc='Fetch a certificate', usage=' ', completion=self.completion_cert_fetch) @@ -206,8 +204,8 @@ class RosterInfoTab(Tab): """ def cb(iq): if iq['type'] == 'error': - self.core.information(_('Unable to retrieve the certificate list.'), - _('Error')) + self.core.information('Unable to retrieve the certificate list.', + 'Error') return certs = [] for item in iq['sasl_certs']['items']: @@ -215,8 +213,8 @@ class RosterInfoTab(Tab): certs.append((item['name'], users)) if not certs: - return self.core.information(_('No certificates found'), _('Info')) - msg = _('Certificates:\n') + return self.core.information('No certificates found', 'Info') + msg = 'Certificates:\n' msg += '\n'.join(((' %s%s' % (item[0] + (': ' if item[1] else ''), item[1])) for item in certs)) self.core.information(msg, 'Info') @@ -231,9 +229,9 @@ class RosterInfoTab(Tab): return self.core.command_help('cert_add') def cb(iq): if iq['type'] == 'error': - self.core.information(_('Unable to add the certificate.'), _('Error')) + self.core.information('Unable to add the certificate.', 'Error') else: - self.core.information(_('Certificate added.'), _('Info')) + self.core.information('Certificate added.', 'Info') name = args[0] @@ -285,9 +283,9 @@ class RosterInfoTab(Tab): return self.core.command_help('cert_disable') def cb(iq): if iq['type'] == 'error': - self.core.information(_('Unable to disable the certificate.'), _('Error')) + self.core.information('Unable to disable the certificate.', 'Error') else: - self.core.information(_('Certificate disabled.'), _('Info')) + self.core.information('Certificate disabled.', 'Info') name = args[0] @@ -302,9 +300,9 @@ class RosterInfoTab(Tab): return self.core.command_help('cert_revoke') def cb(iq): if iq['type'] == 'error': - self.core.information(_('Unable to revoke the certificate.'), _('Error')) + self.core.information('Unable to revoke the certificate.', 'Error') else: - self.core.information(_('Certificate revoked.'), _('Info')) + self.core.information('Certificate revoked.', 'Info') name = args[0] @@ -320,8 +318,8 @@ class RosterInfoTab(Tab): return self.core.command_help('cert_fetch') def cb(iq): if iq['type'] == 'error': - self.core.information(_('Unable to fetch the certificate.'), - _('Error')) + self.core.information('Unable to fetch the certificate.', + 'Error') return cert = None @@ -331,13 +329,13 @@ class RosterInfoTab(Tab): break if not cert: - return self.core.information(_('Certificate not found.'), _('Info')) + return self.core.information('Certificate not found.', 'Info') cert = ssl.DER_cert_to_PEM_cert(cert) with open(path, 'w') as fd: fd.write(cert) - self.core.information(_('File stored at %s') % path, 'Info') + self.core.information('File stored at %s' % path, 'Info') name = args[0] path = args[1] @@ -623,7 +621,7 @@ class RosterInfoTab(Tab): """ jid = safeJID(safeJID(args[0]).bare) if not jid: - self.core.information(_('No JID specified'), 'Error') + self.core.information('No JID specified', 'Error') return if jid in roster and roster[jid].subscription in ('to', 'both'): return self.core.information('Already subscribed.', 'Roster') @@ -647,7 +645,7 @@ class RosterInfoTab(Tab): contact = roster[jid] if contact is None: - self.core.information(_('No such JID in roster'), 'Error') + self.core.information('No such JID in roster', 'Error') return groups = set(contact.groups) @@ -669,12 +667,12 @@ class RosterInfoTab(Tab): contact = roster[jid] if contact is None: - self.core.information(_('No such JID in roster'), 'Error') + self.core.information('No such JID in roster', 'Error') return new_groups = set(contact.groups) if group in new_groups: - self.core.information(_('JID already in group'), 'Error') + self.core.information('JID already in group', 'Error') return roster.modified() @@ -710,7 +708,7 @@ class RosterInfoTab(Tab): contact = roster[jid] if not contact: - self.core.information(_('No such JID in roster'), 'Error') + self.core.information('No such JID in roster', 'Error') return new_groups = set(contact.groups) @@ -718,19 +716,19 @@ class RosterInfoTab(Tab): new_groups.remove('none') if group_to == 'none' or group_from == 'none': - self.core.information(_('"none" is not a group.'), 'Error') + self.core.information('"none" is not a group.', 'Error') return if group_from not in new_groups: - self.core.information(_('JID not in first group'), 'Error') + self.core.information('JID not in first group', 'Error') return if group_to in new_groups: - self.core.information(_('JID already in second group'), 'Error') + self.core.information('JID already in second group', 'Error') return if group_to == group_from: - self.core.information(_('The groups are the same.'), 'Error') + self.core.information('The groups are the same.', 'Error') return roster.modified() @@ -765,7 +763,7 @@ class RosterInfoTab(Tab): contact = roster[jid] if contact is None: - self.core.information(_('No such JID in roster'), 'Error') + self.core.information('No such JID in roster', 'Error') return new_groups = set(contact.groups) @@ -774,7 +772,7 @@ class RosterInfoTab(Tab): except KeyError: pass if group not in new_groups: - self.core.information(_('JID not in group'), 'Error') + self.core.information('JID not in group', 'Error') return roster.modified() @@ -1005,7 +1003,7 @@ class RosterInfoTab(Tab): success = config.silent_set(option, str(not value)) roster.modified() if not success: - self.core.information(_('Unable to write in the config file'), 'Error') + self.core.information('Unable to write in the config file', 'Error') return True def on_slash(self): diff --git a/src/tabs/xmltab.py b/src/tabs/xmltab.py index d6bdf35d..6899cd6f 100644 --- a/src/tabs/xmltab.py +++ b/src/tabs/xmltab.py @@ -5,8 +5,6 @@ in order to only show the relevant ones, and it can also be frozen or unfrozen on demand so that the relevant information is not drowned by the traffic. """ -from gettext import gettext as _ - import logging log = logging.getLogger(__name__) @@ -71,40 +69,40 @@ class XMLTab(Tab): self.default_help_message = windows.HelpText("/ to enter a command") self.register_command('close', self.close, - shortdesc=_("Close this tab.")) + shortdesc="Close this tab.") self.register_command('clear', self.command_clear, - shortdesc=_('Clear the current buffer.')) + shortdesc='Clear the current buffer.') self.register_command('reset', self.command_reset, - shortdesc=_('Reset the stanza filter.')) + shortdesc='Reset the stanza filter.') self.register_command('filter_id', self.command_filter_id, usage='', - desc=_('Show only the stanzas with the id .'), - shortdesc=_('Filter by id.')) + desc='Show only the stanzas with the id .', + shortdesc='Filter by id.') self.register_command('filter_xpath', self.command_filter_xpath, usage='', - desc=_('Show only the stanzas matching the xpath .' - ' Any occurrences of %n will be replaced by jabber:client.'), - shortdesc=_('Filter by XPath.')) + desc='Show only the stanzas matching the xpath .' + ' Any occurrences of %n will be replaced by jabber:client.', + shortdesc='Filter by XPath.') self.register_command('filter_jid', self.command_filter_jid, usage='', - desc=_('Show only the stanzas matching the jid in from= or to=.'), - shortdesc=_('Filter by JID.')) + desc='Show only the stanzas matching the jid in from= or to=.', + shortdesc='Filter by JID.') self.register_command('filter_from', self.command_filter_from, usage='', - desc=_('Show only the stanzas matching the jid in from=.'), - shortdesc=_('Filter by JID from.')) + desc='Show only the stanzas matching the jid in from=.', + shortdesc='Filter by JID from.') self.register_command('filter_to', self.command_filter_to, usage='', - desc=_('Show only the stanzas matching the jid in to=.'), - shortdesc=_('Filter by JID to.')) + desc='Show only the stanzas matching the jid in to=.', + shortdesc='Filter by JID to.') self.register_command('filter_xmlmask', self.command_filter_xmlmask, - usage=_(''), - desc=_('Show only the stanzas matching the given xml mask.'), - shortdesc=_('Filter by xml mask.')) + usage='', + desc='Show only the stanzas matching the given xml mask.', + shortdesc='Filter by xml mask.') self.register_command('dump', self.command_dump, - usage=_(''), - desc=_('Writes the content of the XML buffer into a file.'), - shortdesc=_('Write in a file.')) + usage='', + desc='Writes the content of the XML buffer into a file.', + shortdesc='Write in a file.') self.input = self.default_help_message self.key_func['^T'] = self.close self.key_func['^I'] = self.completion -- cgit v1.2.3