diff gamelib/scenes/mess.py @ 478:a9925aaf5f61 1.0.1

i18n and Russian translation
author Stefano Rivera <stefano@rivera.za.net>
date Tue, 08 Mar 2011 12:29:14 +0200
parents af2a23b9787d
children 2f1952748cdb
line wrap: on
line diff
--- a/gamelib/scenes/mess.py	Sun Aug 29 12:33:21 2010 +0200
+++ b/gamelib/scenes/mess.py	Tue Mar 08 12:29:14 2011 +0200
@@ -13,6 +13,7 @@
 from gamelib import constants
 from gamelib.scenes.game_constants import PLAYER_ID
 
+from gamelib.i18n import _
 
 class Mess(Scene):
 
@@ -34,13 +35,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),
@@ -51,7 +52,7 @@
     """Base class for the cans"""
 
     def interact_with_full_can(self, item, state):
-        return Result("You bang the cans together. It sounds like two cans being banged together.", soundfile="can_hit.ogg")
+        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, state):
         return self.interact_with_full_can(item, state)
@@ -60,13 +61,13 @@
         return self.interact_with_full_can(item, state)
 
     def interact_with_machete(self, item, state):
-        return Result("You'd mangle it beyond usefulness.")
+        return Result(_("You'd mangle it beyond usefulness."))
 
     def interact_with_canopener(self, item, state):
         empty = EmptyCan('empty_can')
         state.add_item(empty)
         state.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,10 +77,10 @@
     CURSOR = CursorSprite('empty_can_cursor.png')
 
     def interact_with_titanium_leg(self, item, state):
-        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, state):
-        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):
@@ -92,7 +93,7 @@
         dented = DentedCan("dented_can")
         state.add_item(dented)
         state.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):
@@ -102,7 +103,7 @@
     CURSOR = CursorSprite('dented_can_cursor.png')
 
     def interact_with_titanium_leg(self, item, state):
-        return Result("You club the can with the femur. The dents shift around, but it still doesn't open.", soundfile="can_hit.ogg")
+        return Result(_("You club the can with the femur. The dents shift around, but it still doesn't open."), soundfile="can_hit.ogg")
 
 
 class CansOnShelf(Thing):
@@ -133,15 +134,15 @@
             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):
@@ -163,69 +164,69 @@
 
     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 interact_with_machete(self, item):
         if self.get_data("status") == "blocked":
             self.set_data("status", "broken")
             self.set_interact("broken")
-            return Result("With a flurry of disgusting mutant vegetable "
+            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.",
+                          "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.state.remove_inventory_item(item.name)
             self.set_data('status', 'replaced')
             self.set_interact("replaced")
             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."
+                _("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("fixed")
             self.scene.set_data('life support status', 'fixed')
             # TODO: A less anticlimactic climax?
-            return Result("It takes quite a lot of tape, but eventually everything is"
+            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?")
+                          " 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." % PLAYER_ID)
+            return Result(_("You don't find any leaks. Good job, Prisoner %s.") % PLAYER_ID)
 
 
 class Boomslang(Thing):
@@ -284,14 +285,14 @@
 
     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('taken')
         self.state.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):