diff gamelib/scenes/bridge.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
line wrap: on
line diff
--- a/gamelib/scenes/bridge.py	Fri Sep 10 18:47:17 2010 +0200
+++ b/gamelib/scenes/bridge.py	Tue Mar 08 14:37:43 2011 +0200
@@ -9,6 +9,7 @@
 from albow.resource import get_image
 
 from gamelib.cursor import CursorSprite
+from gamelib.i18n import _
 from gamelib.state import Scene, Item, Thing, Result
 from gamelib.sound import get_current_playlist
 from gamelib.constants import DEBUG
@@ -59,16 +60,16 @@
         self.add_thing(JimPanel())
         self.add_thing(StarField())
         self.add_thing(GenericDescThing('bridge.wires', 1,
-            "The brightly coloured wires contrast with the drab walls.",
+            _("The brightly coloured wires contrast with the drab walls."),
             ((46, 4, 711, 143),)))
         self.add_thing(GenericDescThing('bridge.note', 2,
-            "\"Dammit JIM, I'm a doctor, not an engineer!\"",
+            _("\"Dammit JIM, I'm a doctor, not an engineer!\""),
             (
                 (491, 494, 194, 105),
                 (422, 533, 71, 66),
                 )))
         self.doctor = GenericDescThing('bridge.skel', 3,
-                "A skeleton hangs improbably from the wires.",
+                _("A skeleton hangs improbably from the wires."),
                 (
                     (632, 148, 40, 29),
                     (683, 176, 30, 101),
@@ -113,13 +114,13 @@
         return Result(detail_view='bridge_comp_detail')
 
     def interact_with_titanium_leg(self, item):
-        return Result("You can't break the duraplastic screen.")
+        return Result(_("You can't break the duraplastic screen."))
 
     def interact_with_machete(self, item):
-        return Result("Scratching the screen won't help you.")
+        return Result(_("Scratching the screen won't help you."))
 
     def get_description(self):
-        return "The main bridge computer screen."
+        return _("The main bridge computer screen.")
 
 
 class MassageChairBase(Thing):
@@ -142,9 +143,9 @@
 
     def get_description(self):
         if self.get_data('contains_superconductor'):
-            return "A top of the line Massage-o-Matic Captain's Executive Command Chair. " \
-                   "It's massaging a skeleton."
-        return "The chair won't work any more, it has no power."
+            return _("A top of the line Massage-o-Matic Captain's Executive Command Chair. " \
+                   "It's massaging a skeleton.")
+        return _("The chair won't work any more, it has no power.")
 
 
 class MassageChair(Thing):
@@ -193,15 +194,15 @@
     INITIAL = 'stethoscope'
 
     def get_description(self):
-        return "A stethoscope hangs from the neck of the skeleton."
+        return _("A stethoscope hangs from the neck of the skeleton.")
 
     def interact_without(self):
         self.state.add_inventory_item('stethoscope')
         self.scene.remove_thing(self)
         # Fill in the doctor's rect
         self.scene.doctor.rect.append(self.rect)
-        return Result("You pick up the stethoscope and verify that the doctor's "
-                      "heart has stopped. Probably a while ago.")
+        return Result(_("You pick up the stethoscope and verify that the doctor's "
+                        "heart has stopped. Probably a while ago."))
 
 
 class TapedSuperconductor(Item):
@@ -221,8 +222,8 @@
         taped_superconductor = TapedSuperconductor('taped_superconductor')
         self.state.add_item(taped_superconductor)
         self.state.replace_inventory_item(self.name, taped_superconductor.name)
-        return Result("You rip off a piece of duct tape and stick it on the superconductor. "
-                      "It almost sticks to itself, but you successfully avoid disaster.")
+        return Result(_("You rip off a piece of duct tape and stick it on the superconductor. "
+                        "It almost sticks to itself, but you successfully avoid disaster."))
 
 
 class SuperconductorThing(Thing):
@@ -241,8 +242,8 @@
         self.state.current_scene.things['bridge.massagechair_base'] \
                           .set_data('contains_superconductor', False)
         self.scene.remove_thing(self)
-        return (Result("The superconductor module unclips easily."),
-                make_jim_dialog(("Prisoner %s. That chair you've destroyed was "
+        return (Result(_("The superconductor module unclips easily.")),
+                make_jim_dialog(_("Prisoner %s. That chair you've destroyed was "
                                  "property of the ship's captain. "
                                  "You will surely be punished."
                                 ) % PLAYER_ID, self.state))
@@ -274,9 +275,9 @@
 
     def leave(self):
         self.description = random.choice([
-            "The lights flash in interesting patterns.",
-            "The flashing lights don't mean anything to you.",
-            "The console lights flash and flicker.",
+            _("The lights flash in interesting patterns."),
+            _("The flashing lights don't mean anything to you."),
+            _("The console lights flash and flicker."),
             ])
 
     def get_description(self):
@@ -319,18 +320,18 @@
 
     def get_description(self):
         if self.scene.get_data('ai panel') == 'closed':
-            return "The sign reads 'Warning: Authorized Techinicians Only'."
+            return _("The sign reads 'Warning: Authorized Techinicians Only'.")
 
     def interact_without(self):
         if self.scene.get_data('ai status') == 'online':
             return self.interact_default(None)
         elif self.scene.get_data('ai panel') == 'closed':
-            return Result("You are unable to open the panel with your bare hands.")
+            return Result(_("You are unable to open the panel with your bare hands."))
         elif self.scene.get_data('ai panel') == 'open':
             self.scene.set_data('ai panel', 'broken')
             self.scene.set_data('ai status', 'dead')
             self.set_interact('broken')
-            return Result("You unplug various important-looking wires.")
+            return Result(_("You unplug various important-looking wires."))
 
 
     def interact_with_machete(self, item):
@@ -339,18 +340,18 @@
         elif self.scene.get_data('ai panel') == 'closed':
             self.scene.set_data('ai panel', 'open')
             self.set_interact('open')
-            return Result("Using the machete, you lever the panel off.")
+            return Result(_("Using the machete, you lever the panel off."))
         elif self.scene.get_data('ai panel') == 'open':
             self.scene.set_data('ai panel', 'broken')
             self.scene.set_data('ai status', 'dead')
             self.set_interact('broken')
-            return Result("You smash various delicate components with the machete.")
+            return Result(_("You smash various delicate components with the machete."))
 
     def interact_default(self, item):
         if self.scene.get_data('ai status') == 'online':
-            return (Result('You feel a shock from the panel.'),
-                    make_jim_dialog("Prisoner %s. Please step away from the panel. "
-                        "You are not an authorized technician." % PLAYER_ID, self.state))
+            return (Result(_('You feel a shock from the panel.')),
+                    make_jim_dialog(_("Prisoner %s. Please step away from the panel. "
+                        "You are not an authorized technician.") % PLAYER_ID, self.state))
 
 class ChairDetail(Scene):
 
@@ -447,13 +448,13 @@
 
     def interact_without(self):
         if self.state.scenes['bridge'].get_data('ai status') == 'online':
-            return make_jim_dialog("You are not authorized to change the destination.", self.state)
+            return make_jim_dialog(_("You are not authorized to change the destination."), self.state)
         if not self.ai_blocked:
-            return Result("There's no good reason to choose to go to the penal colony.")
+            return Result(_("There's no good reason to choose to go to the penal colony."))
         if self.state.scenes['bridge'].get_data('ai status') == 'looping':
-            return Result("You could change the destination, but when JIM recovers, it'll just get reset.")
+            return Result(_("You could change the destination, but when JIM recovers, it'll just get reset."))
         if self.state.scenes['bridge'].get_data('ai status') == 'dead':
-            return Result("You change the destination.", soundfile="beep550.ogg", end_game=True)
+            return Result(_("You change the destination."), soundfile="beep550.ogg", end_game=True)
 
 class CompUpButton(Thing):
     """Up button on log screen"""