Skip to main content
Version: 5.x.x

Installation (Svelte)

Check our Svelte example application

To install Tolgee Svelte integration library, run:

npm install @tolgee/svelte

Init Tolgee and wrap your application in TolgeeProvider.

import { TolgeeProvider, Tolgee, DevTools, FormatSimple } from '@tolgee/svelte';

const tolgee = Tolgee()
language: 'en',

// for development
apiUrl: import.meta.env.VITE_TOLGEE_API_URL,
apiKey: import.meta.env.VITE_TOLGEE_API_KEY,

// for production
staticData: {

<TolgeeProvider tolgee={tolgee}>
<div slot="fallback">Loading...</div>
<slot />

Check all tolgee options and tolgee plugins.

If you bootstrapped your application with SvelteKit, your .env.development.local file should look like this:


Never leak your API key! You don't want visitors of your site to edit your translations. That's why we recommend to use .env files to store your API key. API key is then omitted for production build.

Obtaining Tolgee API key is described in Integration chapter.

Preparing for production

Tolgee will automatically omit DevTools from your bundle when you build your app for production. So it won't fetch translations directly from Tolgee Platform and it won't allow users to modify translations.

There are generally two ways how to use translations in production:

In production mode, you should never use localization data directly from Tolgee REST API, because it can negatively affect your page performance.