changeset 782:6a3440c8be8d pyntnclick

The title needs to be lazily translated. It's evaluated before we set up gettext
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 26 Jan 2013 19:13:07 +0200
parents 5fb962434159
children eafa66caedd2
files gamelib/constants.py po/ru.po po/suspended-sentence.pot pyntnclick/main.py
diffstat 4 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/constants.py	Sat Jan 26 18:54:34 2013 +0200
+++ b/gamelib/constants.py	Sat Jan 26 19:13:07 2013 +0200
@@ -1,5 +1,8 @@
 from pyntnclick.constants import GameConstants
-from pyntnclick.i18n import _
+
+# Anything here has to be explicitly translated
+# This module is imported before we've set up i18n
+_ = lambda x: x
 
 
 class SSConstants(GameConstants):
--- a/po/ru.po	Sat Jan 26 18:54:34 2013 +0200
+++ b/po/ru.po	Sat Jan 26 19:13:07 2013 +0200
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: suspended-sentence 1.0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-01-26 18:41+0200\n"
+"POT-Creation-Date: 2013-01-26 19:09+0200\n"
 "PO-Revision-Date: 2011-03-08 23:13+0600\n"
 "Last-Translator: Sergey Basalaev <sbasalaev@gmail.com>\n"
 "Language-Team: Russian\n"
@@ -19,7 +19,7 @@
 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
 
-#: gamelib/constants.py:6
+#: gamelib/constants.py:9
 msgid "Suspended Sentence"
 msgstr "Анабиоз"
 
--- a/po/suspended-sentence.pot	Sat Jan 26 18:54:34 2013 +0200
+++ b/po/suspended-sentence.pot	Sat Jan 26 19:13:07 2013 +0200
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-01-26 18:41+0200\n"
+"POT-Creation-Date: 2013-01-26 19:10+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,7 +17,7 @@
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: gamelib/constants.py:6
+#: gamelib/constants.py:9
 msgid "Suspended Sentence"
 msgstr ""
 
--- a/pyntnclick/main.py	Sat Jan 26 18:54:34 2013 +0200
+++ b/pyntnclick/main.py	Sat Jan 26 19:13:07 2013 +0200
@@ -11,6 +11,7 @@
 import pygame
 from pygame.locals import SWSURFACE
 
+from pyntnclick.i18n import _
 from pyntnclick.engine import Engine
 from pyntnclick.gamescreen import DefMenuScreen, DefEndScreen, GameScreen
 from pyntnclick.constants import GameConstants, DEBUG_ENVVAR
@@ -128,7 +129,7 @@
             for option in self.debug_options:
                 if option in sys.argv:
                     self.warn_debug(option)
-        opts, _ = parser.parse_args(sys.argv)
+        opts, args = parser.parse_args(sys.argv)
         pygame.display.init()
         pygame.font.init()
         if opts.sound:
@@ -159,7 +160,8 @@
                 pygame.display.set_icon(self.resource.get_image(
                     self.constants.icon, basedir='icons'))
             if self.constants.title:
-                pygame.display.set_caption(self.constants.title)
+                title = _(self.constants.title).encode('utf-8')
+                pygame.display.set_caption(title)
 
             self.engine = Engine(self)
             # Initialize the special screens in the engine