diff gamelib/scenes/cryo.py @ 769:43b49f1de828 pyntnclick-i18n

Merge i18n for before the pyntnclick split
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 26 Jan 2013 16:57:33 +0200
parents 386475464202 2f1952748cdb
children a35f5364437d
line wrap: on
line diff
--- a/gamelib/scenes/cryo.py	Sat Jan 26 13:24:01 2013 +0200
+++ b/gamelib/scenes/cryo.py	Sat Jan 26 16:57:33 2013 +0200
@@ -2,6 +2,7 @@
 
 import random
 
+from pyntnclick.i18n import _
 from pyntnclick.cursor import CursorSprite
 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result
 from pyntnclick.scenewidgets import (InteractNoImage, InteractRectUnion,
@@ -45,7 +46,7 @@
         # Flavour items
         # pipes
         self.add_thing(GenericDescThing('cryo.pipes', 1,
-            "These pipes carry cooling fluid to the cryo units.",
+            _("These pipes carry cooling fluid to the cryo units."),
             (
                 (552, 145, 129, 66),
                 (636, 82, 165, 60),
@@ -56,8 +57,8 @@
 
         # cryo units
         self.add_thing(GenericCryoUnit(2,
-            "An empty cryo chamber.",
-            "Prisoner 81E4-C8900480E635. Embezzlement. 20 years.",
+            _("An empty cryo chamber."),
+            _("Prisoner 81E4-C8900480E635. Embezzlement. 20 years."),
             (
                 (155, 430, 50, 35),
                 (125, 450, 60, 35),
@@ -66,9 +67,9 @@
                 )))
 
         self.add_thing(GenericCryoUnit(3,
-            "A working cryo chamber. The frosted glass obscures the details"
-            " of the occupant.",
-            "Prisoner 9334-CE1EB0243BAB. Murder. 40 years.",
+            _("A working cryo chamber. The frosted glass obscures the details"
+              " of the occupant."),
+            _("Prisoner 9334-CE1EB0243BAB. Murder. 40 years."),
             (
                 (215, 430, 50, 35),
                 (205, 450, 50, 35),
@@ -77,10 +78,10 @@
                 )))
 
         self.add_thing(GenericCryoUnit(4,
-            "A broken cryo chamber. The skeleton inside has been picked"
-            " clean.",
-            "Prisoner BFBC-8BF4C6B7492B. Importing illegal alien biomatter."
-            " 15 years.",
+            _("A broken cryo chamber. The skeleton inside has been picked"
+              " clean."),
+            _("Prisoner BFBC-8BF4C6B7492B. Importing illegal alien biomatter."
+              " 15 years."),
             (
                 (275, 430, 50, 70),
                 (255, 460, 50, 70),
@@ -88,25 +89,26 @@
                 )))
 
         self.add_thing(GenericCryoUnit(5,
-            "A working cryo chamber. The frosted glass obscures the details of"
-            " the occupant.",
-            "Prisoner B520-99495B8C41CE. Copyright infringement. 60 years.",
+            _("A working cryo chamber. The frosted glass obscures the details "
+              "of the occupant."),
+            _("Prisoner B520-99495B8C41CE. Copyright infringement. 60 years."),
             (
                 (340, 430, 50, 70),
                 (330, 500, 60, 50),
                 )))
 
         self.add_thing(GenericCryoUnit(6,
-            "An empty cryo unit. Recently filled by you.",
-            "Prisoner %s. Safecracking, grand larceny. 30 years." % PLAYER_ID,
+            _("An empty cryo unit. Recently filled by you."),
+            _("Prisoner %s. Safecracking, grand larceny. 30 years.")
+            % PLAYER_ID,
             (
                 (399, 426, 70, 56),
                 (404, 455, 69, 120),
                 )))
 
         self.add_thing(GenericCryoUnit(7,
-            "An empty cryo unit.",
-            "Prisoner 83F1-CE32D3234749. Spamming. 5 years.",
+            _("An empty cryo unit."),
+            _("Prisoner 83F1-CE32D3234749. Spamming. 5 years."),
             (
                 (472, 432, 58, 51),
                 (488, 455, 41, 134),
@@ -114,8 +116,8 @@
                 )))
 
         self.add_thing(GenericCryoUnit(8,
-            "An empty cryo unit.",
-            "Prisoner A455-9DF9F43C43E5. Medical malpractice. 10 years.",
+            _("An empty cryo unit."),
+            _("Prisoner A455-9DF9F43C43E5. Medical malpractice. 10 years."),
             (
                 (596, 419, 69, 39),
                 (616, 442, 82, 40),
@@ -132,14 +134,14 @@
         if self.get_data('greet'):
             self.set_data('greet', False)
             return make_jim_dialog(
-                    "Greetings, Prisoner %s. I am the Judicial "
-                    "Incarceration Monitor. "
-                    "You have been woken early under the terms of the "
-                    "emergency conscription act to assist with repairs to "
-                    "the ship. Your behaviour during this time will "
-                    "be noted on your record and will be relayed to "
-                    "prison officials when we reach the destination. "
-                    "Please report to the bridge." % PLAYER_ID, self.game)
+                    _("Greetings, Prisoner %s. I am the Judicial "
+                      "Incarceration Monitor. "
+                      "You have been woken early under the terms of the "
+                      "emergency conscription act to assist with repairs to "
+                      "the ship. Your behaviour during this time will "
+                      "be noted on your record and will be relayed to "
+                      "prison officials when we reach the destination. "
+                      "Please report to the bridge.") % PLAYER_ID, self.game)
 
     def leave(self):
         # Stop music
@@ -167,15 +169,15 @@
             self.game.add_item(pipe)
             self.game.add_inventory_item(pipe.name)
             self.set_interact()
-            responses = [Result("It takes more effort than one would expect,"
-                " but eventually the pipe is separated from the wall.",
-                soundfile="chop-chop.ogg")]
+            responses = [Result(_("It takes more effort than one would expect,"
+                                  " but eventually the pipe is separated from"
+                                  " the wall."), soundfile="chop-chop.ogg")]
             if self.game.current_scene.get_data('vandalism_warn'):
                 self.game.current_scene.set_data('vandalism_warn', False)
                 responses.append(make_jim_dialog(
-                    ("Prisoner %s. Vandalism is an offence punishable by a "
-                     "minimum of an additional 6 months to your sentence."
-                    ) % PLAYER_ID, self.game))
+                    _("Prisoner %s. Vandalism is an offence punishable by a "
+                      "minimum of an additional 6 months to your sentence."
+                     ) % PLAYER_ID, self.game))
             return responses
 
     def is_interactive(self, tool=None):
@@ -183,14 +185,14 @@
 
     def interact_without(self):
         if self.get_data('fixed'):
-            return Result("These pipes aren't attached to the wall very"
-                    " solidly.")
+            return Result(_("These pipes aren't attached to the wall very"
+                            " solidly."))
         return None
 
     def get_description(self):
         if self.get_data('fixed'):
-            return "These pipes carry cooling fluid to empty cryo units."
-        return "There used to be a pipe carrying cooling fluid here."
+            return _("These pipes carry cooling fluid to empty cryo units.")
+        return _("There used to be a pipe carrying cooling fluid here.")
 
 
 class UncuttableCryoPipes(Thing):
@@ -207,17 +209,18 @@
     INITIAL = "fixed"
 
     def interact_with_machete(self, item):
-        return Result("These pipes carry fluid to the working cryo units."
-                " Chopping them down doesn't seem sensible.")
+        return Result(_("These pipes carry fluid to the working cryo units."
+                        " Chopping them down doesn't seem sensible."))
 
     def is_interactive(self, tool=None):
         return True
 
     def interact_without(self):
-        return Result("These pipes aren't attached to the wall very solidly.")
+        return Result(_("These pipes aren't attached to the wall very solidly."
+                       ))
 
     def get_description(self):
-        return "These pipes carry cooling fluid to the working cryo units."
+        return _("These pipes carry cooling fluid to the working cryo units.")
 
 
 class TubeFragment(CloneableItem):
@@ -289,15 +292,15 @@
         return Result(detail_view='cryo_detail')
 
     def interact_with_titanium_leg(self, item):
-        return Result("You hit the chamber that used to hold this very leg."
-                " Nothing happens as a result.",
-                soundfile="clang2.ogg")
+        return Result(_("You hit the chamber that used to hold this very leg."
+                        " Nothing happens as a result."),
+                      soundfile="clang2.ogg")
 
     def get_description(self):
         if self.get_data('contains_titanium_leg'):
-            return "A broken cryo chamber, with a poor unfortunate corpse" \
-                    " inside."
-        return "A broken cryo chamber. The corpse inside is missing a leg."
+            return _("A broken cryo chamber, with a poor unfortunate corpse"
+                     " inside.")
+        return _("A broken cryo chamber. The corpse inside is missing a leg.")
 
 
 class GenericCryoUnit(GenericDescThing):
@@ -319,11 +322,11 @@
 
     def interact_with_titanium_leg(self, item):
         return Result(random.choice([
-                "You bang on the chamber with the titanium femur. Nothing"
-                " much happens.",
-                "Hitting the cryo unit with the femur doesn't achieve"
-                " anything.",
-                "You hit the chamber with the femur. Nothing happens.",
+                _("You bang on the chamber with the titanium femur. Nothing"
+                  " much happens."),
+                _("Hitting the cryo unit with the femur doesn't achieve"
+                  " anything."),
+                _("You hit the chamber with the femur. Nothing happens."),
                 ]), soundfile="clang2.ogg")
 
 
@@ -347,24 +350,25 @@
     def interact_with_titanium_leg(self, item):
         if self.get_data('door') == "ajar":
             self.open_door()
-            return Result("You wedge the titanium femur into the chain and"
-                    " twist. With a satisfying *snap*, the chain breaks and"
-                    " the door opens.", soundfile='break.ogg')
+            return Result(_("You wedge the titanium femur into the chain and"
+                            " twist. With a satisfying *snap*, the chain"
+                            " breaks and the door opens."),
+                          soundfile='break.ogg')
         elif self.get_data('door') == "shut":
-            text = ("You bang on the door with the titanium femur. It makes a"
-                    " clanging sound.")
+            text = _("You bang on the door with the titanium femur. It makes a"
+                     " clanging sound.")
             return Result(text, soundfile='clang.ogg')
         else:
-            return Result("You wave the femur in the doorway. Nothing"
-                    " happens.")
+            return Result(_("You wave the femur in the doorway. Nothing"
+                            " happens."))
 
     def interact_without(self):
         if self.get_data('door') == "shut":
             self.half_open_door()
         if self.get_data('door') != "open":
-            return Result("It moves slightly and then stops. A chain on the"
-                    " other side is preventing it from opening completely.",
-                    soundfile='chain.ogg')
+            return Result(_("It moves slightly and then stops. A chain on the"
+                            " other side is preventing it from opening"
+                            " completely."), soundfile='chain.ogg')
         else:
             self.game.change_scene('map')
             return None
@@ -385,11 +389,11 @@
 
     def get_description(self):
         if self.get_data('door') == "open":
-            return 'An open doorway leads to the rest of the ship.'
+            return _('An open doorway leads to the rest of the ship.')
         elif self.get_data('door') == "ajar":
-            return ("A rusty door. It can't open all the way because of a "
-                    "chain on the other side.")
-        return 'A rusty door. It is currently closed.'
+            return _("A rusty door. It can't open all the way because of a "
+                     "chain on the other side.")
+        return _('A rusty door. It is currently closed.')
 
 
 class CryoComputer(Thing):
@@ -410,10 +414,10 @@
         return Result(detail_view='cryo_comp_detail')
 
     def interact_with_titanium_leg(self, item):
-        return Result("Hitting it with the leg accomplishes nothing.")
+        return Result(_("Hitting it with the leg accomplishes nothing."))
 
     def get_description(self):
-        return "A computer terminal, with some text on it."
+        return _("A computer terminal, with some text on it.")
 
 
 class TitaniumLegThing(Thing):
@@ -432,11 +436,11 @@
         self.game.scenes['cryo'].things['cryo.unit.1'].set_data(
                 'contains_titanium_leg', False)
         self.scene.remove_thing(self)
-        return Result("The skeletal occupant of this cryo unit has an"
-                " artificial femur made of titanium. You take it.")
+        return Result(_("The skeletal occupant of this cryo unit has an"
+                        " artificial femur made of titanium. You take it."))
 
     def get_description(self):
-        return "This femur looks synthetic."
+        return _("This femur looks synthetic.")
 
 
 class PlaqueThing(Thing):
@@ -451,10 +455,11 @@
     INITIAL = "plaque"
 
     def interact_without(self):
-        return Result("The plaque is welded to the unit. You can't shift it.")
+        return Result(_("The plaque is welded to the unit. You can't shift it."
+                       ))
 
     def get_description(self):
-        return "'Prisoner 98CC-764E646391EE. War crimes. 45 years."
+        return _("'Prisoner 98CC-764E646391EE. War crimes. 45 years.")
 
 
 class FullBottle(Item):
@@ -478,16 +483,16 @@
     INITIAL = 'pools'
 
     def get_description(self):
-        return "Coolant leaks disturbingly from the bulkheads."
+        return _("Coolant leaks disturbingly from the bulkheads.")
 
     def interact_without(self):
-        return Result("It's gooey")
+        return Result(_("It's gooey"))
 
     def interact_with_detergent_bottle(self, item):
         full = FullBottle('full_detergent_bottle')
         self.game.add_item(full)
         self.game.replace_inventory_item(item.name, full.name)
-        return Result("You scoop up some coolant and fill the bottle.")
+        return Result(_("You scoop up some coolant and fill the bottle."))
 
 
 class CryoCompDetail(Scene):