comparison pyntnclick/main.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 f4853f817a7a
children c91c613ae6d0
comparison
equal deleted inserted replaced
763:afe7b1cb16c0 769:43b49f1de828
2 2
3 Contains the entry point used by the run_game.py script. 3 Contains the entry point used by the run_game.py script.
4 4
5 ''' 5 '''
6 import sys 6 import sys
7 import gettext
8 import locale
7 from optparse import OptionParser 9 from optparse import OptionParser
8 10
9 import pygame 11 import pygame
10 from pygame.locals import SWSURFACE 12 from pygame.locals import SWSURFACE
11 13
58 self._scene_list = self.SCENE_LIST 60 self._scene_list = self.SCENE_LIST
59 self._resource_module = self.RESOURCE_MODULE 61 self._resource_module = self.RESOURCE_MODULE
60 self._debug_rects = False 62 self._debug_rects = False
61 self._screens = self.SCREENS.copy() 63 self._screens = self.SCREENS.copy()
62 self._screens['game'] = GameScreen 64 self._screens['game'] = GameScreen
63 self.resource = Resources(self._resource_module) 65 self.constants = self.game_constants()
66
67 locale.setlocale(locale.LC_ALL, "")
68 lang = locale.getlocale()[0]
69 if '_' in lang:
70 lang = lang.split('_', 1)[0]
71 self.resource = Resources(self._resource_module, lang)
72 gettext.bindtextdomain(self.constants.i18n_name,
73 self.resource.get_resource_path('locale'))
74 gettext.textdomain(self.constants.i18n_name)
75
64 self.sound = Sound(self.resource) 76 self.sound = Sound(self.resource)
65 self.constants = self.game_constants()
66 self.debug_options = [] 77 self.debug_options = []
67 self.running = False 78 self.running = False
68 79
69 def initial_state(self): 80 def initial_state(self):
70 """Create a copy of the initial game state.""" 81 """Create a copy of the initial game state."""