diff --git a/src/common/helpers.py b/src/common/helpers.py index e83313201..c66b7f026 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -23,7 +23,7 @@ import sre def get_uf_show(show): '''returns a userfriendly string for dnd/xa/chat - and makes the rest translatable''' + and makes all strings translatable''' if show == 'dnd': uf_show = _('Busy') elif show == 'xa': @@ -47,6 +47,30 @@ def get_uf_show(show): else: uf_show = _('Has errors') return unicode(uf_show) + +def get_uf_sub(sub): + if sub == 'none': + uf_sub = _('None') + elif sub == 'to': + uf_sub = _('To') + elif sub == 'from': + uf_sub = _('From') + elif sub == 'both': + uf_sub = _('Both') + else: + uf_sub = sub + + return uf_sub + +def get_uf_ask(ask): + if ask is None: + uf_ask = _('None') + elif ask == 'subscribe': + uf_ask = _('Subscribe') + else: + uf_ask = ask + + return uf_ask def get_sorted_keys(adict): keys = adict.keys() diff --git a/src/vcard.py b/src/vcard.py index 49d70ff02..716a6b810 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -255,12 +255,12 @@ class VcardWindow: def fill_jabber_page(self): self.xml.get_widget('nickname_label').set_text(self.contact.name) self.xml.get_widget('jid_label').set_text(self.contact.jid) - self.xml.get_widget('subscription_label').set_text(self.contact.sub) + uf_sub = helpers.get_uf_sub(self.contact.sub) + self.xml.get_widget('subscription_label').set_text(uf_sub) label = self.xml.get_widget('ask_label') - if self.contact.ask: - label.set_text(self.contact.ask) - else: - label.set_text(_('None')) + + uf_ask = helpers.get_uf_ask(self.contact.ask) + label.set_text(uf_ask) self.xml.get_widget('nickname_entry').set_text(self.contact.name) log = 1 if self.contact.jid in gajim.config.get_per('accounts', self.account,