0001-misc-restore-select2-translations-54147.patch
src/authentic2/attribute_kinds.py | ||
---|---|---|
27 | 27 |
from django.core.files.storage import default_storage |
28 | 28 |
from django.core.validators import RegexValidator |
29 | 29 |
from django.db.models import query |
30 |
from django.urls import reverse |
|
30 |
from django.urls import reverse, reverse_lazy
|
|
31 | 31 |
from django.utils import formats, html |
32 | 32 |
from django.utils.functional import keep_lazy |
33 | 33 |
from django.utils.translation import pgettext_lazy |
... | ... | |
118 | 118 |
js = [ |
119 | 119 |
xstatic('jquery.js', 'jquery.min.js'), |
120 | 120 |
settings.SELECT2_JS, |
121 |
'authentic2/manager/js/select2_locale.js', |
|
122 |
reverse_lazy('a2-manager-javascript-catalog'), |
|
121 | 123 |
'authentic2/js/address_autocomplete.js', |
122 | 124 |
] |
123 | 125 |
css = { |
src/authentic2/manager/static/authentic2/manager/js/select2_locale.js | ||
---|---|---|
1 | 1 |
(function ($) { |
2 |
$.extend($.fn.select2.defaults, { |
|
3 |
formatMatches: function (matches) { |
|
4 |
if (matches === 1) { |
|
5 |
return gettext("One result is available, press enter to select it."); |
|
6 |
} |
|
7 |
return interpolate( |
|
8 |
gettext("%s results are available, use up and down arrow keys to navigate."), |
|
9 |
[matches]); |
|
10 |
}, |
|
11 |
formatNoMatches: function () { |
|
2 |
$.fn.select2.defaults.set('language', { |
|
3 |
noResults: function () { |
|
12 | 4 |
return gettext("No matches found"); |
13 | 5 |
}, |
14 |
formatAjaxError: function (jqXHR, textStatus, errorThrown) {
|
|
6 |
errorLoading: function (jqXHR, textStatus, errorThrown) {
|
|
15 | 7 |
return gettext("Loading failed"); |
16 | 8 |
}, |
17 |
formatInputTooShort: function (input, min) {
|
|
9 |
inputTooShort: function (input, min) {
|
|
18 | 10 |
var n = min - input.length; |
19 | 11 |
return interpolate( |
20 | 12 |
ngettext("Please enter %s or more character", "Please enter %s or more characters", n), |
21 | 13 |
[n]); |
22 | 14 |
}, |
23 |
formatInputTooLong: function (input, max) {
|
|
15 |
inputTooLong: function (input, max) {
|
|
24 | 16 |
var n = input.length - max; |
25 | 17 |
return interpolate( |
26 | 18 |
ngettext("Please delete %s character", "Please delete %s characters", n), |
27 | 19 |
[n]); |
28 | 20 |
}, |
29 |
formatSelectionTooBig: function (limit) {
|
|
21 |
maximumSelected: function (limit) {
|
|
30 | 22 |
return interpolate( |
31 | 23 |
ngettext("You can only select %s item", "You can only select %s items", limit), |
32 | 24 |
[limit]); |
33 | 25 |
}, |
34 |
formatLoadMore: function (pageNumber) {
|
|
26 |
loadingMore: function (pageNumber) {
|
|
35 | 27 |
return gettext("Loading more results…"); |
36 | 28 |
}, |
37 |
formatSearching: function () {
|
|
29 |
searching: function () {
|
|
38 | 30 |
return gettext("Searching…"); |
39 | 31 |
} |
40 | 32 |
}); |
src/authentic2/manager/widgets.py | ||
---|---|---|
48 | 48 | |
49 | 49 | |
50 | 50 |
class Select2Mixin(object): |
51 |
class Media: |
|
52 |
js = ('authentic2/manager/js/select2_locale.js',) |
|
53 | ||
51 | 54 |
def build_attrs(self, *args, **kwargs): |
52 | 55 |
attrs = super(Select2Mixin, self).build_attrs(*args, **kwargs) |
53 | 56 |
field_data = { |
src/authentic2/templates/select2_locale.html | ||
---|---|---|
1 |
{% load i18n %} |
|
2 | ||
3 |
{# Translations of select2 autocompletion field hints #} |
|
4 |
{% trans "Searching..." %} |
|
5 |
{% trans "No matches found" %} |
|
6 |
{% trans "Please enter more characters" %} |
|
7 |
{% trans "Loading more results..." %} |
|
8 |
{% trans "The results could not be loaded" %} |
|
9 |
- |