Widget Script
Embed Languager as a script tag for website-wide translation
Basic Usage
Add the widget script to your HTML to automatically translate page content.
<script
src="https://cdn.yourdomain.com/widget.global.js?from=en&to=es"
data-languager-widget
data-api-key="YOUR_API_KEY"
defer
></script>Script Parameters
URL Parameters
| Parameter | Description |
|---|---|
from | Source language (optional, auto-detected if omitted) |
to | Target language (default: en) |
Data Attributes
| Attribute | Required | Description |
|---|---|---|
data-api-key | Yes | Your API key (never in src, use attribute) |
data-base-url | No | API base URL (default: https://api.languager.ai/v1) |
data-autostart | No | Set to false to disable auto-translation |
Excluded Elements
The widget automatically skips translation of content in:
script,style,code,pretextareatags- Any element with
data-languager-skipattribute