You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@inlang/paraglide-sveltekit

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inlang/paraglide-sveltekit

[![Inlang-ecosystem compatibility badge](https://cdn.jsdelivr.net/gh/opral/monorepo@main/inlang/assets/md-badges/inlang.svg)](https://inlang.com)

1.0.0-beta.1
Source
npmnpm
Version published
Weekly downloads
4.8K
27.06%
Maintainers
2
Weekly downloads
 
Created
Source

Inlang-ecosystem compatibility badge

Getting Started

Initialize an inlang project and install the paraglide sveltekit adapter:

npx @inlang/paraglide-js@beta init
npm i @inlang/paraglide-sveltekit@beta

Add the vite plugin and adapter to your vite.config.js:

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
+import { paraglideVitePlugin } from '@inlang/paraglide-js';
+import { ParaglideSveltekitAdapter } from '@inlang/paraglide-sveltekit';

export default defineConfig({
	plugins: [
		sveltekit(),
+		paraglideVitePlugin({
+			project: './project.inlang',
+			outdir: './src/lib/paraglide',
+			adapter: ParaglideSveltekitAdapter()
+		})
	]
});

Add the handle hook to /src/hooks.server.ts:

import type { Handle } from '@sveltejs/kit';
import * as paraglideAdapter from '$lib/paraglide/adapter';

export const handle: Handle = paraglideAdapter.handle;

Add the reroute hook to /src/hooks.ts:

import type { Reroute } from '@sveltejs/kit';
import * as paraglideAdapter from '$lib/paraglide/adapter';

export const reroute: Reroute = paraglideAdapter.reroute;

Create or add the the Paraglide provider to the root layout file in /src/routes/+layout.svelte:

<script lang="ts">
+	import { ParaglideSveltekitProvider } from '$lib/paraglide/adapter';
</script>

+<ParaglideSveltekitProvider>
	<slot></slot>
+</ParaglideSveltekitProvider>

Keywords

inlang

FAQs

Package last updated on 21 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts