Fix compatibility with Windows ('u' flag not supported by open())

This commit is contained in:
Valentin Lorentz 2011-05-07 09:12:03 +02:00
parent ce29bf8b5c
commit 8979475e13

View File

@ -146,9 +146,12 @@ class _PluginInternationalization:
self._loadL10nCode()
try:
translationFile = open(getLocalePath(self.name, localeName, 'po'),
'ru') # ru is the mode, not the beginning
# of 'russian' ;)
try:
translationFile = open(getLocalePath(self.name,
localeName, 'po'), 'ru')
except ValueError: # We are using Windows
translationFile = open(getLocalePath(self.name,
localeName, 'po'), 'r')
self._parse(translationFile)
except IOError: # The translation is unavailable
self.translations = {}