mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-20 09:04:36 +01:00
src/i18n.py: fix error when running @reloadlocale with a plugin loaded before but not available any longer.
This commit is contained in:
parent
49e14f9a92
commit
1c366a2899
@ -50,6 +50,9 @@ MSGSTR = 'msgstr "'
|
||||
|
||||
currentLocale = 'en'
|
||||
|
||||
class PluginNotFound(Exception):
|
||||
pass
|
||||
|
||||
def getLocaleFromRegistryFilename(filename):
|
||||
"""Called by the 'supybot' script. Gets the locale name before conf is
|
||||
loaded."""
|
||||
@ -88,7 +91,7 @@ def getPluginDir(plugin_name):
|
||||
for allowed_file in allowed_files:
|
||||
if filename.endswith(allowed_file):
|
||||
return filename[0:-len(allowed_file)]
|
||||
raise Exception('Plugin %s not found by i18n.' % plugin_name)
|
||||
raise PluginNotFound()
|
||||
|
||||
def getLocalePath(name, localeName, extension):
|
||||
"""Gets the path of the locale file of the given plugin ('supybot' stands
|
||||
@ -153,7 +156,7 @@ class _PluginInternationalization:
|
||||
translationFile = open(getLocalePath(self.name,
|
||||
localeName, 'po'), 'r')
|
||||
self._parse(translationFile)
|
||||
except IOError: # The translation is unavailable
|
||||
except IOError, PluginNotFound: # The translation is unavailable
|
||||
self.translations = {}
|
||||
def _parse(self, translationFile):
|
||||
"""A .po files parser.
|
||||
|
Loading…
Reference in New Issue
Block a user