Skip to content

Commit

Permalink
js: fixup gettext in django 3.1
Browse files Browse the repository at this point in the history
For some reason in Django 3.1 django.gettext is not available anymore in the scope,
it's available as window.gettext though. Update translate.js to work
with both locations.

This was already reported here:
geex-arts#149

Fix tikservices#25
  • Loading branch information
xrmx committed Feb 24, 2021
1 parent 56472b7 commit c6396f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jet/static/jet/js/src/utils/translate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = function(str) {
if (window.django == undefined) {
const gettext = django.gettext || window.gettext;
if (gettext == undefined) {
return str;
}
return django.gettext(str);
return gettext(str);
};

0 comments on commit c6396f6

Please sign in to comment.