Skip to content

Commit 0c1b210

Browse files
committed
feat: show kg when navigator language is not en-US
Signed-off-by: Matt Gleich <git@mattglei.ch>
1 parent fa37609 commit 0c1b210

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/lib/index/sections/workouts/lift.svelte

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
<script lang="ts">
22
import type { Workout } from '$lib/lcp/workouts';
33
import { Scrolling } from '@gleich/ui';
4+
import { onMount } from 'svelte';
45
56
const { workout }: { workout: Workout } = $props();
7+
8+
let imperialUnits = $state(false);
9+
10+
onMount(() => {
11+
imperialUnits = navigator.language === 'en-US';
12+
});
613
</script>
714

815
<div class="container">
@@ -33,7 +40,9 @@
3340
{set.type === 'warmup' ? 'Warmup' : `Set #${setIndex + 1}`}
3441
</div>
3542
<div class="set-value">
36-
{Math.round(set.weight_kg * 2.2046226218)} lbs × {set.reps} reps
43+
{imperialUnits
44+
? `${Math.round(set.weight_kg * 2.2046226218)} lbs`
45+
: `${Math.round(set.weight_kg)}} kg`} × {set.reps} reps
3746
</div>
3847
</div>
3948
{/each}

0 commit comments

Comments
 (0)