-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2890 from opral/sveltekit-form-actions
Fix Localisation of hrefs that are just params/hashes
- Loading branch information
Showing
7 changed files
with
248 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@inlang/paraglide-sveltekit": patch | ||
--- | ||
|
||
Fix translation of hrefs that don't include a path. This is especially important with form actions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...rce-code/paraglide/paraglide-sveltekit/example/src/routes/users/[id]/edit/+page.server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { Actions } from "./$types" | ||
|
||
export const prerender = false | ||
|
||
export const actions: Actions = { | ||
create: async ({ locals }) => { | ||
console.info("create", locals.paraglide.lang) | ||
}, | ||
} |
10 changes: 8 additions & 2 deletions
10
...source-code/paraglide/paraglide-sveltekit/example/src/routes/users/[id]/edit/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
<script> | ||
import { page } from "$app/stores" | ||
import { enhance } from "$app/forms" | ||
import { page } from "$app/stores" | ||
import * as m from "$lib/paraglide/messages.js" | ||
$: userId = Number.parseFloat($page.params.id); | ||
</script> | ||
|
||
<h1>{m.edit_user({ userId })}</h1> | ||
<a href="/users/{userId}">{m.users()}</a> | ||
<a href="/users/{userId}">{m.users()}</a> | ||
|
||
<form method="POST" action="?/create" use:enhance> | ||
<label for="name">Name</label> | ||
<button>Submit</button> | ||
</form> |
2 changes: 1 addition & 1 deletion
2
inlang/source-code/paraglide/paraglide-sveltekit/example/svelte.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.