JavaScript SDK (@unolio/sdk)

Official JavaScript SDK for Unolio: load translations at runtime in the browser, Node.js (18+), and any bundler-supported stack.

Contents

DocumentDescription
Getting startedInstall, env vars, and the minimal createClientpreloadt() flow
API referenceTypes, UnolioClient methods, DOM helpers, and React exports
Script tag & DOMUMD bundle, auto-init attributes, data-* targets, language switching
Framework integrationReact, Next.js, Vite, Vue, Preact, Svelte — provider patterns and env

The package README on npm duplicates quick-start examples and is the canonical entry for install metadata.

Package layout

ImportPurpose
@unolio/sdkcreateClient, UnolioClient, translateDOM, switchLanguage
@unolio/sdk/reactUnolioProvider, useUnolioClient, Trans, parseRichMessage, types

Requires React ≥ 17 only if you use @unolio/sdk/react (peer dependency, optional).

Network & security

  • The client calls baseUrl with paths /api/v1/translations and /api/v1/languages, passing apiKey as a query parameter.
  • Browser apps need CORS on your API for the app origin.
  • Treat NEXT_PUBLIC_*, VITE_*, and similar as public; use a server proxy if the key must stay secret.