mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
Start work on language support
This commit is contained in:
parent
3789e8eba4
commit
b9a80c14c4
4 changed files with 30 additions and 45 deletions
|
@ -1,45 +1,35 @@
|
|||
from panda3d.core import *
|
||||
import string
|
||||
import types
|
||||
|
||||
try:
|
||||
language = getConfigExpress().GetString('language', 'english')
|
||||
checkLanguage = getConfigExpress().GetBool('check-language', 0)
|
||||
language = settings['language']
|
||||
except:
|
||||
language = simbase.config.GetString('language', 'english')
|
||||
checkLanguage = simbase.config.GetBool('check-language', 0)
|
||||
|
||||
def getLanguage():
|
||||
return language
|
||||
|
||||
language = 'English'
|
||||
|
||||
print 'OTPLocalizer: Running in language: %s' % language
|
||||
if language == 'english':
|
||||
_languageModule = 'otp.otpbase.OTPLocalizer' + language.capitalize()
|
||||
else:
|
||||
checkLanguage = 1
|
||||
_languageModule = 'otp.otpbase.OTPLocalizer_' + language
|
||||
print 'from ' + _languageModule + ' import *'
|
||||
from otp.otpbase.OTPLocalizerEnglish import *
|
||||
if checkLanguage:
|
||||
|
||||
if language != 'English':
|
||||
l = {}
|
||||
g = {}
|
||||
module = 'otp.optbase.OTPLocalizer' + language
|
||||
englishModule = __import__('otp.otpbase.OTPLocalizerEnglish', g, l)
|
||||
foreignModule = __import__(_languageModule, g, l)
|
||||
foreignModule = __import__(module, g, l)
|
||||
for key, val in englishModule.__dict__.items():
|
||||
if key not in foreignModule.__dict__:
|
||||
print 'WARNING: Foreign module: %s missing key: %s' % (_languageModule, key)
|
||||
print 'WARNING: Foreign module: %s missing key: %s' % (module, key)
|
||||
locals()[key] = val
|
||||
elif isinstance(val, types.DictType):
|
||||
fval = foreignModule.__dict__.get(key)
|
||||
for dkey, dval in val.items():
|
||||
if dkey not in fval:
|
||||
print 'WARNING: Foreign module: %s missing key: %s.%s' % (_languageModule, key, dkey)
|
||||
print 'WARNING: Foreign module: %s missing key: %s.%s' % (module, key, dkey)
|
||||
fval[dkey] = dval
|
||||
|
||||
for dkey in fval.keys():
|
||||
if dkey not in val:
|
||||
print 'WARNING: Foreign module: %s extra key: %s.%s' % (_languageModule, key, dkey)
|
||||
print 'WARNING: Foreign module: %s extra key: %s.%s' % (module, key, dkey)
|
||||
|
||||
for key in foreignModule.__dict__.keys():
|
||||
if key not in englishModule.__dict__:
|
||||
print 'WARNING: Foreign module: %s extra key: %s' % (_languageModule, key)
|
||||
print 'WARNING: Foreign module: %s extra key: %s' % (module, key)
|
||||
|
|
|
@ -104,11 +104,11 @@ class DistributedGolfHole(DistributedPhysicsWorld.DistributedPhysicsWorld, FSM,
|
|||
self.__textGen = TextNode('golfHoleText')
|
||||
self.__textGen.setFont(ToontownGlobals.getSignFont())
|
||||
self.__textGen.setAlign(TextNode.ACenter)
|
||||
if TTLocalizer.getLanguage() in ['castillian',
|
||||
'japanese',
|
||||
'german',
|
||||
'portuguese',
|
||||
'french']:
|
||||
if TTLocalizer.getLanguage() in ['Castillian',
|
||||
'Japanese',
|
||||
'German',
|
||||
'Portuguese',
|
||||
'French']:
|
||||
self.__textGen.setGlyphScale(0.7)
|
||||
self.avIdList = []
|
||||
self.enterAimStart = 0
|
||||
|
|
|
@ -72,6 +72,8 @@ if 'loadDisplay' not in settings:
|
|||
settings['loadDisplay'] = 'pandagl'
|
||||
if 'toonChatSounds' not in settings:
|
||||
settings['toonChatSounds'] = True
|
||||
if 'language' not in settings:
|
||||
settings['language'] = 'English'
|
||||
loadPrcFileData('Settings: res', 'win-size %d %d' % tuple(settings.get('res', (800, 600))))
|
||||
loadPrcFileData('Settings: fullscreen', 'fullscreen %s' % settings['fullscreen'])
|
||||
loadPrcFileData('Settings: music', 'audio-music-active %s' % settings['music'])
|
||||
|
@ -80,7 +82,7 @@ loadPrcFileData('Settings: musicVol', 'audio-master-music-volume %s' % settings[
|
|||
loadPrcFileData('Settings: sfxVol', 'audio-master-sfx-volume %s' % settings['sfxVol'])
|
||||
loadPrcFileData('Settings: loadDisplay', 'load-display %s' % settings['loadDisplay'])
|
||||
loadPrcFileData('Settings: toonChatSounds', 'toon-chat-sounds %s' % settings['toonChatSounds'])
|
||||
|
||||
loadPrcFileData('Settings: language', 'language %s' % settings['language'])
|
||||
|
||||
import os
|
||||
|
||||
|
|
|
@ -1,45 +1,38 @@
|
|||
from panda3d.core import *
|
||||
import string
|
||||
import types
|
||||
|
||||
try:
|
||||
language = getConfigExpress().GetString('language', 'english')
|
||||
checkLanguage = getConfigExpress().GetBool('check-language', 0)
|
||||
language = settings['language']
|
||||
except:
|
||||
language = simbase.config.GetString('language', 'english')
|
||||
checkLanguage = simbase.config.GetBool('check-language', 0)
|
||||
language = 'English'
|
||||
|
||||
def getLanguage():
|
||||
return language
|
||||
|
||||
|
||||
print 'TTLocalizer: Running in language: %s' % language
|
||||
if language == 'english':
|
||||
_languageModule = 'toontown.toonbase.TTLocalizer' + language.capitalize()
|
||||
else:
|
||||
checkLanguage = 1
|
||||
_languageModule = 'toontown.toonbase.TTLocalizer_' + language
|
||||
print 'from ' + _languageModule + ' import *'
|
||||
from toontown.toonbase.TTLocalizerEnglish import *
|
||||
if checkLanguage:
|
||||
|
||||
if language != 'English':
|
||||
l = {}
|
||||
g = {}
|
||||
module = 'toontown.toonbase.TTLocalizer' + language
|
||||
englishModule = __import__('toontown.toonbase.TTLocalizerEnglish', g, l)
|
||||
foreignModule = __import__(_languageModule, g, l)
|
||||
foreignModule = __import__(module, g, l)
|
||||
for key, val in englishModule.__dict__.items():
|
||||
if key not in foreignModule.__dict__:
|
||||
print 'WARNING: Foreign module: %s missing key: %s' % (_languageModule, key)
|
||||
print 'WARNING: Foreign module: %s missing key: %s' % (module, key)
|
||||
locals()[key] = val
|
||||
elif isinstance(val, types.DictType):
|
||||
fval = foreignModule.__dict__.get(key)
|
||||
for dkey, dval in val.items():
|
||||
if dkey not in fval:
|
||||
print 'WARNING: Foreign module: %s missing key: %s.%s' % (_languageModule, key, dkey)
|
||||
print 'WARNING: Foreign module: %s missing key: %s.%s' % (module, key, dkey)
|
||||
fval[dkey] = dval
|
||||
|
||||
for dkey in fval.keys():
|
||||
if dkey not in val:
|
||||
print 'WARNING: Foreign module: %s extra key: %s.%s' % (_languageModule, key, dkey)
|
||||
print 'WARNING: Foreign module: %s extra key: %s.%s' % (module, key, dkey)
|
||||
|
||||
for key in foreignModule.__dict__.keys():
|
||||
if key not in englishModule.__dict__:
|
||||
print 'WARNING: Foreign module: %s extra key: %s' % (_languageModule, key)
|
||||
print 'WARNING: Foreign module: %s extra key: %s' % (module, key)
|
||||
|
|
Loading…
Reference in a new issue