globalseo
Advanced tools
Comparing version 2.2.21 to 2.2.22
{ | ||
"name": "globalseo", | ||
"version": "2.2.21", | ||
"version": "2.2.22", | ||
"description": "Translate your React.js or Next.js app with AI", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -81,2 +81,14 @@ const { getGlobalseoOptions, MERGE_PREFIX, setIsTranslationInitialized } = require("../configs"); | ||
// translate input type="submit" & input type="button" | ||
const inputTypeButtonTags = Array.from(window.document.querySelectorAll('input[type="button"]')); | ||
const inputTypeSubmitTags = Array.from(window.document.querySelectorAll('input[type="submit"]')); | ||
const cleanInputTypeButtonTags = inputTypeButtonTags.filter((node) => (node.value || "").trim() && !isExcludedClassName(window,node.className) && !isExcludedId(window, node.id)); | ||
const cleanInputTypeSubmitTags = inputTypeSubmitTags.filter((node) => (node.value || "").trim() && !isExcludedClassName(window,node.className) && !isExcludedId(window, node.id)); | ||
otherNodes.push( | ||
...cleanInputTypeButtonTags, | ||
...cleanInputTypeSubmitTags, | ||
) | ||
const textNodes = []; | ||
@@ -83,0 +95,0 @@ extractTextNodes(window, rootElement, textNodes); |
@@ -170,3 +170,3 @@ const { isCompressionSupported } = require("../compressions"); | ||
if (node.tagName == "TEXTAREA" || node.tagName == "INPUT") { | ||
if (node.tagName == "TEXTAREA" || (node.tagName == "INPUT" && node.type != "button" && node.type != "submit")) { | ||
const placeholderCache = window.translationCache?.[window.location.pathname]?.[language]?.[node.placeholder] | ||
@@ -185,2 +185,16 @@ // make sure the placeholder is not empty | ||
if(node.tagName == "INPUT" && (node.type == "button" || node.type == "submit")) { | ||
const valueCache = window.translationCache?.[window.location.pathname]?.[language]?.[node.value] | ||
// make sure the value is not empty | ||
if ( | ||
(node.value || "").trim() && !valueCache && !allTranslationValuesInAllPages.includes(node.value) | ||
) { | ||
notInCache.push(node.value); | ||
} | ||
if (valueCache) { | ||
updateNode(window, node, language, "form", 5.20); | ||
} | ||
} | ||
if(node.tagName == "OPTION") { | ||
@@ -187,0 +201,0 @@ const cache = window.translationCache?.[window.location.pathname]?.[language]?.[node.textContent] |
@@ -57,3 +57,3 @@ const { DEFAULT_UNTRANSLATED_VALUE, MERGE_PREFIX } = require("../configs"); | ||
if (type == "form" && (node.tagName == "TEXTAREA" || node.tagName == "INPUT")) { | ||
if (type == "form" && (node.tagName == "TEXTAREA" || (node.tagName == "INPUT" && node.type != "button" && node.type != "submit"))) { | ||
const newPlaceholder = window.translationCache?.[window.location.pathname]?.[language]?.[node.placeholder] || ""; | ||
@@ -66,2 +66,10 @@ if (newPlaceholder && !newPlaceholder.includes(DEFAULT_UNTRANSLATED_VALUE)) { | ||
if (type == "form" && (node.tagName == "INPUT" && (node.type == "button" || node.type == "submit"))) { | ||
const newValue = window.translationCache?.[window.location.pathname]?.[language]?.[node.value] || ""; | ||
if (newValue && !newValue.includes(DEFAULT_UNTRANSLATED_VALUE)) { | ||
node.value = decodeHTMLEntities(window, newValue); | ||
} | ||
return; | ||
} | ||
if (type == "form" && node.tagName == "OPTION") { | ||
@@ -68,0 +76,0 @@ const newText = window.translationCache?.[window.location.pathname]?.[language]?.[node.textContent] || ""; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
581409
3648