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 May 18, 2022
1 parent 264aa89 commit fe3b755
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 fe3b755

Please sign in to comment.