Skip to main content

Tolgee for Svelte provides simple API to create multi-lingual Svelte application. With Tolgee i18n library for Svelte you can enjoy all Tolgee i18n features.

To see Svelte with Tolgee in action, check this example app.

npm i @tolgee/svelte

Get started!

1. Create project in Tolgee platform

Go to Tolgee Cloud app or access your self-hosted instance and create a project. Then obtain your API key.

2. Setup Tolgee integration

Install the npm packages.

npm i @tolgee/svelte

Then wrap your code with TolgeeProvider

<script>
import { TolgeeProvider } from "@tolgee/svelte";

const tolgeeConfig = {
preloadFallback: true,
apiUrl: 'https://app.tolgee.io',
apiKey: '<your API key>',
};
</script>

<TolgeeProvider config={tolgeeConfig}>
<div slot="loading-fallback">Loading...</div>
<slot />
</TolgeeProvider>

3. Use T component to translate your texts

<script>
import { T } from "@tolgee/svelte";
</script>
<h1>
<T keyName="translate_me" defaultValue="Translate me!" />
</h1>

Now you are able to Alt + Click & translate your texts!

More integrations

Show all