From eaf6da72727cdaa46d52ae7730b49d884acbba33 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 10 Jul 2019 14:31:49 +0200 Subject: [PATCH] Protect against main javascript being loaded before translations --- src/pretix/static/pretixcontrol/js/ui/main.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pretix/static/pretixcontrol/js/ui/main.js b/src/pretix/static/pretixcontrol/js/ui/main.js index 26187e7c33..7131b43bc0 100644 --- a/src/pretix/static/pretixcontrol/js/ui/main.js +++ b/src/pretix/static/pretixcontrol/js/ui/main.js @@ -1,5 +1,19 @@ /*global $,gettext*/ +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; +} + var waitingDialog = { show: function (message) { "use strict";