diff gamelib/scenes/mess.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/mess.py	Sat Jan 26 13:24:01 2013 +0200
+++ b/gamelib/scenes/mess.py	Sat Jan 26 16:57:33 2013 +0200
@@ -2,6 +2,7 @@
 
 from random import randint
 
+from pyntnclick.i18n import _
 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result
 from pyntnclick.cursor import CursorSprite
 from pyntnclick.scenewidgets import (InteractNoImage, InteractImage,
@@ -31,13 +32,13 @@
         # Flavour items
         # extra cans on shelf
         self.add_thing(GenericDescThing('mess.cans', 1,
-            "A large collection of rusted, useless cans.",
+            _("A large collection of rusted, useless cans."),
             (
                 (154, 335, 89, 106),
                 (152, 435, 63, 66),
                 )))
         self.add_thing(GenericDescThing('mess.broccoli', 2,
-            "An impressively overgrown broccoli.",
+            _("An impressively overgrown broccoli."),
             (
                 (503, 89, 245, 282),
                 (320, 324, 229, 142),
@@ -48,8 +49,8 @@
     """Base class for the cans"""
 
     def interact_with_full_can(self, item):
-        return Result("You bang the cans together. It sounds like two"
-                      " cans being banged together.",
+        return Result(_("You bang the cans together. It sounds like two"
+                        " cans being banged together."),
                       soundfile="can_hit.ogg")
 
     def interact_with_dented_can(self, item):
@@ -59,14 +60,14 @@
         return self.interact_with_full_can(item)
 
     def interact_with_machete(self, item):
-        return Result("You'd mangle it beyond usefulness.")
+        return Result(_("You'd mangle it beyond usefulness."))
 
     def interact_with_canopener(self, item):
         empty = EmptyCan('empty_can')
         self.game.add_item(empty)
         self.game.replace_inventory_item(self.name, empty.name)
-        return Result("You open both ends of the can, discarding the"
-                      " hideous contents.")
+        return Result(_("You open both ends of the can, discarding the"
+                        " hideous contents."))
 
 
 class EmptyCan(BaseCan):
@@ -76,11 +77,11 @@
     CURSOR = CursorSprite('empty_can_cursor.png')
 
     def interact_with_titanium_leg(self, item):
-        return Result("Flattening the can doesn't look like a useful"
-                      " thing to do.")
+        return Result(_("Flattening the can doesn't look like a useful"
+                        " thing to do."))
 
     def interact_with_canopener(self, item):
-        return Result("There's nothing left to open on this can")
+        return Result(_("There's nothing left to open on this can"))
 
 
 class FullCan(BaseCan):
@@ -93,8 +94,8 @@
         dented = DentedCan("dented_can")
         self.game.add_item(dented)
         self.game.replace_inventory_item(self.name, dented.name)
-        return Result("You club the can with the femur. The can gets dented,"
-                      " but doesn't open.", soundfile="can_hit.ogg")
+        return Result(_("You club the can with the femur. The can gets dented,"
+                        " but doesn't open."), soundfile="can_hit.ogg")
 
 
 class DentedCan(BaseCan):
@@ -104,8 +105,8 @@
     CURSOR = CursorSprite('dented_can_cursor.png')
 
     def interact_with_titanium_leg(self, item):
-        return Result("You club the can with the femur. The dents shift"
-                      " around, but it still doesn't open.",
+        return Result(_("You club the can with the femur. The dents shift"
+                        " around, but it still doesn't open."),
                       soundfile="can_hit.ogg")
 
 
@@ -140,16 +141,17 @@
             if starting_cans == 1:
                 self.scene.remove_thing(self)
             return Result({
-                    3: "Best before a long time in the past."
-                       " Better not eat these.",
-                    2: "Mmmm. Nutritious bacteria stew.",
-                    1: "Candied silkworms. Who stocked this place?!",
+                    3: _("Best before a long time in the past."
+                         " Better not eat these."),
+                    2: _("Mmmm. Nutritious bacteria stew."),
+                    1: _("Candied silkworms. Who stocked this place?!"),
                     }[starting_cans])
         else:
-            return Result("The rest of the cans are rusted beyond usefulness.")
+            return Result(_("The rest of the cans are rusted beyond "
+                            "usefulness."))
 
     def get_description(self):
-        return "The contents of these cans look synthetic."
+        return _("The contents of these cans look synthetic.")
 
 
 class Tubes(Thing):
@@ -171,15 +173,15 @@
 
     def get_description(self):
         if self.get_data('status') == "blocked":
-            return ("The broccoli seems to have become"
-                    " entangled with something.")
+            return _("The broccoli seems to have become"
+                     " entangled with something.")
         elif self.get_data("status") == "broken":
-            return "These broken pipes look important."
+            return _("These broken pipes look important.")
         elif self.get_data("status") == "replaced":
-            return ("The pipes have been repaired but are the repairs"
-                    " aren't airtight, yet")
+            return _("The pipes have been repaired but are the repairs"
+                     " aren't airtight, yet")
         else:
-            return "Your fix looks like it's holding up well."
+            return _("Your fix looks like it's holding up well.")
 
     def select_interact(self):
         return self.get_data('status')
@@ -188,56 +190,58 @@
         if self.get_data("status") == "blocked":
             self.set_data("status", "broken")
             self.set_interact()
-            return Result("With a flurry of disgusting mutant vegetable "
-                          "chunks, you clear the overgrown broccoli away from "
-                          "the access panel and reveal some broken tubes. "
-                          "They look important.",
+            return Result(_("With a flurry of disgusting mutant vegetable "
+                            "chunks, you clear the overgrown broccoli away "
+                            "from the access panel and reveal some broken "
+                            "tubes. They look important."),
                           soundfile='chopping.ogg')
         elif self.get_data("status") == "broken":
-            return Result("It looks broken enough already.")
+            return Result(_("It looks broken enough already."))
         elif self.get_data("status") == "replaced":
-            return Result("Cutting holes won't repair the leaks.")
+            return Result(_("Cutting holes won't repair the leaks."))
         else:
-            return Result("After all that effort fixing it, chopping it to "
-                          "bits doesn't seem very smart.")
+            return Result(_("After all that effort fixing it, chopping it to "
+                            "bits doesn't seem very smart."))
 
     def interact_with_cryo_pipes_three(self, item):
         if self.get_data("status") == "blocked":
-            return Result("It would get lost in the fronds.")
+            return Result(_("It would get lost in the fronds."))
         else:
             self.game.remove_inventory_item(item.name)
             self.set_data('status', 'replaced')
             self.set_interact()
             self.scene.set_data('life support status', 'replaced')
-            return Result("The pipes slot neatly into place, but don't make"
-                          " an airtight seal. One of the pipes has cracked"
-                          " slightly as well.")
+            return Result(_("The pipes slot neatly into place, but don't make"
+                            " an airtight seal. One of the pipes has cracked"
+                            " slightly as well."))
 
     def interact_with_duct_tape(self, item):
         if self.get_data("status") == "broken":
-            return Result("It would get lost in the fronds.")
+            return Result(_("It would get lost in the fronds."))
         elif self.get_data("status") == 'fixed':
-            return Result("There's quite enough tape on the ducting already.")
+            return Result(_("There's quite enough tape on the ducting already."
+                           ))
         else:
             self.set_data("fixed", True)
             self.set_data("status", "fixed")
             self.set_interact()
             self.scene.set_data('life support status', 'fixed')
-            return Result("It takes quite a lot of tape, but eventually"
-                          "everything is airtight and ready to hold pressure."
-                          " Who'd've thought duct tape could actually be used"
-                          " to tape ducts?")
+            return Result(_("It takes quite a lot of tape, but eventually "
+                            "everything is airtight and ready to hold "
+                            "pressure. Who'd've thought duct tape could "
+                            "actually be used to tape ducts?"))
 
     def interact_without(self):
         if self.get_data("status") == "blocked":
-            return Result("The mutant broccoli resists your best efforts.")
+            return Result(_("The mutant broccoli resists your best efforts."))
         elif self.get_data("status") == "broken":
-            return Result("Shoving the broken pipes around doesn't help much.")
+            return Result(_("Shoving the broken pipes around doesn't help "
+                            "much."))
         elif self.get_data("status") == "replaced":
-            return Result("Do you really want to hold it together for the "
-                          "rest of the voyage?")
+            return Result(_("Do you really want to hold it together for the "
+                            "rest of the voyage?"))
         else:
-            return Result("You don't find any leaks. Good job, Prisoner %s."
+            return Result(_("You don't find any leaks. Good job, Prisoner %s.")
                           % PLAYER_ID)
 
 
@@ -304,15 +308,16 @@
 
     def interact_without(self):
         if self.get_data('taken'):
-            return Result("The remaining bottles leak.")
+            return Result(_("The remaining bottles leak."))
         self.set_data('taken', True)
         self.set_interact()
         self.game.add_inventory_item('detergent_bottle')
-        return Result("You pick up an empty dishwashing liquid bottle. You"
-                      " can't find any sponges.")
+        return Result(_("You pick up an empty dishwashing liquid bottle. You"
+                        " can't find any sponges."))
 
     def get_description(self):
-        return "Empty plastic containers. They used to hold dishwasher soap."
+        return _("Empty plastic containers. "
+                 "They used to hold dishwasher soap.")
 
 
 class DetergentBottle(Item):