Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jemikanegara committed Oct 21, 2024
1 parent d396fd4 commit d7eb156
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions extractOptionsFromScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,16 @@ function extractOptionsFromScript(window, optsArgs = {
// const DATA_PREVENT_INIT_TRANSLATION = "data-prevent-init-translation" // default: false
// const preventInitialTranslation = window.translationScriptTag.getAttribute(DATA_PREVENT_INIT_TRANSLATION) == "true";

const customLinksAttribute = window.translationScriptTag.getAttribute(DATA_CUSTOM_LINKS);
const DATA_ACTIVE_SUBDOMAIN = "data-active-subdomain"; // default: undefined
const activeSubdomain = window.translationScriptTag.getAttribute(DATA_ACTIVE_SUBDOMAIN);

// prevent initial translation for subdomain (but allow translation on dynamic content)
if (activeSubdomain) {
window.preventInitialTranslation = true;
window.activeSubdomain = activeSubdomain;
}

const customLinksAttribute = window.translationScriptTag.getAttribute(`${DATA_CUSTOM_LINKS}-${activeSubdomain}`);
let customLinks = {};
try {
// format: [oldUrl,newUrl], [oldUrl,newUrl]
Expand All @@ -96,15 +105,6 @@ function extractOptionsFromScript(window, optsArgs = {
customLinks = {};
}

const DATA_ACTIVE_SUBDOMAIN = "data-active-subdomain"; // default: undefined
const activeSubdomain = window.translationScriptTag.getAttribute(DATA_ACTIVE_SUBDOMAIN);

// prevent initial translation for subdomain (but allow translation on dynamic content)
if (activeSubdomain) {
window.preventInitialTranslation = true;
window.activeSubdomain = activeSubdomain;
}

// FEATURE: Prevent Google Translate from translating the page
// Set the 'translate' attribute of the HTML tag to 'no'
window.document.documentElement.setAttribute('translate', 'no');
Expand Down

0 comments on commit d7eb156

Please sign in to comment.