Skip to content
This repository has been archived by the owner on Apr 17, 2021. It is now read-only.

Commit

Permalink
Added Russian locale
Browse files Browse the repository at this point in the history
  • Loading branch information
desecho authored and jmcclell committed Oct 13, 2018
1 parent 5409a6b commit fd58ac6
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 17 deletions.
Binary file added bootstrap_pagination/locale/ru/LC_MESSAGES/django.mo
Binary file not shown.
54 changes: 54 additions & 0 deletions bootstrap_pagination/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-22 04:23-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Anton Samarchyan <desecho@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"

#: templates/bootstrap_pagination/pagination.html:12
msgid "First Page"
msgstr "Первая Страница"

#: templates/bootstrap_pagination/pagination.html:19
#: templates/bootstrap_pagination/pagination.html:23
#: templatetags/bootstrap_pagination.py:102
#: templatetags/bootstrap_pagination.py:104
msgid "Previous Page"
msgstr "Предыдущая Страница"

#: templates/bootstrap_pagination/pagination.html:30
msgid "Current Page"
msgstr "Текущая Страница"

#: templates/bootstrap_pagination/pagination.html:34
msgid "Page"
msgstr "Страница"

#: templates/bootstrap_pagination/pagination.html:41
#: templates/bootstrap_pagination/pagination.html:45
#: templatetags/bootstrap_pagination.py:103
#: templatetags/bootstrap_pagination.py:105
msgid "Next Page"
msgstr "Следующая Страница"

#: templates/bootstrap_pagination/pagination.html:52
#: templates/bootstrap_pagination/pagination.html:56
msgid "Last Page"
msgstr "Последняя Страница"

msgid "of"
msgstr "из"
21 changes: 11 additions & 10 deletions bootstrap_pagination/templates/bootstrap_pagination/pagination.html
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
{% load i18n %}
{% load bootstrap_pagination %}
<ul class="pagination{% if size == "small" %} pagination-sm{% endif %}{% if size == "large" %} pagination-lg{% endif %} {{ extra_pagination_classes }}">
{% if show_first_last %}
{% if not page.has_previous %}
<li class="page-item disabled">
<span class="page-link" aria-hidden="true" title="First Page">{{ first_label }}</span>
<span class="page-link" aria-hidden="true" title="{% trans 'First Page' %}">{{ first_label }}</span>
</li>
{% else %}
<li class="page-item">
<a class="page-link" aria-label="First Page" title="First Page" href="{{ first_page_url|default:"#"|escape }}"><span aria-hidden="true">{{first_label}}</span></a>
<a class="page-link" aria-label="{% trans 'First Page' %}" title="{% trans 'First Page' %}" href="{{ first_page_url|default:"#"|escape }}"><span aria-hidden="true">{{first_label}}</span></a>
</li>
{% endif %}
{% endif %}
{% if show_prev_next %}
{% if not page.has_previous %}
<li class="page-item disabled">
<span class="page-link" aria-hidden="true" title="Previous Page">{{ previous_label }}</span>
<span class="page-link" aria-hidden="true" title="{% trans 'Previous Page' %}">{{ previous_label }}</span>
</li>
{% else %}
<li class="page-item">
<a class="page-link" aria-label="Previous Page" title="Previous Page" href="{{ previous_page_url|default:"#"|escape }}"><span aria-hidden="true">{{ previous_label }}</span></a>
<a class="page-link" aria-label="{% trans 'Previous Page' %}" title="{% trans 'Previous Page' %}" href="{{ previous_page_url|default:"#"|escape }}"><span aria-hidden="true">{{ previous_label }}</span></a>
</li>
{% endif %}
{% endif %}
{% for pagenum, index_range, url in page_urls %}
{% if page.number == pagenum %}
<li class="page-item active">
<span class="page-link" aria-label="Current Page" title="Current Page">{% if show_index_range %} {{ index_range }} {% else %} {{ pagenum }} {% endif %}</span>
<span class="page-link" aria-label="{% trans 'Current Page' %}" title="{% trans 'Current Page' %}">{% if show_index_range %} {{ index_range }} {% else %} {{ pagenum }} {% endif %}</span>
</li>
{% else %}
<li class="page-item">
<a class="page-link" aria-label="Page {{ pagenum }} of {{ page.paginator.num_pages }}" title="Page {{ pagenum }} of {{ page.paginator.num_pages }}" href="{{ url|escape }}">{% if show_index_range %} {{ index_range }} {% else %} {{ pagenum }} {% endif %}</a>
<a class="page-link" aria-label="{% trans 'Page' %} {{ pagenum }} {% trans 'of' %} {{ page.paginator.num_pages }}" title="{% trans 'Page' %} {{ pagenum }} {% trans 'of' %} {{ page.paginator.num_pages }}" href="{{ url|escape }}">{% if show_index_range %} {{ index_range }} {% else %} {{ pagenum }} {% endif %}</a>
</li>
{% endif %}
{% endfor %}
{% if show_prev_next %}
{% if not page.has_next %}
<li class="page-item disabled">
<span class="page-link" aria-hidden="true" title="Next Page">{{ next_label }}</span>
<span class="page-link" aria-hidden="true" title="{% trans 'Next Page' %}">{{ next_label }}</span>
</li>
{% else %}
<li class="page-item">
<a class="page-link" aria-label="Next Page" title="Next Page" href="{{ next_page_url|default:"#"|escape }}"><span aria-hidden="true">{{ next_label }}</span></a>
<a class="page-link" aria-label="{% trans 'Next Page' %}" title="{% trans 'Next Page' %}" href="{{ next_page_url|default:"#"|escape }}"><span aria-hidden="true">{{ next_label }}</span></a>
</li>
{% endif %}
{% endif %}
{% if show_first_last %}
{% if not page.has_next %}
<li class="page-item disabled">
<span class="page-link" aria-hidden="true" title="Last Page" >{{ last_label }}</span>
<span class="page-link" aria-hidden="true" title="{% trans 'Last Page' %}" >{{ last_label }}</span>
</li>
{% else %}
<li class="page-item">
<a class="page-link" aria-label="Last Page" title="Last Page" href="{{ last_page_url|default:"#"|escape }}"><span aria-hidden="true">{{last_label}}</span></a>
<a class="page-link" aria-label="{% trans 'Last Page' %}" title="{% trans 'Last Page' %}" href="{{ last_page_url|default:"#"|escape }}"><span aria-hidden="true">{{last_label}}</span></a>
</li>
{% endif %}
{% endif %}
Expand Down
15 changes: 8 additions & 7 deletions bootstrap_pagination/templatetags/bootstrap_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
from django.conf import settings
from django.http import QueryDict
from django.utils.html import mark_safe
from django.utils.translation import ugettext_lazy as _


# As of django 1.10, template rendering no longer accepts a context, but
# instead accepts only accepts a dict. Up until django 1.8, a context was
# As of django 1.10, template rendering no longer accepts a context, but
# instead accepts only accepts a dict. Up until django 1.8, a context was
# actually required. Fortunately Context takes a single dict parameter,
# so for django >=1.9 we can get away with just passing a unit function.
if django.VERSION < (1, 9, 0):
Expand Down Expand Up @@ -116,10 +117,10 @@ def render(self, context):
except VariableDoesNotExist:
kwargs[argname] = None

previous_label = mark_safe(kwargs.get("previous_label", "Previous Page"))
next_label = mark_safe(kwargs.get("next_label", "Next Page"))
previous_title = mark_safe(kwargs.get("previous_title", "Previous Page"))
next_title = mark_safe(kwargs.get("next_title", "Next Page"))
previous_label = mark_safe(kwargs.get("previous_label", _("Previous Page")))
next_label = mark_safe(kwargs.get("next_label", _("Next Page")))
previous_title = mark_safe(kwargs.get("previous_title", _("Previous Page")))
next_title = mark_safe(kwargs.get("next_title", _("Next Page")))

url_view_name = kwargs.get("url_view_name", None)
if url_view_name is not None:
Expand Down Expand Up @@ -241,7 +242,7 @@ def render(self, context):
index_range = "%s-%s" % (1 + (curpage - 1) * page.paginator.per_page, len(page.paginator.object_list), )
else:
index_range = "%s-%s" % (1 + (curpage - 1) * page.paginator.per_page, curpage * page.paginator.per_page, )

url = get_page_url(curpage, get_current_app(context), url_view_name, url_extra_args, url_extra_kwargs, url_param_name, url_get_params, url_anchor)
page_urls.append((curpage, index_range, url))

Expand Down

0 comments on commit fd58ac6

Please sign in to comment.