Skip to content

Commit

Permalink
Translations for HTML filters
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie committed Aug 28, 2015
1 parent 0b77e73 commit f34777a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion rest_framework/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from django.db import models
from django.template import Context, loader
from django.utils import six
from django.utils.translation import ugettext_lazy as _

from rest_framework.compat import (
crispy_forms, distinct, django_filters, get_model_name, guardian
Expand All @@ -31,7 +32,7 @@ def __init__(self, *args, **kwargs):
field.help_text = None

layout_components = list(self.form.fields.keys()) + [
Submit('', 'Submit', css_class='btn-default'),
Submit('', _('Submit'), css_class='btn-default'),
]

helper = FormHelper()
Expand Down
2 changes: 1 addition & 1 deletion rest_framework/templates/rest_framework/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
{% if filter_form %}
<button style="float: right; margin-right: 10px" data-toggle="modal" data-target="#filtersModal" class="btn btn-default">
<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
Filters
{% trans "Filters" %}
</button>
{% endif %}

Expand Down
3 changes: 2 additions & 1 deletion rest_framework/templates/rest_framework/base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load staticfiles %}
{% load rest_framework %}
{% load i18n %}
<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -112,7 +113,7 @@
{% if filter_form %}
<button style="float: right; margin-right: 10px" data-toggle="modal" data-target="#filtersModal" class="btn btn-default">
<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
Filters
{% trans "Filters" %}
</button>
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<h2>Field filters</h2>
{% load i18n %}
<h2>{% trans "Field filters" %}</h2>
<form class="form" action="" method="get">
{{ filter.form.as_p }}
<button type="submit" class="btn btn-primary">Submit</button>
<button type="submit" class="btn btn-primary">{% trans "Submit" %}</button>
</form>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load crispy_forms_tags %}
{% load i18n %}

<h2>Field filters</h2>
<h2>{% trans "Field filters" %}</h2>
{% crispy filter.form %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load rest_framework %}
<h2>Ordering</h2>
{% load i18n %}
<h2>{% trans "Ordering" %}</h2>
<div class="list-group">
{% for key, label in options %}
{% if key == current %}
Expand Down
3 changes: 2 additions & 1 deletion rest_framework/templates/rest_framework/filters/search.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<h2>Search</h2>
{% load i18n %}
<h2>{% trans "Search" %}</h2>
<form class="form-inline">
<div class="form-group">
<div class="input-group">
Expand Down

0 comments on commit f34777a

Please sign in to comment.