misc: restore select2 translations (#54147)
Also revert previous fix attempt of commit 0676783c
.
This commit is contained in:
parent
a921332fb2
commit
92a9886872
|
@ -27,7 +27,7 @@ from django.core.exceptions import ValidationError
|
|||
from django.core.files.storage import default_storage
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db.models import query
|
||||
from django.urls import reverse
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils import formats, html
|
||||
from django.utils.functional import keep_lazy
|
||||
from django.utils.translation import pgettext_lazy
|
||||
|
@ -118,6 +118,8 @@ class AddressAutocompleteInput(forms.Select):
|
|||
js = [
|
||||
xstatic('jquery.js', 'jquery.min.js'),
|
||||
settings.SELECT2_JS,
|
||||
'authentic2/manager/js/select2_locale.js',
|
||||
reverse_lazy('a2-manager-javascript-catalog'),
|
||||
'authentic2/js/address_autocomplete.js',
|
||||
]
|
||||
css = {
|
||||
|
|
|
@ -1,40 +1,32 @@
|
|||
(function ($) {
|
||||
$.extend($.fn.select2.defaults, {
|
||||
formatMatches: function (matches) {
|
||||
if (matches === 1) {
|
||||
return gettext("One result is available, press enter to select it.");
|
||||
}
|
||||
return interpolate(
|
||||
gettext("%s results are available, use up and down arrow keys to navigate."),
|
||||
[matches]);
|
||||
},
|
||||
formatNoMatches: function () {
|
||||
$.fn.select2.defaults.set('language', {
|
||||
noResults: function () {
|
||||
return gettext("No matches found");
|
||||
},
|
||||
formatAjaxError: function (jqXHR, textStatus, errorThrown) {
|
||||
errorLoading: function (jqXHR, textStatus, errorThrown) {
|
||||
return gettext("Loading failed");
|
||||
},
|
||||
formatInputTooShort: function (input, min) {
|
||||
inputTooShort: function (input, min) {
|
||||
var n = min - input.length;
|
||||
return interpolate(
|
||||
ngettext("Please enter %s or more character", "Please enter %s or more characters", n),
|
||||
[n]);
|
||||
},
|
||||
formatInputTooLong: function (input, max) {
|
||||
inputTooLong: function (input, max) {
|
||||
var n = input.length - max;
|
||||
return interpolate(
|
||||
ngettext("Please delete %s character", "Please delete %s characters", n),
|
||||
[n]);
|
||||
},
|
||||
formatSelectionTooBig: function (limit) {
|
||||
maximumSelected: function (limit) {
|
||||
return interpolate(
|
||||
ngettext("You can only select %s item", "You can only select %s items", limit),
|
||||
[limit]);
|
||||
},
|
||||
formatLoadMore: function (pageNumber) {
|
||||
loadingMore: function (pageNumber) {
|
||||
return gettext("Loading more results…");
|
||||
},
|
||||
formatSearching: function () {
|
||||
searching: function () {
|
||||
return gettext("Searching…");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -48,6 +48,9 @@ class SplitTermMixin(object):
|
|||
|
||||
|
||||
class Select2Mixin(object):
|
||||
class Media:
|
||||
js = ('authentic2/manager/js/select2_locale.js',)
|
||||
|
||||
def build_attrs(self, *args, **kwargs):
|
||||
attrs = super(Select2Mixin, self).build_attrs(*args, **kwargs)
|
||||
field_data = {
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
{% load i18n %}
|
||||
|
||||
{# Translations of select2 autocompletion field hints #}
|
||||
{% trans "Searching..." %}
|
||||
{% trans "No matches found" %}
|
||||
{% trans "Please enter more characters" %}
|
||||
{% trans "Loading more results..." %}
|
||||
{% trans "The results could not be loaded" %}
|
Loading…
Reference in New Issue