Skip to content

Commit 1167a2e

Browse files
committed
i18n: TimePicker + NutritionFactsBox — final component sweep
Wraps up the last two shared UI components with hardcoded strings. Adds time_picker.* (4 keys) and nutrition_facts.* (3 keys) namespaces. TimePicker: - svelte-i18n import added - Hour + Minute column labels above the wheel spinners - Cancel + Set Time footer buttons NutritionFactsBox (FDA-style panel used across recipe/food/meal cards): - svelte-i18n import added - Nutrition Facts panel heading - Serving Size row label - Amount Per Serving subhead
1 parent 5792c64 commit 1167a2e

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

src/components/ui/NutritionFactsBox.svelte

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script>
2+
import { _ } from 'svelte-i18n';
23
/**
34
* NutritionFactsBox — FDA-style "Nutrition Facts" label.
45
*
@@ -103,13 +104,13 @@
103104
104105
{#if rows.length > 0}
105106
<div class="nfacts">
106-
<div class="title">Nutrition Facts</div>
107+
<div class="title">{$_('nutrition_facts.title')}</div>
107108
108109
{#if servingsPerContainer}
109110
<div class="serving-line">{servingsPerContainer} servings per container</div>
110111
{/if}
111112
<div class="serving-line">
112-
<strong>Serving Size</strong>
113+
<strong>{$_('nutrition_facts.serving_size')}</strong>
113114
<span class="serving-detail">
114115
{#if servingDescription}
115116
{servingDescription}
@@ -126,7 +127,7 @@
126127
<div class="rule thick"></div>
127128
128129
{#if caloriesNut}
129-
<div class="amount-label">Amount Per Serving</div>
130+
<div class="amount-label">{$_('nutrition_facts.amount_per')}</div>
130131
<div class="cal-row">
131132
<span class="cal-name">{caloriesRowLabel}</span>
132133
<span class="cal-value">

src/components/ui/TimePicker.svelte

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script>
22
import { createEventDispatcher } from 'svelte';
3+
import { _ } from 'svelte-i18n';
34
import { portal } from '../../lib/portal.js';
45
import { timeFormat } from '../../stores/settings.js';
56
@@ -90,7 +91,7 @@
9091
<!-- Hour / Minute / AM-PM columns -->
9192
<div class="tp-columns">
9293
<div class="tp-col">
93-
<div class="tp-col-label">Hour</div>
94+
<div class="tp-col-label">{$_('time_picker.hour')}</div>
9495
<div class="tp-grid" class:tp-grid-4={!is24} class:tp-grid-6={is24}>
9596
{#each HOURS as h}
9697
<button class="tp-cell" class:tp-sel={selHour === h} on:click={() => selHour = h}>
@@ -101,7 +102,7 @@
101102
</div>
102103

103104
<div class="tp-col">
104-
<div class="tp-col-label">Minute</div>
105+
<div class="tp-col-label">{$_('time_picker.minute')}</div>
105106
<div class="tp-grid tp-grid-4">
106107
{#each MINUTES as m}
107108
<button class="tp-cell" class:tp-sel={selMinute === m} on:click={() => selMinute = m}>{String(m).padStart(2, '0')}</button>
@@ -122,8 +123,8 @@
122123

123124
<!-- Actions -->
124125
<div class="tp-actions">
125-
<button class="btn btn-ghost" on:click={() => open = false}>Cancel</button>
126-
<button class="btn btn-primary" on:click={_confirm}>Set Time</button>
126+
<button class="btn btn-ghost" on:click={() => open = false}>{$_('time_picker.cancel')}</button>
127+
<button class="btn btn-primary" on:click={_confirm}>{$_('time_picker.set_time')}</button>
127128
</div>
128129
</div>
129130
</div>

src/i18n/en.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,17 @@
973973
"hex_code": "Hex Code",
974974
"apply_color": "Apply Color"
975975
},
976+
"time_picker": {
977+
"hour": "Hour",
978+
"minute": "Minute",
979+
"cancel": "Cancel",
980+
"set_time": "Set Time"
981+
},
982+
"nutrition_facts": {
983+
"title": "Nutrition Facts",
984+
"serving_size": "Serving Size",
985+
"amount_per": "Amount Per Serving"
986+
},
976987
"fasting_insights": {
977988
"title": "Fasting",
978989
"avg_duration": "Avg duration",

0 commit comments

Comments
 (0)