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 string
|
||||||
import types
|
import types
|
||||||
|
|
||||||
try:
|
try:
|
||||||
language = getConfigExpress().GetString('language', 'english')
|
language = settings['language']
|
||||||
checkLanguage = getConfigExpress().GetBool('check-language', 0)
|
|
||||||
except:
|
except:
|
||||||
language = simbase.config.GetString('language', 'english')
|
language = 'English'
|
||||||
checkLanguage = simbase.config.GetBool('check-language', 0)
|
|
||||||
|
|
||||||
def getLanguage():
|
|
||||||
return language
|
|
||||||
|
|
||||||
|
|
||||||
print 'OTPLocalizer: Running in language: %s' % language
|
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 *
|
from otp.otpbase.OTPLocalizerEnglish import *
|
||||||
if checkLanguage:
|
|
||||||
|
if language != 'English':
|
||||||
l = {}
|
l = {}
|
||||||
g = {}
|
g = {}
|
||||||
|
module = 'otp.optbase.OTPLocalizer' + language
|
||||||
englishModule = __import__('otp.otpbase.OTPLocalizerEnglish', g, l)
|
englishModule = __import__('otp.otpbase.OTPLocalizerEnglish', g, l)
|
||||||
foreignModule = __import__(_languageModule, g, l)
|
foreignModule = __import__(module, g, l)
|
||||||
for key, val in englishModule.__dict__.items():
|
for key, val in englishModule.__dict__.items():
|
||||||
if key not in foreignModule.__dict__:
|
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
|
locals()[key] = val
|
||||||
elif isinstance(val, types.DictType):
|
elif isinstance(val, types.DictType):
|
||||||
fval = foreignModule.__dict__.get(key)
|
fval = foreignModule.__dict__.get(key)
|
||||||
for dkey, dval in val.items():
|
for dkey, dval in val.items():
|
||||||
if dkey not in fval:
|
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
|
fval[dkey] = dval
|
||||||
|
|
||||||
for dkey in fval.keys():
|
for dkey in fval.keys():
|
||||||
if dkey not in val:
|
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():
|
for key in foreignModule.__dict__.keys():
|
||||||
if key not in englishModule.__dict__:
|
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 = TextNode('golfHoleText')
|
||||||
self.__textGen.setFont(ToontownGlobals.getSignFont())
|
self.__textGen.setFont(ToontownGlobals.getSignFont())
|
||||||
self.__textGen.setAlign(TextNode.ACenter)
|
self.__textGen.setAlign(TextNode.ACenter)
|
||||||
if TTLocalizer.getLanguage() in ['castillian',
|
if TTLocalizer.getLanguage() in ['Castillian',
|
||||||
'japanese',
|
'Japanese',
|
||||||
'german',
|
'German',
|
||||||
'portuguese',
|
'Portuguese',
|
||||||
'french']:
|
'French']:
|
||||||
self.__textGen.setGlyphScale(0.7)
|
self.__textGen.setGlyphScale(0.7)
|
||||||
self.avIdList = []
|
self.avIdList = []
|
||||||
self.enterAimStart = 0
|
self.enterAimStart = 0
|
||||||
|
|
|
@ -72,6 +72,8 @@ if 'loadDisplay' not in settings:
|
||||||
settings['loadDisplay'] = 'pandagl'
|
settings['loadDisplay'] = 'pandagl'
|
||||||
if 'toonChatSounds' not in settings:
|
if 'toonChatSounds' not in settings:
|
||||||
settings['toonChatSounds'] = True
|
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: res', 'win-size %d %d' % tuple(settings.get('res', (800, 600))))
|
||||||
loadPrcFileData('Settings: fullscreen', 'fullscreen %s' % settings['fullscreen'])
|
loadPrcFileData('Settings: fullscreen', 'fullscreen %s' % settings['fullscreen'])
|
||||||
loadPrcFileData('Settings: music', 'audio-music-active %s' % settings['music'])
|
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: sfxVol', 'audio-master-sfx-volume %s' % settings['sfxVol'])
|
||||||
loadPrcFileData('Settings: loadDisplay', 'load-display %s' % settings['loadDisplay'])
|
loadPrcFileData('Settings: loadDisplay', 'load-display %s' % settings['loadDisplay'])
|
||||||
loadPrcFileData('Settings: toonChatSounds', 'toon-chat-sounds %s' % settings['toonChatSounds'])
|
loadPrcFileData('Settings: toonChatSounds', 'toon-chat-sounds %s' % settings['toonChatSounds'])
|
||||||
|
loadPrcFileData('Settings: language', 'language %s' % settings['language'])
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
@ -1,45 +1,38 @@
|
||||||
from panda3d.core import *
|
|
||||||
import string
|
import string
|
||||||
import types
|
import types
|
||||||
|
|
||||||
try:
|
try:
|
||||||
language = getConfigExpress().GetString('language', 'english')
|
language = settings['language']
|
||||||
checkLanguage = getConfigExpress().GetBool('check-language', 0)
|
|
||||||
except:
|
except:
|
||||||
language = simbase.config.GetString('language', 'english')
|
language = 'English'
|
||||||
checkLanguage = simbase.config.GetBool('check-language', 0)
|
|
||||||
|
|
||||||
def getLanguage():
|
def getLanguage():
|
||||||
return language
|
return language
|
||||||
|
|
||||||
|
|
||||||
print 'TTLocalizer: Running in language: %s' % 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 *
|
from toontown.toonbase.TTLocalizerEnglish import *
|
||||||
if checkLanguage:
|
|
||||||
|
if language != 'English':
|
||||||
l = {}
|
l = {}
|
||||||
g = {}
|
g = {}
|
||||||
|
module = 'toontown.toonbase.TTLocalizer' + language
|
||||||
englishModule = __import__('toontown.toonbase.TTLocalizerEnglish', g, l)
|
englishModule = __import__('toontown.toonbase.TTLocalizerEnglish', g, l)
|
||||||
foreignModule = __import__(_languageModule, g, l)
|
foreignModule = __import__(module, g, l)
|
||||||
for key, val in englishModule.__dict__.items():
|
for key, val in englishModule.__dict__.items():
|
||||||
if key not in foreignModule.__dict__:
|
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
|
locals()[key] = val
|
||||||
elif isinstance(val, types.DictType):
|
elif isinstance(val, types.DictType):
|
||||||
fval = foreignModule.__dict__.get(key)
|
fval = foreignModule.__dict__.get(key)
|
||||||
for dkey, dval in val.items():
|
for dkey, dval in val.items():
|
||||||
if dkey not in fval:
|
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
|
fval[dkey] = dval
|
||||||
|
|
||||||
for dkey in fval.keys():
|
for dkey in fval.keys():
|
||||||
if dkey not in val:
|
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():
|
for key in foreignModule.__dict__.keys():
|
||||||
if key not in englishModule.__dict__:
|
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