mirror of
https://github.com/vcscsvcscs/GenerationsHeritage.git
synced 2025-08-15 15:29:05 +02:00
init new svelte 5 cloudflare project
This commit is contained in:
10
app/src/routes/+layout.svelte
Normal file
10
app/src/routes/+layout.svelte
Normal 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>
|
2
app/src/routes/+page.svelte
Normal file
2
app/src/routes/+page.svelte
Normal 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>
|
1
app/src/routes/demo/+page.svelte
Normal file
1
app/src/routes/demo/+page.svelte
Normal file
@@ -0,0 +1 @@
|
||||
<a href="/demo/paraglide">paraglide</a>
|
19
app/src/routes/demo/paraglide/+page.svelte
Normal file
19
app/src/routes/demo/paraglide/+page.svelte
Normal 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>
|
Reference in New Issue
Block a user