From a4aba929eee1f7cad95d1c58eb322175b5e6cfbc Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 12 Dec 2024 22:39:47 -0800 Subject: pass locale around --- src/components/Success.svelte | 4 ++-- src/routes/(app)/invoice/[id]/tip/+page.svelte | 22 ++++++++++++++++------ .../(app)/pay/[username]/[...amount]/+page.svelte | 7 +++---- src/routes/(app)/send/invoice/[id]/+page.svelte | 7 ++++--- src/routes/(app)/sent/[id]/+page.svelte | 7 ++++--- 5 files changed, 29 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/components/Success.svelte b/src/components/Success.svelte index 973e2d35..6cbe990e 100644 --- a/src/components/Success.svelte +++ b/src/components/Success.svelte @@ -3,7 +3,7 @@ import { scale } from "svelte/transition"; import Amount from "$comp/Amount.svelte"; import { Confetti } from "svelte-confetti"; - const { amount, tip, rate, currency, title } = $props(); + const { amount, tip, rate, currency, locale, title } = $props(); let loaded = $state(false); $effect(() => { @@ -55,5 +55,5 @@ > {/if}

{title}

- + diff --git a/src/routes/(app)/invoice/[id]/tip/+page.svelte b/src/routes/(app)/invoice/[id]/tip/+page.svelte index 7999030e..5cab71d8 100644 --- a/src/routes/(app)/invoice/[id]/tip/+page.svelte +++ b/src/routes/(app)/invoice/[id]/tip/+page.svelte @@ -3,7 +3,7 @@ import { browser } from "$app/environment"; import { invoice as inv, request } from "$lib/store"; - import { copy, focus, f, sat, get, s, sats } from "$lib/utils"; + import { loc, copy, focus, f, sat, get, s, sats } from "$lib/utils"; import Icon from "$comp/Icon.svelte"; import Slider from "$comp/Slider.svelte"; import { goto } from "$app/navigation"; @@ -76,6 +76,7 @@ tip, user: { username }, } = $state(invoice); + let locale = $derived(loc(user)); let qr; let tipPercent = $state((tip / amount) * 100); @@ -119,14 +120,23 @@
- {f(amountFiat, currency)} - +{f(tipAmount, currency)} + {f(amountFiat, currency, locale)} + +{f(tipAmount, currency, locale)}
-
- {sat(amount)} - +{sat(tip)} +
+
+ +
{s(amount, locale)}
+
+ +
+
+ +{s(tip, locale)} +
+
diff --git a/src/routes/(app)/pay/[username]/[...amount]/+page.svelte b/src/routes/(app)/pay/[username]/[...amount]/+page.svelte index ab96e7c2..b22e3c1f 100644 --- a/src/routes/(app)/pay/[username]/[...amount]/+page.svelte +++ b/src/routes/(app)/pay/[username]/[...amount]/+page.svelte @@ -1,17 +1,16 @@ - +
-- cgit v1.2.3