mirror of https://github.com/zulip/zulip.git
translation: Try the new `err_` marking on a handful of messages.
This commit is contained in:
parent
76cc6d8352
commit
271cfd4d7a
|
@ -3,7 +3,7 @@ from typing import Any, Dict, Optional, Text, Union, cast
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _, ugettext as err_
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.views.decorators.http import require_GET
|
from django.views.decorators.http import require_GET
|
||||||
|
@ -24,12 +24,12 @@ from zilencer.models import RemotePushDeviceToken, RemoteZulipServer
|
||||||
|
|
||||||
def validate_entity(entity: Union[UserProfile, RemoteZulipServer]) -> None:
|
def validate_entity(entity: Union[UserProfile, RemoteZulipServer]) -> None:
|
||||||
if not isinstance(entity, RemoteZulipServer):
|
if not isinstance(entity, RemoteZulipServer):
|
||||||
raise JsonableError(_("Must validate with valid Zulip server API key"))
|
raise JsonableError(err_("Must validate with valid Zulip server API key"))
|
||||||
|
|
||||||
def validate_bouncer_token_request(entity: Union[UserProfile, RemoteZulipServer],
|
def validate_bouncer_token_request(entity: Union[UserProfile, RemoteZulipServer],
|
||||||
token: bytes, kind: int) -> None:
|
token: bytes, kind: int) -> None:
|
||||||
if kind not in [RemotePushDeviceToken.APNS, RemotePushDeviceToken.GCM]:
|
if kind not in [RemotePushDeviceToken.APNS, RemotePushDeviceToken.GCM]:
|
||||||
raise JsonableError(_("Invalid token type"))
|
raise JsonableError(err_("Invalid token type"))
|
||||||
validate_entity(entity)
|
validate_entity(entity)
|
||||||
validate_token(token, kind)
|
validate_token(token, kind)
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ def remote_server_unregister_push(request: HttpRequest, entity: Union[UserProfil
|
||||||
kind=token_kind,
|
kind=token_kind,
|
||||||
server=server).delete()
|
server=server).delete()
|
||||||
if deleted[0] == 0:
|
if deleted[0] == 0:
|
||||||
return json_error(_("Token does not exist"))
|
return json_error(err_("Token does not exist"))
|
||||||
|
|
||||||
return json_success()
|
return json_success()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue