def safe_translation(f):
 @wraps(f)
 def wrapper(locale, *args, **kwargs):
  try:
   with translation.override(locale):
    return f(locale, *args, **kwargs)
  except (TypeError, KeyError, ValueError, IndexError) as e:
   log.error('Bad translation in locale "%s": %s', locale, e)
   with translation.override(settings.WIKI_DEFAULT_LANGUAGE):
    return f(settings.WIKI_DEFAULT_LANGUAGE, *args, **kwargs)
 return wrapper

def safe_translation ( f ) : @ wraps ( f ) def wrapper ( locale , * args , ** kwargs ) : try : with translation . override ( locale ) : return f ( locale , * args , ** kwargs ) except ( TypeError , KeyError , ValueError , IndexError ) as e : log . error ( 'Bad translation in locale "%s": %s' , locale , e ) with translation . override ( settings . WIKI_DEFAULT_LANGUAGE ) : return f ( settings . WIKI_DEFAULT_LANGUAGE , * args , ** kwargs ) return wrapper
call f which has first argument locale .