Translate activity in tooltips.

This commit is contained in:
js 2008-07-29 02:14:06 +00:00
parent 6dfa9c7e35
commit d3b86d2105
2 changed files with 16 additions and 6 deletions

View File

@ -1211,9 +1211,9 @@ class ChatControl(ChatControlBase):
return return
if self.contact.mood.has_key('mood'): if self.contact.mood.has_key('mood'):
mood = self.contact.mood['mood'] mood = self.contact.mood['mood'].strip()
if self.contact.mood.has_key('text'): if self.contact.mood.has_key('text'):
text = self.contact.mood['text'] text = self.contact.mood['text'].strip()
if mood is not None: if mood is not None:
if mood in MOODS: if mood in MOODS:
@ -1251,11 +1251,12 @@ class ChatControl(ChatControlBase):
return return
if self.contact.activity.has_key('activity'): if self.contact.activity.has_key('activity'):
activity = self.contact.activity['activity'] activity = self.contact.activity['activity'].strip()
if self.contact.activity.has_key('subactivity'): if self.contact.activity.has_key('subactivity'):
subactivity = self.contact.activity['subactivity'] subactivity = \
self.contact.activity['subactivity'].strip()
if self.contact.activity.has_key('text'): if self.contact.activity.has_key('text'):
text = self.contact.activity['text'] text = self.contact.activity['text'].strip()
if activity is not None: if activity is not None:
if activity in ACTIVITIES: if activity in ACTIVITIES:

View File

@ -31,6 +31,7 @@ import gtkgui_helpers
from common import gajim from common import gajim
from common import helpers from common import helpers
from common.pep import ACTIVITIES
class BaseTooltip: class BaseTooltip:
''' Base Tooltip class; ''' Base Tooltip class;
@ -585,12 +586,20 @@ class RosterTooltip(NotificationAreaTooltip):
properties.append((mood_string, None)) properties.append((mood_string, None))
if contact.activity.has_key('activity'): if contact.activity.has_key('activity'):
activity = contact.activity['activity'].strip() activity = act_plain = \
contact.activity['activity'].strip()
activity = gobject.markup_escape_text(activity) activity = gobject.markup_escape_text(activity)
activity = ACTIVITIES[activity]['category'] \
if act_plain in ACTIVITIES else activity
activity_string = _('Activity:') + ' <b>%s' % activity activity_string = _('Activity:') + ' <b>%s' % activity
if contact.activity.has_key('subactivity'): if contact.activity.has_key('subactivity'):
activity_sub = \ activity_sub = \
contact.activity['subactivity'].strip() contact.activity['subactivity'].strip()
activity_sub = \
ACTIVITIES[act_plain][activity_sub] \
if act_plain in ACTIVITIES and \
activity_sub in ACTIVITIES[act_plain] \
else activity_sub
activity_sub = \ activity_sub = \
gobject.markup_escape_text(activity_sub) gobject.markup_escape_text(activity_sub)
activity_string += ' (%s)</b>' % activity_sub activity_string += ' (%s)</b>' % activity_sub