diff gamelib/scenes/machine.py @ 770:a35f5364437d pyntnclick

Merge i18n
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 26 Jan 2013 17:00:43 +0200
parents a8510f4e2ea1 43b49f1de828
children bdaffaa8b6bf
line wrap: on
line diff
--- a/gamelib/scenes/machine.py	Sat Jan 26 15:24:56 2013 +0200
+++ b/gamelib/scenes/machine.py	Sat Jan 26 17:00:43 2013 +0200
@@ -1,5 +1,6 @@
 """Machine room where tools and machines are found."""
 
+from pyntnclick.i18n import _
 from pyntnclick.state import Scene, Item, Thing, Result
 from pyntnclick.cursor import CursorSprite
 from pyntnclick.scenewidgets import (
@@ -27,7 +28,7 @@
         self.add_item(CryoPipesThree('cryo_pipes_three'))
         self.add_item(Manual('manual'))
         self.add_thing(GenericDescThing('machine.wires', 2,
-            "Wires run to all the machines in the room",
+            _("Wires run to all the machines in the room"),
             (
                 (250, 172, 252, 12),
                 (388, 183, 114, 13),
@@ -47,16 +48,16 @@
                 (674, 54, 23, 36),
                 )))
         self.add_thing(GenericDescThing('machine.diagram', 3,
-            "A wiring diagram of some sort",
+            _("A wiring diagram of some sort"),
             ((694, 140, 94, 185),)))
         self.add_thing(GenericDescThing('machine.powerpoint', 4,
-            "The cables to this power point have been cut",
+            _("The cables to this power point have been cut"),
             ((155, 22, 92, 74),)))
         self.add_thing(GenericDescThing("machine.powerpoint", 5,
-            "All the machines run off this powerpoint",
+            _("All the machines run off this powerpoint"),
             ((593, 19, 74, 57),)))
         self.add_thing(GenericDescThing("machine.drill_press", 6,
-            "An impressive looking laser drill press",
+            _("An impressive looking laser drill press"),
             (
                 (519, 338, 36, 63),
                 (545, 348, 93, 46),
@@ -69,7 +70,7 @@
                 (605, 304, 26, 8),
             )))
         self.add_thing(GenericDescThing("machine.drill_press_block", 7,
-            "The block for the laser drill press",
+            _("The block for the laser drill press"),
             ((461, 446, 38, 27),)))
 
 
@@ -114,43 +115,43 @@
             return "can_and_tube"
 
     def interact_without(self):
-        return Result("You really don't want to put your hand in there.")
+        return Result(_("You really don't want to put your hand in there."))
 
     def interact_with_empty_can(self, item):
         contents = self.get_data('contents')
         if "can" in contents:
-            return Result("There is already a can in the welder.")
+            return Result(_("There is already a can in the welder."))
         self.game.remove_inventory_item(item.name)
         contents.add("can")
         self.set_interact()
-        return Result("You carefully place the can in the laser welder.")
+        return Result(_("You carefully place the can in the laser welder."))
 
     def interact_with_tube_fragment(self, item):
         contents = self.get_data('contents')
         if "tube" in contents:
-            return Result("There is already a tube fragment in the welder.")
+            return Result(_("There is already a tube fragment in the welder."))
         self.game.remove_inventory_item(item.name)
         contents.add("tube")
         self.set_interact()
-        return Result("You carefully place the tube fragments in the"
-                      " laser welder.")
+        return Result(_("You carefully place the tube fragments in the"
+                        " laser welder."))
 
     def get_description(self):
         contents = self.get_data('contents')
         if not contents:
-            return ("This is a Smith and Wesson 'zOMG' class high-precision"
-                    " laser welder.")
+            return (_("This is a Smith and Wesson 'zOMG' class high-precision"
+                      " laser welder."))
         if len(contents) == 1:
-            msg = "The laser welder looks hungry, somehow."
+            msg = _("The laser welder looks hungry, somehow.")
             if "can" in contents:
-                msg += " It currently contains an empty can."
+                msg += _(" It currently contains an empty can.")
             elif "tube" in contents:
-                msg += " It currently contains a tube fragment."
+                msg += _(" It currently contains a tube fragment.")
         elif len(contents) == 2:
-            msg = "The laser welder looks expectant. "
+            msg = _("The laser welder looks expectant. ")
             if "can" in contents and "tube" in contents:
-                msg += (" It currently contains an empty can and a"
-                        " tube fragment.")
+                msg += _(" It currently contains an empty can and a"
+                         " tube fragment.")
         return msg
 
 
@@ -168,41 +169,39 @@
         welder_slot = self.scene.things["machine.welder.slot"]
         contents = welder_slot.get_data("contents")
         if not contents:
-            return Result("The laser welder doesn't currently contain"
-                          " anything weldable.")
+            return Result(_("The laser welder doesn't currently contain"
+                            " anything weldable."))
         elif len(contents) == 1:
             if "can" in contents:
-                return Result("The laser welder needs something to weld the"
-                              " can to.")
+                return Result(_("The laser welder needs something to weld the"
+                                " can to."))
             elif "tube" in contents:
-                return Result("The laser welder needs something to weld the"
-                              " tube fragments to.")
+                return Result(_("The laser welder needs something to weld the"
+                                " tube fragments to."))
         else:
             welder_slot.set_data("contents", set())
             welder_slot.set_interact()
             if self.game.is_in_inventory("cryo_pipes_one"):
                 self.game.replace_inventory_item("cryo_pipes_one",
                                                   "cryo_pipes_two")
-                return Result("With high-precision spitzensparken, you weld"
-                              " together a second pipe. You bundle the two"
-                              " pipes together.",
-                        soundfile='laser.ogg')
+                return Result(_("With high-precision spitzensparken, you weld"
+                                " together a second pipe. You bundle the two"
+                                " pipes together."), soundfile='laser.ogg')
             elif self.game.is_in_inventory("cryo_pipes_two"):
                 self.game.replace_inventory_item("cryo_pipes_two",
                                                   "cryo_pipes_three")
-                return Result("With high-precision spitzensparken, you create"
-                              " yet another pipe. You store it with the other"
-                              " two.",
-                        soundfile='laser.ogg')
+                return Result(_("With high-precision spitzensparken, you"
+                                " create yet another pipe. You store it with"
+                                " the other two."), soundfile='laser.ogg')
             elif self.game.is_in_inventory("cryo_pipes_three"):
                 # just for safety
                 return None
             else:
                 self.game.add_inventory_item("cryo_pipes_one")
-                return Result("With high-precision spitzensparken, the can and"
-                              " tube are welded into a whole greater than the"
-                              " sum of the parts.",
-                        soundfile='laser.ogg')
+                return Result(_("With high-precision spitzensparken, the can"
+                                " and tube are welded into a whole greater"
+                                " than the sum of the parts."),
+                              soundfile='laser.ogg')
 
 
 class LaserWelderPowerLights(Thing):
@@ -218,7 +217,7 @@
     INITIAL = 'lights'
 
     def get_description(self):
-        return "The power lights pulse expectantly."
+        return _("The power lights pulse expectantly.")
 
 
 class CryoPipesOne(Item):
@@ -256,18 +255,19 @@
     INITIAL = "grind"
 
     def interact_without(self):
-        return Result("It looks like it eats fingers. Perhaps a different"
-                      " approach is in order?")
+        return Result(_("It looks like it eats fingers. Perhaps a different"
+                        " approach is in order?"))
 
     def interact_with_titanium_leg(self, item):
         self.game.replace_inventory_item(item.name, 'machete')
-        return Result("After much delicate grinding and a few close calls with"
-                      " various body parts, the titanium femur now resembles"
-                      " a machete more than a bone. Nice and sharp, too.",
-                      soundfile="grinder.ogg")
+        return Result(_("After much delicate grinding and a few close calls"
+                        " with various body parts, the titanium femur now"
+                        " resembles a machete more than a bone. Nice and"
+                        " sharp, too."), soundfile="grinder.ogg")
 
     def get_description(self):
-        return "A pretty ordinary, albeit rather industrial, grinding machine."
+        return _("A pretty ordinary, albeit rather industrial, grinding"
+                 " machine.")
 
 
 class TitaniumMachete(Item):
@@ -290,9 +290,9 @@
 
     def interact_without(self):
         self.take()
-        return Result("Ah! The ship's instruction manual. You'd feel better"
-                      " if the previous owner wasn't lying next to it with a"
-                      " gaping hole in his rib cage.")
+        return Result(_("Ah! The ship's instruction manual. You'd feel better"
+                        " if the previous owner wasn't lying next to it with a"
+                        " gaping hole in his rib cage."))
 
 
 class Manual(Item):