Add get_uf_* functions to make mood and activity translatable.

This commit is contained in:
Stephan Erb 2008-04-07 11:14:23 +00:00
parent da966efaa7
commit 855a72855d
1 changed files with 73 additions and 1 deletions

View File

@ -330,7 +330,79 @@ def get_uf_affiliation(affiliation):
affiliation_name = affiliation.capitalize()
return affiliation_name
def get_uf_mood(mood):
'''returns a userfriendly mood string and makes all strings translatable'''
moods = {'afraid':_('afraid'), 'amazed':_('amazed'), 'angry':_('angry'),
'annoyed':_('annoyed'), 'anxious':_('anxious'), 'aroused':_('aroused'),
'ashamed':_('ashamed'), 'bored':_('bored'), 'brave':_('brave'),
'calm':_('calm'), 'cold':_('cold'), 'confused':_('confused'),
'contented':_('contented'), 'cranky':_('cranky'), 'curious':_('curious'),
'depressed':_('depressed'), 'disappointed':_('disappointed'),
'disgusted':_('disgusted'), 'distracted':_('distracted'),
'embarrassed':_('embarrassed'), 'excited':_('excited'),
'flirtatious':_('flirtatious'), 'frustrated':_('frustrated'),
'grumpy':_('grumpy'), 'guilty':_('guilty'), 'happy':_('happy'),
'hot':_('hot'), 'humbled':_('humbled'), 'humiliated':_('humiliated'),
'hungry':_('hungry'), 'hurt':_('hurt'), 'impressed':_('impressed'),
'in_awe':_('in awe'), 'in_love':_('in love'), 'indignant':_('indignant'),
'interested':_('interested'), 'intoxicated':_('intoxicated'),
'invincible':_('invincible'), 'jealous':_('jealous'), 'lonely':_('lonely'),
'mean':_('mean'), 'moody':_('moody'), 'nervous':_('nervous'),
'neutral':_('neutral'), 'offended':_('offended'), 'playful':_('playful'),
'proud':_('proud'), 'relieved':_('relieved'), 'remorseful':_('remorseful'),
'restless':_('restless'), 'sad':_('sad'), 'sarcastic':_('sarcastic'),
'serious':_('serious'), 'shocked':_('shocked'), 'shy':_('shy'),
'sick':_('sick'), 'sleepy':_('sleepy'), 'stressed':_('stressed'),
'surprised':_('surprised'), 'thirsty':_('thirsty'), 'worried':_('worried')}
if moods.has_key(mood):
return moods[mood]
else:
return mood # # Argl! An unknown mood!
def get_uf_activity(activity):
'''returns a userfriendly activity or subactivity string and makes all
strings translatable'''
activities = {
# Activities
'working':_('working'), 'eating':_('eating'),
'excercising':_('excercising'), 'relaxing':_('relaxing'), 'talking':_('talking'),
'doing_chores':_('doing chores'), 'inactive':_('inactive'),
'traveling':_('traveling'), 'having_appointment':_('having an appointment'),
'grooming':_('grooming'), 'drinking':_('drinking'),
# Subactivites
'on_the_phone':_('on the phone'), 'gardening':_('gardening'),
'hiking':_('hiking'), 'on_vacation':_('on vacation'), 'coding': _('coding'),
'walking':_('walking'), 'rehearsing': _('rehearsing'), 'sleeping': _('sleeping'),
'brushing_teeth':_('brushing teeth'), 'playing_sports':_('playing sports'),
'skiing':_('skiing'), 'having_breakfast':_('having breakfast'),
'watching_tv':_('watching TV'), 'doing_the_dishes':_('doing the dishes'),
'at_the_spa':_('at the spa'), 'cycling':_('cycling'),
'hanging_out':_('hanging out'), 'driving':_('driving'), 'commuting':_('commuting'),
'cooking':_('cooking'), 'walking_the_dog':_('walking the dog'),
'writing':_('writing'), 'on_a_trip':_('on a trip'), 'day_off':_('day off'),
'having_tea':_('having tea'), 'on_a_bus':_('on a bus'),
'having_a_beer':_('having a beer'), 'reading':_('reading'),
'buying_groceries':_('buying groceries'), 'shaving':_('shaving'),
'getting_a_haircut':_('getting a haircut'), 'gaming':_('gaming'),
'having_dinner':_('having dinner'), 'doing_maintenance':_('doing maintenance'),
'doing_the_laundry': _('doing the laundry'),
'scheduled_holiday':_('scheduled holiday'), 'going_out':_('going out'),
'partying':_('partying'), 'having_a_snack':_('having a snack'),
'having_lunch':_('having lunch'), 'working_out':_('working out'),
'cleaning':_('cleaning'), 'watching_a_movie':_('watching a movie'),
'sunbathing':_('sunbathing'), 'socializing':_('socializing'),
'running_an_errand':_('running an errand'), 'taking_a_bath':_('taking a bath'),
'in_real_life': _('in real life'), 'on_a_plane': _('on a plane'),
'shopping':_('shopping'), 'on_a_train':_('on a train'), 'running':_('running'),
'taking_a_shower':_('taking a shower'), 'jogging':_('jogging'),
'in_a_meeting': _('in a meeting'), 'in_a_car':_('in a car'),
'studying': _('studying'), 'swimming': _('swimming'), 'other': _('other'),
'having_coffee': _('having coffee')}
if activities.has_key(activity):
return activities[activity]
else:
return activity # # Argl! An unknown activity!
def get_sorted_keys(adict):
keys = adict.keys()
keys.sort()