From 66268b4e578750bdc842b8c0724873b9dc8be419 Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Thu, 4 Mar 2021 15:53:39 +0100 Subject: [PATCH] Stop loading jQuery from Google --- rosetta/templates/rosetta/base.html | 6 +----- rosetta/templates/rosetta/js/rosetta.js | 5 ++++- testproject/locale/fr/LC_MESSAGES/django.po | 5 +++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/rosetta/templates/rosetta/base.html b/rosetta/templates/rosetta/base.html index 9431ee2..46e9694 100644 --- a/rosetta/templates/rosetta/base.html +++ b/rosetta/templates/rosetta/base.html @@ -10,13 +10,9 @@ - + diff --git a/rosetta/templates/rosetta/js/rosetta.js b/rosetta/templates/rosetta/js/rosetta.js index b6fa5c4..bd45b20 100644 --- a/rosetta/templates/rosetta/js/rosetta.js +++ b/rosetta/templates/rosetta/js/rosetta.js @@ -1,12 +1,14 @@ {% load rosetta %} -google.setOnLoadCallback(function() { +$(document).ready(function() { + $('.location a').show().toggle(function() { $('.hide', $(this).parent()).show(); }, function() { $('.hide', $(this).parent()).hide(); }); + {% if rosetta_settings.ENABLE_TRANSLATION_SUGGESTIONS %} {% if rosetta_settings.AZURE_CLIENT_SECRET or rosetta_settings.GOOGLE_APPLICATION_CREDENTIALS_PATH %} @@ -96,6 +98,7 @@ google.setOnLoadCallback(function() { origs=$(this).parents('tr').find('.original>.message').html().match(RX), trads=$(this).val().match(RX), error = $('Unmatched variables'); + if (origs && trads) { for (var i = trads.length; i--;){ var key = trads[i]; diff --git a/testproject/locale/fr/LC_MESSAGES/django.po b/testproject/locale/fr/LC_MESSAGES/django.po index 2521819..3f15d97 100644 --- a/testproject/locale/fr/LC_MESSAGES/django.po +++ b/testproject/locale/fr/LC_MESSAGES/django.po @@ -33,3 +33,8 @@ msgid_plural "" "%(num_bottles)s bottles of beer on the wall\n" msgstr[0] "" msgstr[1] "" + + +#: templates/test.html:3 +msgid "We need %(num_bottles)s bottles!" +msgstr ""