Home
Flashcards from Google Translate

Tutorial

time section
00:00 Introduction
01:26 Starting from scratch
03:33 Trying it out
04:08 Conclusion

Recipe

Name
Flashcards from translations
Callback
const source = document.querySelector('textarea[aria-label="Source text"]').value.split('\n');

const pronounce = source.map(e => '');

if (document.querySelector('div[data-location="2"] div')) {
  document.querySelector('div[data-location="2"] div').textContent.split('\n').forEach((e, i) => pronounce[i] = e);
}

const translations = Array.from(document.querySelectorAll('div[aria-live="polite"] > div > div > span > span:nth-child(2n + 1) > span')).map(e => e.textContent);

const cardsText = translations.map((e, i) => [e, source[i], pronounce[i]].map(e => e.trim().replace(/^- ?/g, '')).join(';')).join('  ');

return this.api.LCHCopyToClipboard(cardsText);
URL Filter
https://translate.google.com


Part of Cooking with Launchlet.

Follow my journey

Find me on Twitter or Mastodon.