From 29e334c114c5e8949c4010805dfca98460b3ff91 Mon Sep 17 00:00:00 2001 From: Ulas Date: Tue, 31 Mar 2026 23:07:09 +0200 Subject: [PATCH] fix: i18n contact categories and budget month names --- public/locales/de.json | 9 ++++++++- public/locales/en.json | 9 ++++++++- public/pages/budget.js | 9 ++++++--- public/pages/contacts.js | 19 ++++++++++++++++--- 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/public/locales/de.json b/public/locales/de.json index 4283d52..1002dc1 100644 --- a/public/locales/de.json +++ b/public/locales/de.json @@ -384,7 +384,14 @@ "catInsurance": "Versicherung", "catCraftsman": "Handwerker", "catEmergency": "Notfall", - "catMisc": "Sonstiges" + "catMisc": "Sonstiges", + "categoryDoctor": "Arzt", + "categorySchool": "Schule/Kita", + "categoryAuthority": "Behörde", + "categoryInsurance": "Versicherung", + "categoryCraftsman": "Handwerker", + "categoryEmergency": "Notfall", + "categoryOther": "Sonstiges" }, "budget": { diff --git a/public/locales/en.json b/public/locales/en.json index 6179c9c..e0b2754 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -384,7 +384,14 @@ "catInsurance": "Insurance", "catCraftsman": "Tradesperson", "catEmergency": "Emergency", - "catMisc": "Miscellaneous" + "catMisc": "Miscellaneous", + "categoryDoctor": "Doctor", + "categorySchool": "School/Daycare", + "categoryAuthority": "Authority", + "categoryInsurance": "Insurance", + "categoryCraftsman": "Tradesperson", + "categoryEmergency": "Emergency", + "categoryOther": "Other" }, "budget": { diff --git a/public/pages/budget.js b/public/pages/budget.js index bdfa7a2..4974b27 100644 --- a/public/pages/budget.js +++ b/public/pages/budget.js @@ -31,8 +31,11 @@ const CATEGORY_LABELS = () => ({ 'Sonstiges': t('budget.catMisc'), }); -const MONTH_NAMES = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', - 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']; +function getMonthName(monthIndex) { + // monthIndex: 0-based (0=Januar, 11=Dezember) + const date = new Date(2000, monthIndex, 1); + return new Intl.DateTimeFormat(document.documentElement.lang || 'de', { month: 'long' }).format(date); +} // -------------------------------------------------------- // State @@ -56,7 +59,7 @@ function formatAmount(n) { function formatMonthLabel(ym) { const [y, m] = ym.split('-'); - return `${MONTH_NAMES[parseInt(m, 10) - 1]} ${y}`; + return `${getMonthName(parseInt(m, 10) - 1)} ${y}`; } function addMonths(ym, n) { diff --git a/public/pages/contacts.js b/public/pages/contacts.js index 57d2b3c..cf568e9 100644 --- a/public/pages/contacts.js +++ b/public/pages/contacts.js @@ -26,6 +26,18 @@ const CATEGORY_ICONS = { 'Sonstiges': '📋', }; +function CATEGORY_LABELS() { + return { + 'Arzt': t('contacts.categoryDoctor'), + 'Schule/Kita': t('contacts.categorySchool'), + 'Behörde': t('contacts.categoryAuthority'), + 'Versicherung': t('contacts.categoryInsurance'), + 'Handwerker': t('contacts.categoryCraftsman'), + 'Notfall': t('contacts.categoryEmergency'), + 'Sonstiges': t('contacts.categoryOther'), + }; +} + // -------------------------------------------------------- // State // -------------------------------------------------------- @@ -66,7 +78,7 @@ export async function render(container, { user }) {
${CATEGORIES.map((c) => ` - + `).join('')}
@@ -184,7 +196,7 @@ function renderList() { .sort(([a], [b]) => CATEGORIES.indexOf(a) - CATEGORIES.indexOf(b)) .map(([cat, items]) => `
-
${CATEGORY_ICONS[cat] || ''} ${escHtml(cat)}
+
${CATEGORY_ICONS[cat] || ''} ${CATEGORY_LABELS()[cat] || escHtml(cat)}
${items.map((c) => renderContactItem(c)).join('')}
`).join(''); @@ -242,8 +254,9 @@ function openContactModal({ mode, contact = null }) { const isEdit = mode === 'edit'; const v = (field) => escHtml(isEdit && contact[field] ? contact[field] : ''); + const catLabels = CATEGORY_LABELS(); const catOpts = CATEGORIES.map((c) => - `` + `` ).join(''); const content = `