comparison gamelib/scenes/crew_quarters.py @ 765:2f1952748cdb i18n

merge i18n and Russian translation
author Stefano Rivera <stefano@rivera.za.net>
date Tue, 08 Mar 2011 14:37:43 +0200
parents 0ce08d5e2acb a9925aaf5f61
children 43b49f1de828
comparison
equal deleted inserted replaced
528:0ce08d5e2acb 765:2f1952748cdb
5 from gamelib.scenewidgets import (InteractNoImage, InteractImage, 5 from gamelib.scenewidgets import (InteractNoImage, InteractImage,
6 InteractAnimated, GenericDescThing) 6 InteractAnimated, GenericDescThing)
7 7
8 from gamelib.scenes.game_constants import PLAYER_ID 8 from gamelib.scenes.game_constants import PLAYER_ID
9 from gamelib.scenes.game_widgets import Door, BaseCamera, make_jim_dialog 9 from gamelib.scenes.game_widgets import Door, BaseCamera, make_jim_dialog
10
11 from gamelib.i18n import _
10 12
11 class CrewQuarters(Scene): 13 class CrewQuarters(Scene):
12 14
13 FOLDER = "crew_quarters" 15 FOLDER = "crew_quarters"
14 BACKGROUND = "crew_quarters.png" 16 BACKGROUND = "crew_quarters.png"
24 self.add_item(DuctTape('duct_tape')) 26 self.add_item(DuctTape('duct_tape'))
25 self.add_item(EscherPoster('escher_poster')) 27 self.add_item(EscherPoster('escher_poster'))
26 self.add_thing(PosterThing()) 28 self.add_thing(PosterThing())
27 self.add_thing(MonitorCamera()) 29 self.add_thing(MonitorCamera())
28 self.add_thing(GenericDescThing('crew.plant', 1, 30 self.add_thing(GenericDescThing('crew.plant', 1,
29 "The plant is doing surprisingly well for centuries of neglect", 31 _("The plant is doing surprisingly well for centuries of neglect"),
30 ((624, 215, 61, 108),))) 32 ((624, 215, 61, 108),)))
31 self.add_thing(GenericDescThing('crew.cat', 2, 33 self.add_thing(GenericDescThing('crew.cat', 2,
32 "A picture of a cat labelled 'Clementine'", 34 _("A picture of a cat labelled 'Clementine'"),
33 ((722, 382, 66, 72),))) 35 ((722, 382, 66, 72),)))
34 36
35 37
36 class ToMap(Door): 38 class ToMap(Door):
37 39
66 if self.get_data('is_cracked'): 68 if self.get_data('is_cracked'):
67 if self.get_data('has_tape'): 69 if self.get_data('has_tape'):
68 self.set_data('has_tape', False) 70 self.set_data('has_tape', False)
69 self.state.add_inventory_item('duct_tape') 71 self.state.add_inventory_item('duct_tape')
70 self.set_interact('empty_safe') 72 self.set_interact('empty_safe')
71 return Result("Duct tape. It'll stick to everything except " 73 return Result(_("Duct tape. It'll stick to everything except "
72 "ducts, apparently.") 74 "ducts, apparently."))
73 return Result("The perfectly balanced door swings frictionlessly " 75 return Result(_("The perfectly balanced door swings frictionlessly "
74 "to and fro. What craftsmanship!") 76 "to and fro. What craftsmanship!"))
75 return Result("The safe is locked. This might be an interesting " 77 return Result(_("The safe is locked. This might be an interesting "
76 "challenge, if suitable equipment can be found.") 78 "challenge, if suitable equipment can be found."))
77 79
78 def interact_with_stethoscope(self, item): 80 def interact_with_stethoscope(self, item):
79 if self.get_data('is_cracked'): 81 if self.get_data('is_cracked'):
80 return Result("It's already unlocked. There's no more challenge.") 82 return Result(_("It's already unlocked. There's no more challenge."))
81 # TODO: Add years to the sentence for safecracking. 83 # TODO: Add years to the sentence for safecracking.
82 # TODO: Wax lyrical some more about safecracking. 84 # TODO: Wax lyrical some more about safecracking.
83 self.set_data('is_cracked', True) 85 self.set_data('is_cracked', True)
84 self.set_interact('full_safe') 86 self.set_interact('full_safe')
85 return (Result("Even after centuries of neglect, the tumblers slide" 87 return (Result(_("Even after centuries of neglect, the tumblers slide"
86 " almost silently into place. Turns out the combination" 88 " almost silently into place. Turns out the combination"
87 " was '1 2 3 4 5'. An idiot must keep his luggage in" 89 " was '1 2 3 4 5'. An idiot must keep his luggage in"
88 " here."), 90 " here.")),
89 make_jim_dialog("Prisoner %s, you have been observed committing a felony violation. " 91 make_jim_dialog(_("Prisoner %s, you have been observed committing a felony violation. "
90 "This will go onto your permanent record, and your sentence may be extended by up to twenty years." 92 "This will go onto your permanent record, and your sentence may be extended by up to twenty years.")
91 % PLAYER_ID, self.state)) 93 % PLAYER_ID, self.state))
92 94
93 def get_description(self): 95 def get_description(self):
94 return "Ah, a vintage Knoxx & Co. model QR3. Quaint, but reasonably secure." 96 return _("Ah, a vintage Knoxx & Co. model QR3. Quaint, but reasonably secure.")
95 97
96 98
97 class FishbowlThing(Thing): 99 class FishbowlThing(Thing):
98 "A safe, for keeping things safe." 100 "A safe, for keeping things safe."
99 101
110 'has_bowl': True, 112 'has_bowl': True,
111 } 113 }
112 114
113 def interact_without(self): 115 def interact_without(self):
114 if not self.get_data('has_bowl'): 116 if not self.get_data('has_bowl'):
115 return Result("What's the point of lugging around a very dead fish " 117 return Result(_("What's the point of lugging around a very dead fish "
116 "and a kilogram or so of sand?") 118 "and a kilogram or so of sand?"))
117 self.set_interact('fish_no_bowl') 119 self.set_interact('fish_no_bowl')
118 self.set_data('has_bowl', False) 120 self.set_data('has_bowl', False)
119 self.state.add_inventory_item('fishbowl') 121 self.state.add_inventory_item('fishbowl')
120 return Result("The fishbowl is useful, but its contents aren't.") 122 return Result(_("The fishbowl is useful, but its contents aren't."))
121 123
122 def get_description(self): 124 def get_description(self):
123 if self.get_data('has_bowl'): 125 if self.get_data('has_bowl'):
124 return "This fishbowl looks exactly like an old science fiction space helmet." 126 return _("This fishbowl looks exactly like an old science fiction space helmet.")
125 else: 127 else:
126 return "An evicted dead fish and some sand lie forlornly on the table" 128 return _("An evicted dead fish and some sand lie forlornly on the table")
129
127 130
128 class Fishbowl(Item): 131 class Fishbowl(Item):
129 "A bowl. Sans fish." 132 "A bowl. Sans fish."
130 133
131 INVENTORY_IMAGE = 'fishbowl.png' 134 INVENTORY_IMAGE = 'fishbowl.png'
134 137
135 def interact_with_duct_tape(self, item): 138 def interact_with_duct_tape(self, item):
136 helmet = FishbowlHelmet('helmet') 139 helmet = FishbowlHelmet('helmet')
137 self.state.add_item(helmet) 140 self.state.add_item(helmet)
138 self.state.replace_inventory_item(self.name, helmet.name) 141 self.state.replace_inventory_item(self.name, helmet.name)
139 return Result("You duct tape the edges of the helmet. The seal is" 142 return Result(_("You duct tape the edges of the helmet. The seal is"
140 " crude, but it will serve as a workable helmet if needed.") 143 " crude, but it will serve as a workable helmet if needed."))
141 144
142 145
143 class FishbowlHelmet(Item): 146 class FishbowlHelmet(Item):
144 "A bowl with duct-tape" 147 "A bowl with duct-tape"
145 148
181 INITIAL = 'poster' 184 INITIAL = 'poster'
182 185
183 def interact_without(self): 186 def interact_without(self):
184 self.state.add_inventory_item('escher_poster') 187 self.state.add_inventory_item('escher_poster')
185 self.scene.remove_thing(self) 188 self.scene.remove_thing(self)
186 return Result("This poster will go nicely on your bedroom wall.") 189 return Result(_("This poster will go nicely on your bedroom wall."))
187 190
188 def get_description(self): 191 def get_description(self):
189 return "A paradoxical poster hangs below the security camera." 192 return _("A paradoxical poster hangs below the security camera.")
190 193
191 194
192 class EscherPoster(Item): 195 class EscherPoster(Item):
193 "A confusing poster to disable JIM" 196 "A confusing poster to disable JIM"
194 197