diff --git a/zerver/decorator.py b/zerver/decorator.py index 9c24c149d9..ccb74df954 100644 --- a/zerver/decorator.py +++ b/zerver/decorator.py @@ -316,7 +316,7 @@ def authenticated_rest_api_view(view_func): except ValueError: return json_error(_("Invalid authorization header for basic auth")) except KeyError: - return json_unauthorized("Missing authorization header for basic auth") + return json_unauthorized(_("Missing authorization header for basic auth")) # Now we try to do authentication or die try: diff --git a/zerver/lib/rest.py b/zerver/lib/rest.py index d2bb327cd6..ded646437f 100644 --- a/zerver/lib/rest.py +++ b/zerver/lib/rest.py @@ -1,6 +1,8 @@ from __future__ import absolute_import from typing import Any, Dict + +from django.utils.translation import ugettext as _ from django.views.decorators.csrf import csrf_exempt, csrf_protect from zerver.decorator import authenticated_json_view, authenticated_rest_api_view, \ @@ -82,7 +84,7 @@ def rest_dispatch(request, globals_list, **kwargs): # browser, send the user to the login page return HttpResponseRedirect('%s/?next=%s' % (settings.HOME_NOT_LOGGED_IN, request.path)) else: - return json_unauthorized("Not logged in: API authentication or user session required") + return json_unauthorized(_("Not logged in: API authentication or user session required")) if request.method not in ["GET", "POST"]: # process_as_post needs to be the outer decorator, because