Fix locales path resolution with Python 3.

This commit is contained in:
Valentin Lorentz 2013-01-11 18:29:04 +01:00
parent 0ff58db4f0
commit c1f19b3353
1 changed files with 5 additions and 3 deletions

View File

@ -33,6 +33,7 @@ Supybot internationalisation and localisation managment.
__all__ = ['PluginInternationalization', 'internationalizeDocstring'] __all__ = ['PluginInternationalization', 'internationalizeDocstring']
import os
import re import re
import sys import sys
import time import time
@ -98,10 +99,11 @@ def getLocalePath(name, localeName, extension):
"""Gets the path of the locale file of the given plugin ('supybot' stands """Gets the path of the locale file of the given plugin ('supybot' stands
for the core).""" for the core)."""
if name != 'supybot': if name != 'supybot':
directory = getPluginDir(name) + 'locales' base = getPluginDir(name)
else: else:
import ansi # Any Supybot plugin could fit from . import ansi # Any Supybot plugin could fit
directory = ansi.__file__[0:-len('ansi.pyc')] + 'locales' base = ansi.__file__[0:-len('ansi.pyc')]
directory = os.path.join(base, 'locales')
return '%s/%s.%s' % (directory, localeName, extension) return '%s/%s.%s' % (directory, localeName, extension)
i18nClasses = {} i18nClasses = {}