comparison gamelib/main.py @ 479:4ea237bbcef8 1.0.1

Tidy up the i18n changes
author Stefano Rivera <stefano@rivera.za.net>
date Tue, 08 Mar 2011 13:25:20 +0200
parents a9925aaf5f61
children
comparison
equal deleted inserted replaced
478:a9925aaf5f61 479:4ea237bbcef8
8 # The following horribleness fixes this. 8 # The following horribleness fixes this.
9 import sys 9 import sys
10 import os.path 10 import os.path
11 right_path = os.path.dirname(os.path.dirname(__file__)) 11 right_path = os.path.dirname(os.path.dirname(__file__))
12 sys.path.insert(0, right_path) 12 sys.path.insert(0, right_path)
13 import gettext
14 import locale
13 from optparse import OptionParser 15 from optparse import OptionParser
14 16
15 import pygame 17 import pygame
16 from pygame.locals import SWSURFACE 18 from pygame.locals import SWSURFACE
17 from albow.shell import Shell 19 from albow.shell import Shell
21 from endscreen import EndScreen 23 from endscreen import EndScreen
22 from constants import SCREEN, FRAME_RATE, FREQ, BITSIZE, CHANNELS, BUFFER, DEBUG 24 from constants import SCREEN, FRAME_RATE, FREQ, BITSIZE, CHANNELS, BUFFER, DEBUG
23 from sound import no_sound, disable_sound 25 from sound import no_sound, disable_sound
24 import state 26 import state
25 import data 27 import data
26 from locale import setlocale, LC_ALL
27 from gettext import bindtextdomain, textdomain
28 28
29 def parse_args(args): 29 def parse_args(args):
30 parser = OptionParser() 30 parser = OptionParser()
31 parser.add_option("--no-sound", action="store_false", default=True, 31 parser.add_option("--no-sound", action="store_false", default=True,
32 dest="sound", help="disable sound") 32 dest="sound", help="disable sound")
63 if DEBUG: 63 if DEBUG:
64 if opts.scene is not None: 64 if opts.scene is not None:
65 # debug the specified scene 65 # debug the specified scene
66 state.DEBUG_SCENE = opts.scene 66 state.DEBUG_SCENE = opts.scene
67 state.DEBUG_RECTS = opts.rects 67 state.DEBUG_RECTS = opts.rects
68 setlocale(LC_ALL, "") 68
69 bindtextdomain("suspended-sentence", data.filepath('locale')) 69 locale.setlocale(locale.LC_ALL, "")
70 textdomain("suspended-sentence") 70 gettext.bindtextdomain("suspended-sentence", data.filepath('locale'))
71 gettext.textdomain("suspended-sentence")
72
71 display = pygame.display.set_mode(SCREEN, SWSURFACE) 73 display = pygame.display.set_mode(SCREEN, SWSURFACE)
72 pygame.display.set_icon(pygame.image.load( 74 pygame.display.set_icon(pygame.image.load(
73 data.filepath('icons/suspended_sentence24x24.png'))) 75 data.filepath('icons/suspended_sentence24x24.png')))
74 pygame.display.set_caption("Suspended Sentence") 76 pygame.display.set_caption("Suspended Sentence")
75 shell = MainShell(display) 77 shell = MainShell(display)