Poodletooth-iLand/toontown/toonbase/TTLocalizer.py

39 lines
1.3 KiB
Python
Raw Normal View History

2015-03-03 16:10:12 -06:00
import string
import types
2015-03-13 10:02:14 -05:00
2015-03-03 16:10:12 -06:00
try:
2015-03-13 10:02:14 -05:00
language = settings['language']
2015-03-03 16:10:12 -06:00
except:
2015-03-13 10:02:14 -05:00
language = 'English'
2015-03-03 16:10:12 -06:00
def getLanguage():
return language
print 'TTLocalizer: Running in language: %s' % language
from toontown.toonbase.TTLocalizerEnglish import *
2015-03-13 10:02:14 -05:00
if language != 'English':
2015-03-03 16:10:12 -06:00
l = {}
g = {}
2015-03-13 10:02:14 -05:00
module = 'toontown.toonbase.TTLocalizer' + language
2015-03-03 16:10:12 -06:00
englishModule = __import__('toontown.toonbase.TTLocalizerEnglish', g, l)
2015-03-13 10:02:14 -05:00
foreignModule = __import__(module, g, l)
2015-03-03 16:10:12 -06:00
for key, val in englishModule.__dict__.items():
if key not in foreignModule.__dict__:
2015-03-13 10:02:14 -05:00
print 'WARNING: Foreign module: %s missing key: %s' % (module, key)
2015-03-03 16:10:12 -06:00
locals()[key] = val
elif isinstance(val, types.DictType):
fval = foreignModule.__dict__.get(key)
for dkey, dval in val.items():
if dkey not in fval:
2015-03-13 10:02:14 -05:00
print 'WARNING: Foreign module: %s missing key: %s.%s' % (module, key, dkey)
2015-03-03 16:10:12 -06:00
fval[dkey] = dval
for dkey in fval.keys():
if dkey not in val:
2015-03-13 10:02:14 -05:00
print 'WARNING: Foreign module: %s extra key: %s.%s' % (module, key, dkey)
2015-03-03 16:10:12 -06:00
for key in foreignModule.__dict__.keys():
if key not in englishModule.__dict__:
2015-03-13 10:02:14 -05:00
print 'WARNING: Foreign module: %s extra key: %s' % (module, key)