[fix] Do not fail if no namespace is loaded for translations

This commit is contained in:
Jérôme Lebleu 2014-06-03 14:24:27 +02:00
parent 6842d726cc
commit 94db1ace38

View file

@ -288,7 +288,9 @@ class Moulinette18n(object):
""" """
if not self._namespace: if not self._namespace:
raise RuntimeError("No namespace loaded for translation") logging.error("attempt to retrieve translation for key '%s' " \
"but no namespace is loaded" % key)
return key
return self._namespace[1].translate(key, *args, **kwargs) return self._namespace[1].translate(key, *args, **kwargs)
@ -353,10 +355,7 @@ class MoulinetteSignals(object):
# Retrieve help translation since it's not loaded yet # Retrieve help translation since it's not loaded yet
if help: if help:
try:
help = m18n.n(help) help = m18n.n(help)
except: pass
return self._authenticate(authenticator, help) return self._authenticate(authenticator, help)
def prompt(self, message, is_password=False, confirm=False): def prompt(self, message, is_password=False, confirm=False):