mirror of
https://github.com/netinvent/npbackup.git
synced 2025-02-24 14:35:36 +08:00
Make trnaslation manager more resilient
This commit is contained in:
parent
3bb60e394e
commit
a671231267
1 changed files with 8 additions and 1 deletions
|
@ -31,7 +31,7 @@ except (ValueError, AttributeError):
|
|||
try:
|
||||
_locale, _ = _locale.split("-")
|
||||
except (ValueError, AttributeError):
|
||||
pass
|
||||
_locale = "en"
|
||||
|
||||
try:
|
||||
i18n.load_path.append(TRANSLATIONS_DIR)
|
||||
|
@ -46,3 +46,10 @@ def _t(*args, **kwargs):
|
|||
return i18n.t(*args, **kwargs)
|
||||
except OSError as exc:
|
||||
logger.error("Translation not found in {}: {}".format(TRANSLATIONS_DIR, exc))
|
||||
except TypeError as exc:
|
||||
logger.error("Translation failed: {}".format(exc))
|
||||
logger.error("Arguments: {}".format(*args))
|
||||
if len(args) > 0:
|
||||
return args[0]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue