Skip to content

Instantly share code, notes, and snippets.

@JohnRSim
Created July 11, 2024 09:19
Show Gist options
  • Save JohnRSim/167975e289633fcb6bb6b2a1f992ecb6 to your computer and use it in GitHub Desktop.
Save JohnRSim/167975e289633fcb6bb6b2a1f992ecb6 to your computer and use it in GitHub Desktop.
// Function to update the translations object with new strings that need translating
function updateTranslations(textNodes, translations) {
textNodes.forEach(node => {
const originalText = node.nodeValue.trim();
if (!translations.hasOwnProperty(originalText)) {
translations[originalText] = "";
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment