From e690eb405f09a9e58b9d95ae98991352602635d6 Mon Sep 17 00:00:00 2001 From: Anton Bazhanov Date: Thu, 1 Dec 2016 16:39:48 +0300 Subject: [PATCH] Refs #27505 -- Made Paginator's exception messsages translatable. --- django/core/paginator.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/django/core/paginator.py b/django/core/paginator.py index e64d9804c5a..c77a62a1fe3 100644 --- a/django/core/paginator.py +++ b/django/core/paginator.py @@ -4,6 +4,7 @@ from math import ceil from django.utils import six from django.utils.functional import cached_property +from django.utils.translation import ugettext_lazy as _ class UnorderedObjectListWarning(RuntimeWarning): @@ -39,14 +40,14 @@ class Paginator(object): try: number = int(number) except (TypeError, ValueError): - raise PageNotAnInteger('That page number is not an integer') + raise PageNotAnInteger(_('That page number is not an integer')) if number < 1: - raise EmptyPage('That page number is less than 1') + raise EmptyPage(_('That page number is less than 1')) if number > self.num_pages: if number == 1 and self.allow_empty_first_page: pass else: - raise EmptyPage('That page contains no results') + raise EmptyPage(_('That page contains no results')) return number def page(self, number):