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

ParameterDescription
fromSource language (optional, auto-detected if omitted)
toTarget language (default: en)

Data Attributes

AttributeRequiredDescription
data-api-keyYesYour API key (never in src, use attribute)
data-base-urlNoAPI base URL (default: https://api.languager.ai/v1)
data-autostartNoSet to false to disable auto-translation

Excluded Elements

The widget automatically skips translation of content in:

  • script, style, code, pre
  • textarea tags
  • Any element with data-languager-skip attribute