diff --git a/scripts/supybot b/scripts/supybot index c3e17b1b8..1a91a28e9 100644 --- a/scripts/supybot +++ b/scripts/supybot @@ -213,7 +213,6 @@ if __name__ == '__main__': registryFilename = args.pop() try: # The registry *MUST* be opened before importing log or conf. - i18n.getLocaleFromRegistryFilename(registryFilename) registry.open_registry(registryFilename) shutil.copyfile(registryFilename, registryFilename + '.bak') except registry.InvalidRegistryFile as e: @@ -229,6 +228,8 @@ if __name__ == '__main__': sys.stderr.write(os.linesep) sys.exit(-1) + i18n.getLocaleFromRegistryCache() + try: import supybot.log as log except supybot.registry.InvalidRegistryValue as e: diff --git a/src/i18n.py b/src/i18n.py index 4eaf00c24..1b702035f 100644 --- a/src/i18n.py +++ b/src/i18n.py @@ -52,14 +52,12 @@ currentLocale = 'en' class PluginNotFound(Exception): pass -def getLocaleFromRegistryFilename(filename): +def getLocaleFromRegistryCache(): """Called by the 'supybot' script. Gets the locale name before conf is loaded.""" global currentLocale - with open(filename, 'r') as fd: - for line in fd: - if line.startswith('supybot.language: '): - currentLocale = line[len('supybot.language: '):] + import supybot.registry as registry + currentLocale = registry._cache['supybot.language'] def import_conf(): """Imports the conf into this module"""