Inspiration

Chatting with international friends on Discord and Slack, I constantly faced language barriers. Google Translate lacks context, and using ChatGPT meant endless copy-pasting between tabs. I needed accurate, instant, seamless translation.

What it does

Xiaoniao automatically translates and pastes in real-time:

  1. Copy text (Ctrl+C)
  2. Extension auto-translates in 1 second
  3. Auto-pastes the translation - no manual paste needed

Works on any website with any input field - Discord, Slack, WhatsApp Web, Gmail, Twitter, everywhere.

How we built it

Core Technologies:

  • Chrome Built-in AI Prompt API (window.ai.languageModel) with Gemini Nano for on-device translation
  • Service Worker for background processing
  • Content Scripts for auto-paste on messaging platforms
  • Hybrid AI architecture: Built-in AI, Gemini API, or custom API keys

Key Features:

  • Clipboard monitoring with debouncing
  • Custom translation styles (casual, formal, user-defined prompts)
  • Privacy-focused local processing

Challenges we ran into

  1. Clipboard API limitations: Chrome's clipboard security restrictions. Solved with content script injection.

  2. Translation accuracy: Initial translations too literal. Fixed with precise system prompts emphasizing context.

  3. Auto-paste complexity: Different websites handle paste differently. Created platform-specific handlers.

  4. Performance: Needed instant translation. Implemented debouncing and optimized AI calls.

Accomplishments

  • Reduced translation workflow from 7 steps to 1 keystroke
  • Achieved sub-second translation with Built-in AI
  • Privacy-first: No data sent to servers with Gemini Nano
  • Works across all major chat platforms

What we learned

  • Chrome Built-in AI APIs require careful prompt engineering
  • Simplicity beats feature quantity
  • Visual feedback crucial for async operations

Built With

  • chrome
  • chrome-built-in-ai
  • content-scripts
  • gemini-nano
  • go
  • javascript
  • manifest
  • prompt-api
  • service-worker
Share this project:

Updates