Skip to content

Commit

Permalink
Fixed loading of JS translation catalogues in GTM template
Browse files Browse the repository at this point in the history
  • Loading branch information
tg666 committed Jun 21, 2024
1 parent 604df0d commit a887f58
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions gtm_template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2376,14 +2376,19 @@ const cookieConsentWrapperScript = scriptBaseUrl + 'cookie-consent.min.js';

for (let localeKey in locales) {
let locale = locales[localeKey];
let localeScript;
if (0 === locale.lastIndexOf('https://', 0) || 0 === locale.lastIndexOf('http://', 0)) {
continue;
if (-1 === locale.indexOf('.js', locale.length - 3)) {
continue;
}

localeScript = locale;
} else {
locale = 2 < locale.length ? locale[0] + locale[1] : locale;
localeScript = scriptBaseUrl + 'translations/' + locale + '.json.js';
}

locale = 2 < locale.length ? locale[0] + locale[1] : locale;
const localeScript = scriptBaseUrl + 'translations/' + locale + '.json.js';

if (queryPermission('inject_script', localeScript)) {
injectScript(localeScript, data.gtmOnSuccess, data.gtmOnFailure);
} else {
Expand Down

0 comments on commit a887f58

Please sign in to comment.