forked from CGM_Public/pretix_original
Refactor stubs for gettext JS function (#5170)
This commit is contained in:
@@ -1,26 +1,4 @@
|
||||
/*global $ */
|
||||
|
||||
function gettext(msgid) {
|
||||
if (typeof django !== 'undefined' && typeof django.gettext !== 'undefined') {
|
||||
return django.gettext(msgid);
|
||||
}
|
||||
return msgid;
|
||||
}
|
||||
|
||||
function ngettext(singular, plural, count) {
|
||||
if (typeof django !== 'undefined' && typeof django.ngettext !== 'undefined') {
|
||||
return django.ngettext(singular, plural, count);
|
||||
}
|
||||
return plural;
|
||||
}
|
||||
|
||||
function interpolate(fmt, object, named) {
|
||||
if (named) {
|
||||
return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
|
||||
} else {
|
||||
return fmt.replace(/%s/g, function(match){return String(obj.shift())});
|
||||
}
|
||||
}
|
||||
/*global $, gettext, ngettext, interpolate */
|
||||
|
||||
var form_handlers = function (el) {
|
||||
el.find('input, select, textarea').on('invalid', function (e) {
|
||||
|
||||
Reference in New Issue
Block a user