init new svelte 5 cloudflare project

This commit is contained in:
2025-02-15 17:01:54 +01:00
parent 47dca8ed3d
commit 63783dce67
61 changed files with 11821 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<script lang="ts">
import '../app.css';
import { i18n } from '$lib/i18n';
import { ParaglideJS } from '@inlang/paraglide-sveltekit';
let { children } = $props();
</script>
<ParaglideJS {i18n}>
{@render children()}
</ParaglideJS>

View File

@@ -0,0 +1,2 @@
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>

View File

@@ -0,0 +1 @@
<a href="/demo/paraglide">paraglide</a>

View File

@@ -0,0 +1,19 @@
<script lang="ts">
import type { AvailableLanguageTag } from '$lib/paraglide/runtime';
import { i18n } from '$lib/i18n';
import { page } from '$app/state';
import { goto } from '$app/navigation';
import * as m from '$lib/paraglide/messages.js';
function switchToLanguage(newLanguage: AvailableLanguageTag) {
const canonicalPath = i18n.route(page.url.pathname);
const localisedPath = i18n.resolveRoute(canonicalPath, newLanguage);
goto(localisedPath);
}
</script>
<h1>{m.hello_world({ name: 'SvelteKit User' })}</h1>
<div>
<button onclick={() => switchToLanguage('en')}>en</button>
<button onclick={() => switchToLanguage('hu')}>hu</button>
</div>