Skip to content

feat: translate FAQs and famous people insights via Chrome Translator API - #6

Open
sdass1918 wants to merge 31 commits into
mainfrom
feature/translate-faqs-insights
Open

feat: translate FAQs and famous people insights via Chrome Translator API#6
sdass1918 wants to merge 31 commits into
mainfrom
feature/translate-faqs-insights

Conversation

@sdass1918

Copy link
Copy Markdown
Collaborator

Problem

Gemini Nano cannot reliably generate structured insights (FAQs, famous people) in target languages it often outputs in Spanish or other languages even when Hindi is requested.

Solution

  • Removed the targetLanguage prompt injection from getStructuredInsights()
    insights are now always generated in English (where Gemini Nano is reliable).
  • Added translateInsights() to AISession — uses the Chrome Translator API
    to translate each FAQ question/answer and famous person name individually,
    with a single translator session for efficiency.
  • background.js passes English insights through translateInsights() before
    dispatching STRUCTURED_INSIGHTS to the content script.
    dispatching STRUCTURED_INSIGHTS to the content script.

Files changed

  • ai/utility.js — revert language prompt, add translateInsights() method
  • background.js — translate insights before sending to content script
  • README.md — add feature/translate-faqs-insights to branching diagram

sdass1918 and others added 30 commits May 25, 2026 16:05
The context-menu click handler must be async because subsequent logic awaits asynchronous checks (e.g. AI availability) before continuing. Without an async listener, await cannot be used and the workflow fails.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
checkAIAvailability() is async, but it's currently used as a boolean without await, so the Promise is always truthy and this guard never blocks when AI is unavailable.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
The parent context menu was registered for all pages, causing it to appear outside web.archive.org playback URLs. Clicking the menu on unsupported pages failed because no content script was injected there ("Receiving end does not exist"). Restrict the menu to Wayback playback URLs to prevent invalid usage.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant