Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jemikanegara committed May 28, 2024
1 parent cffb205 commit c9fc53e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,23 @@ function updateNode(node, language, type = "text") {
// merge the falsy value into the previous string
const mergedSplitted = splitted.reduce((acc, curr, index) => {
if (typeof curr != 'string') {
console.log("node.textContent typeof curr != 'string'", curr)
return acc;
}

if (typeof curr == 'string' && !curr.trim()) {
console.log("node.textContent typeof curr == 'string' && !curr.trim()", curr)
acc[acc.length - 1] += curr;
return acc;
}

return [...acc, curr];
}, []);
console.log("node.textContent mergedSplitted", mergedSplitted)

const mergedOrphanString = mergedSplitted.reduce((acc, curr, index) => {
const findTranslationKey = Object.entries(translatedMap).find(([key, value]) => curr.includes(value))?.[0];
console.log("node.textContent findTranslationKey", findTranslationKey)
if (!findTranslationKey) {
return [
...acc,
Expand All @@ -143,6 +147,7 @@ function updateNode(node, language, type = "text") {
}

const findIndex = fullTextArray.findIndex(key => key.trim() == findTranslationKey.trim());
console.log("node.textContent findIndex", findIndex)
if (findIndex == -1) {
return [
...acc,
Expand Down
2 changes: 1 addition & 1 deletion utils/selector/createLanguageSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ async function createLanguageSelect(apiKey, optsArgs = {}) {
}
}

autoPosition();
weploySwitcher.onclick = autoPosition

if (languages.length < 2) {
Expand Down Expand Up @@ -279,6 +278,7 @@ async function createLanguageSelect(apiKey, optsArgs = {}) {
});

if (!initializedSelectorByUser) weploySwitcher.appendChild(details);
autoPosition();
}
});
}
Expand Down

0 comments on commit c9fc53e

Please sign in to comment.