Skip to content

Pro-Bandey/Translator-SideBar_Using-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Translator SideBar (Using AI)

An offline translation workspace built inside Chrome's sidebar. This extension supports two secure, local translation architectures: Chrome's built-in Gemini Nano AI engine and a fully local NLLB-200 translation pipeline powered by Transformers.js with hardware acceleration.


Key Features

  • Dual Translation Engines (Offline):
    • Built-in Translation API: Utilizes Chrome's built-in Gemini Nano model for local, high-speed execution.
    • Local Transformers.js Pipeline: Runs the Xenova/nllb-200-distilled-600M model entirely on your machine using IndexedDB caching.
  • Hardware Acceleration Controls: Toggle dynamically between high-speed GPU execution via WebGPU (utilizing FP16 tensor optimizations) or highly threaded CPU execution via WebAssembly (WASM).
  • Material Design 3 (MD3) User Interface: Clean interfaces featuring smooth component transitions, custom toggle structures, card containers, and standard typography scales.
  • Unified SVG Sprite Sheets: Optimizes performance and reduces assets latency by compiling all visual icons into a unified SVG symbol grid.
  • Instant Text Capture: Detects and securely transfers text selection from any client webpage tab directly into the sidebar panel for instant execution.
  • Automatic Theme Configuration: Adapts styling boundaries to align with your system preferences (light/dark configurations) while providing an instant manual toggle override.

Setup Requirements

1. Built-in Gemini Nano AI Engine

Chrome's built-in Translation API requires specific browser flags to be enabled. Depending on your version of Chrome, configure the following options:

  1. Navigate to:
    chrome://flags/
    
  2. Enable the Translation API flag (often labeled #translation-api or #optimization-guide-on-device-model).
  3. Relaunch your browser to apply changes.
  4. Navigate to your options page, select Built-in Gemini Nano AI, configure your preferred language pairing, and click the Download button in the sidebar panel to retrieve the localized weights.

2. Transformers.js Local Engine

The NLLB-200 local execution pipeline is ready to use without additional browser configurations.

  1. Select NLLB-200 AI inside the settings card on the Options page.
  2. Choose your preferred acceleration backend:
    • WebGPU: For fast execution using modern graphics hardware (requires WebGPU support).
    • WASM: A fallback that processes tensors on your CPU across optimal thread allocations.
  3. Upon first activation, authorize the setup query to let the extension pull model assets from Hugging Face into your secure, sandboxed browser storage. Once cached, the pipeline functions entirely offline.

How to Use

  1. Click on the Translator SideBar toolbar icon. The side panel will open automatically.
  2. To translate text on any webpage:
    • Select the target text with your cursor.
    • If Text Selection Trigger is enabled in options, the captured text will load inside the sidebar panel and initiate the translation process instantly.
  3. To translate manually:
    • Type or paste your source text into the top input card.
    • Press the Translate button (the center arrow icon) or hit Enter inside the card to trigger translation.
  4. Open the Options page at any time using the settings button in the toolbar footer to swap languages, adjust sidebar colors, change text size, or switch hardware execution backends.

Developer Notice

This extension relies entirely on locally hosted frameworks. It does not transmit translation blocks, history, or selection states to external servers. If you encounter initialization issues, verify your browser compatibility for either the WebGPU flag configurations or built-in translation flags.

About

Translate text within the sidebar panel via two different AI engines (fully offline).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors