docs

Vite integration API

Import linguana from @linguanahq/vite, then select exactly one framework adapter. The plugin extracts matching framework source and writes a version 2 manifest without changing source files.

linguana(options)

import { linguana, type LinguanaViteOptions } from "@linguanahq/vite";
import { react } from "@linguanahq/vite/react";
OptionTypeRequiredDefaultExampleExposureFailure behavior
adapter`react()vue()svelte()solid()`Yes-
projectIdstringYes-"checkout"Public identityMissing value is a TypeScript/config error
environmentstringNo"development""development"Public identityTranslation rejects non-development values
sourceLocalestringNo"en""en"PublicUsed for stable IDs and source fallback
apiUrlstringRemote work-process.env.LINGUANA_API_URLServer/build configUpload or translation fails when absent
tokenstringRemote work-process.env.LINGUANA_PROJECT_TOKENSecretUpload or translation fails when absent/invalid
include`stringstring[]`NoJSX and TSX"src/**/*.tsx"Build config
exclude`stringstring[]`NoDependencies/tests/specs"**/*.stories.tsx"Build config
outputstringNo.linguana/manifest.json"artifacts/messages.json"Build configParent directory is created automatically
uploadbooleanNoBoolean(token)trueBuild configRequires token
strictStrictPolicyNofalse{ duplicate: true }Build policySelected diagnostics fail the build
translationobjectNo-See belowPaid build policyWaits, fails safely, publishes development only

Translation options

translation: {
  enabled: true,
  maxChargeMicros: 100_000,
  waitTimeoutMs: 300_000,
  publish: "development",
}

Target languages come from the project’s enabled Languages list in the dashboard. maxChargeMicros and an optional waitTimeoutMs must be positive safe integers. publish accepts only development.

The compiler derives one idempotent build intent from manifest hash, sorted target locales, and publish target. It polls jobs until success, review/failure/cancellation, dispatch failure, or timeout. Every successful target must provide a catalog version before the development release is created.

StrictPolicy

type StrictPolicy =
  | boolean
  | { ambiguous?: boolean; unsafe?: boolean; duplicate?: boolean };

true fails on every non-info diagnostic. Object policy defaults incompatible duplicate IDs to fatal while allowing you to promote ambiguous or unsafe categories independently.

Framework adapters

React and Solid transform JSX before their official compiler plugins. Vue transforms the template block through the SFC compiler AST. Svelte transforms source before the official preprocess/compile plugins. Place linguana() before the official framework plugin.

Defaults and extraction boundaries

  • Excluded elements: script, style, code, and pre.
  • Allowed attributes: title, placeholder, aria-label, alt, label, and button value.
  • Custom attributes require data-translate.
  • data-no-translate, hidden content, URLs, and machine attributes are excluded.
  • Default output is .linguana/manifest.json.

Common failures

Message or codeMeaningRecovery
Manifest upload requires apiUrl and tokenRemote work is enabled without both credentialsSupply both in the build or disable remote work
duplicate-idOne explicit ID maps to incompatible sourceGive each semantic message a distinct ID
TRANSLATION_BUILD_TIMEOUTDurable work exceeded the build waitInspect the listed jobs before retrying the same intent
INNGEST_DISPATCH_FAILEDThe workflow worker was unreachableStart/reconnect the worker and inspect the job ID
REVIEW_REQUIREDA candidate needs human evidenceResolve it in Review rather than publishing around it

See also

Choose a framework · Migrate from the compiler package · Automate translations in CI

Did this page get you to a working result?

On this page

No Headings