i18n(fitness): migrate inline ternaries across pages and components
Replace lang === 'en' string ternaries on the check-in, stats, workout,
exercises, history, and stats history detail pages, plus TemplateCard,
with t.<key> lookups against the fitness dictionary. Added new keys for
toast messages, body-part counts, body-fat label, clear/measure short
labels, "edit all fields", BF chart delta prefix, calorie balance and
adherence tooltips, actual/target legend labels, daily expenditure
prefix, height/birth/weight setup hint, exercise/workout/recent labels,
"starts with", and a {n}-template "X days ago" string.
URL slug ternaries (e.g. 'check-in' / 'erfassung') remain inline since
they encode route data, not UI text.
Bump site version to 1.56.2.
This commit is contained in:
@@ -26,8 +26,8 @@
|
||||
const diffDays = Math.floor(diffMs / 86400000);
|
||||
if (diffDays === 0) return t.today;
|
||||
if (diffDays === 1) return t.yesterday;
|
||||
if (diffDays < 7) return lang === 'en' ? `${diffDays} days ago` : `vor ${diffDays} Tagen`;
|
||||
return d.toLocaleDateString(lang === 'en' ? 'en' : 'de', { month: 'short', day: 'numeric' });
|
||||
if (diffDays < 7) return t.days_ago_template.replace('{n}', String(diffDays));
|
||||
return d.toLocaleDateString(lang, { month: 'short', day: 'numeric' });
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -363,4 +363,30 @@ export const de = {
|
||||
sugars: "Zucker",
|
||||
source_db: "Quelle",
|
||||
initializing_gps: "GPS wird initialisiert…",
|
||||
|
||||
// Check-in page
|
||||
failed_to_load_more: "Laden fehlgeschlagen",
|
||||
body_part_count_one: "1 Körperteil",
|
||||
body_parts_count_other: "Körperteile",
|
||||
updated_toast: "Aktualisiert",
|
||||
body_fat_label: "Körperfett",
|
||||
clear_action: "Leeren",
|
||||
measure_short: "Messen",
|
||||
edit_all_fields: "Alle Felder bearbeiten",
|
||||
measurement_saved: "Messung gespeichert",
|
||||
|
||||
// Stats page
|
||||
bf_delta_from_prefix: "Δ von",
|
||||
set_height_birthyear_weight: "Größe, Geburtsjahr & Gewicht eintragen",
|
||||
actual_label: "Ist",
|
||||
target_label: "Ziel",
|
||||
calorie_balance_tooltip: "Durchschnittlich gegessene Kalorien minus geschätzter Verbrauch (TDEE + erfasste Trainingskilokalorien) der letzten 7 Tage. Negativ = Defizit, positiv = Überschuss.",
|
||||
daily_expenditure_estimate_prefix: "Geschätzter Tagesverbrauch:",
|
||||
diet_adherence_tooltip: "Prozent der Tage, an denen die gegessenen Kalorien innerhalb von ±10 % deines Ziels lagen (bereinigt um verbrannte Trainingskalorien). Nicht erfasste Tage zählen als verfehlt.",
|
||||
|
||||
// Misc page titles / labels
|
||||
exercise_title: "Übung",
|
||||
recent_label: "Aktuell",
|
||||
starts_with: "beginnt mit",
|
||||
days_ago_template: "vor {n} Tagen"
|
||||
} as const;
|
||||
|
||||
@@ -363,4 +363,30 @@ export const en = {
|
||||
sugars: "Sugars",
|
||||
source_db: "Source",
|
||||
initializing_gps: "Initializing GPS…",
|
||||
|
||||
// Check-in page
|
||||
failed_to_load_more: "Failed to load more",
|
||||
body_part_count_one: "1 body part",
|
||||
body_parts_count_other: "body parts",
|
||||
updated_toast: "Updated",
|
||||
body_fat_label: "Body Fat",
|
||||
clear_action: "Clear",
|
||||
measure_short: "Measure",
|
||||
edit_all_fields: "Edit all fields",
|
||||
measurement_saved: "Measurement saved",
|
||||
|
||||
// Stats page
|
||||
bf_delta_from_prefix: "Δ from",
|
||||
set_height_birthyear_weight: "Set height, birth year & weight",
|
||||
actual_label: "Actual",
|
||||
target_label: "Target",
|
||||
calorie_balance_tooltip: "Average daily calories eaten minus estimated expenditure (TDEE + tracked workout calories) over the last 7 days. Negative = deficit, positive = surplus.",
|
||||
daily_expenditure_estimate_prefix: "Est. daily expenditure:",
|
||||
diet_adherence_tooltip: "Percentage of days where calories eaten were within ±10% of your goal (adjusted for exercise calories burned). Days without tracking count as misses.",
|
||||
|
||||
// Misc page titles / labels
|
||||
exercise_title: "Exercise",
|
||||
recent_label: "Recent",
|
||||
starts_with: "starts with",
|
||||
days_ago_template: "{n} days ago"
|
||||
} as const satisfies Record<keyof typeof de, string>;
|
||||
|
||||
Reference in New Issue
Block a user