fix i18n to gc tooltips

This commit is contained in:
Nikos Kouremenos 2005-08-24 14:08:35 +00:00
parent 79bfbfa190
commit a16d8f84e6
3 changed files with 28 additions and 16 deletions

View File

@ -115,6 +115,27 @@ def get_uf_ask(ask):
return unicode(uf_ask) return unicode(uf_ask)
def get_uf_role(role, plural = False)
''' plural determines if you get Moderators or Moderator'''
if role == 'none':
role_name = Q_('?Group Chat Contact Role:None')
elif role == 'moderator':
if plural:
role_name = _('Moderators')
else:
role_name = _('Moderator')
elif role == 'participant':
if plural:
role_name = _('Participants')
else:
role_name = _('Participant')
elif role == 'visitor':
if plural:
role_name = _('Visitors')
else:
role_name = _('Visitor')
return role_name
def get_sorted_keys(adict): def get_sorted_keys(adict):
keys = adict.keys() keys = adict.keys()
keys.sort() keys.sort()

View File

@ -275,14 +275,7 @@ class GroupchatWindow(chat.Chat):
model = self.list_treeview[room_jid].get_model() model = self.list_treeview[room_jid].get_model()
image = self.plugin.roster.jabber_state_images[show] image = self.plugin.roster.jabber_state_images[show]
resource = '' resource = ''
if role == 'none': role_name = helpers.get_uf_role(role, plural = True)
role_name = Q_('?Group Chat Contact Role:None')
elif role == 'moderator':
role_name = _('Moderators')
elif role == 'participant':
role_name = _('Participants')
elif role == 'visitor':
role_name = _('Visitors')
if jid: if jid:
jids = jid.split('/', 1) jids = jid.split('/', 1)
@ -361,7 +354,8 @@ class GroupchatWindow(chat.Chat):
else: else:
iter = self.get_contact_iter(room_jid, nick) iter = self.get_contact_iter(room_jid, nick)
if not iter: if not iter:
iter = self.add_contact_to_roster(room_jid, nick, show, role, jid, affiliation) iter = self.add_contact_to_roster(room_jid, nick, show, role, jid,
affiliation)
else: else:
actual_role = self.get_role(room_jid, nick) actual_role = self.get_role(room_jid, nick)
if role != actual_role: if role != actual_role:

View File

@ -265,10 +265,10 @@ class GCTooltip(BaseTooltip, StatusTable):
info = '<span size="large" weight="bold">' + contact.name + '</span>' info = '<span size="large" weight="bold">' + contact.name + '</span>'
info += '\n<span weight="bold">' + _('Role: ') + '</span>' + \ info += '\n<span weight="bold">' + _('Role: ') + '</span>' + \
gtkgui_helpers.escape_for_pango_markup(contact.role) helpers.get_uf_role(contact.role)
info += '\n<span weight="bold">' + _('Affiliation: ') + '</span>' + \ info += '\n<span weight="bold">' + _('Affiliation: ') + '</span>' + \
gtkgui_helpers.escape_for_pango_markup(contact.affiliation) contact.affiliation.capitalize()
info += '\n<span weight="bold">' + _('Status: ') + \ info += '\n<span weight="bold">' + _('Status: ') + \
'</span>' + helpers.get_uf_show(contact.show) '</span>' + helpers.get_uf_show(contact.show)
@ -276,12 +276,9 @@ class GCTooltip(BaseTooltip, StatusTable):
if contact.status: if contact.status:
status = contact.status.strip() status = contact.status.strip()
if status != '': if status != '':
# escape markup entities. Is it posible to have markup in status? # escape markup entities
info += ' - ' + gtkgui_helpers.escape_for_pango_markup(status) info += ' - ' + gtkgui_helpers.escape_for_pango_markup(status)
#single_line, resource_str, multiple_resource= '', '', False
self.text_lable.set_markup(info) self.text_lable.set_markup(info)
self.hbox.pack_start(self.image, False, False) self.hbox.pack_start(self.image, False, False)
self.hbox.pack_start(self.table, True, True) self.hbox.pack_start(self.table, True, True)