fix: i18n contact categories and budget month names
This commit is contained in:
@@ -384,7 +384,14 @@
|
|||||||
"catInsurance": "Versicherung",
|
"catInsurance": "Versicherung",
|
||||||
"catCraftsman": "Handwerker",
|
"catCraftsman": "Handwerker",
|
||||||
"catEmergency": "Notfall",
|
"catEmergency": "Notfall",
|
||||||
"catMisc": "Sonstiges"
|
"catMisc": "Sonstiges",
|
||||||
|
"categoryDoctor": "Arzt",
|
||||||
|
"categorySchool": "Schule/Kita",
|
||||||
|
"categoryAuthority": "Behörde",
|
||||||
|
"categoryInsurance": "Versicherung",
|
||||||
|
"categoryCraftsman": "Handwerker",
|
||||||
|
"categoryEmergency": "Notfall",
|
||||||
|
"categoryOther": "Sonstiges"
|
||||||
},
|
},
|
||||||
|
|
||||||
"budget": {
|
"budget": {
|
||||||
|
|||||||
@@ -384,7 +384,14 @@
|
|||||||
"catInsurance": "Insurance",
|
"catInsurance": "Insurance",
|
||||||
"catCraftsman": "Tradesperson",
|
"catCraftsman": "Tradesperson",
|
||||||
"catEmergency": "Emergency",
|
"catEmergency": "Emergency",
|
||||||
"catMisc": "Miscellaneous"
|
"catMisc": "Miscellaneous",
|
||||||
|
"categoryDoctor": "Doctor",
|
||||||
|
"categorySchool": "School/Daycare",
|
||||||
|
"categoryAuthority": "Authority",
|
||||||
|
"categoryInsurance": "Insurance",
|
||||||
|
"categoryCraftsman": "Tradesperson",
|
||||||
|
"categoryEmergency": "Emergency",
|
||||||
|
"categoryOther": "Other"
|
||||||
},
|
},
|
||||||
|
|
||||||
"budget": {
|
"budget": {
|
||||||
|
|||||||
@@ -31,8 +31,11 @@ const CATEGORY_LABELS = () => ({
|
|||||||
'Sonstiges': t('budget.catMisc'),
|
'Sonstiges': t('budget.catMisc'),
|
||||||
});
|
});
|
||||||
|
|
||||||
const MONTH_NAMES = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni',
|
function getMonthName(monthIndex) {
|
||||||
'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
|
// 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
|
// State
|
||||||
@@ -56,7 +59,7 @@ function formatAmount(n) {
|
|||||||
|
|
||||||
function formatMonthLabel(ym) {
|
function formatMonthLabel(ym) {
|
||||||
const [y, m] = ym.split('-');
|
const [y, m] = ym.split('-');
|
||||||
return `${MONTH_NAMES[parseInt(m, 10) - 1]} ${y}`;
|
return `${getMonthName(parseInt(m, 10) - 1)} ${y}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addMonths(ym, n) {
|
function addMonths(ym, n) {
|
||||||
|
|||||||
@@ -26,6 +26,18 @@ const CATEGORY_ICONS = {
|
|||||||
'Sonstiges': '📋',
|
'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
|
// State
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
@@ -66,7 +78,7 @@ export async function render(container, { user }) {
|
|||||||
<div class="contacts-filters" id="contacts-filters">
|
<div class="contacts-filters" id="contacts-filters">
|
||||||
<button class="contact-filter-chip contact-filter-chip--active" data-cat="">${t('contacts.filterAll')}</button>
|
<button class="contact-filter-chip contact-filter-chip--active" data-cat="">${t('contacts.filterAll')}</button>
|
||||||
${CATEGORIES.map((c) => `
|
${CATEGORIES.map((c) => `
|
||||||
<button class="contact-filter-chip" data-cat="${escHtml(c)}">${CATEGORY_ICONS[c] || ''} ${escHtml(c)}</button>
|
<button class="contact-filter-chip" data-cat="${escHtml(c)}">${CATEGORY_ICONS[c] || ''} ${CATEGORY_LABELS()[c] || escHtml(c)}</button>
|
||||||
`).join('')}
|
`).join('')}
|
||||||
</div>
|
</div>
|
||||||
<div id="contacts-list" class="contacts-list"></div>
|
<div id="contacts-list" class="contacts-list"></div>
|
||||||
@@ -184,7 +196,7 @@ function renderList() {
|
|||||||
.sort(([a], [b]) => CATEGORIES.indexOf(a) - CATEGORIES.indexOf(b))
|
.sort(([a], [b]) => CATEGORIES.indexOf(a) - CATEGORIES.indexOf(b))
|
||||||
.map(([cat, items]) => `
|
.map(([cat, items]) => `
|
||||||
<div class="contact-group">
|
<div class="contact-group">
|
||||||
<div class="contact-group__header">${CATEGORY_ICONS[cat] || ''} ${escHtml(cat)}</div>
|
<div class="contact-group__header">${CATEGORY_ICONS[cat] || ''} ${CATEGORY_LABELS()[cat] || escHtml(cat)}</div>
|
||||||
${items.map((c) => renderContactItem(c)).join('')}
|
${items.map((c) => renderContactItem(c)).join('')}
|
||||||
</div>
|
</div>
|
||||||
`).join('');
|
`).join('');
|
||||||
@@ -242,8 +254,9 @@ function openContactModal({ mode, contact = null }) {
|
|||||||
const isEdit = mode === 'edit';
|
const isEdit = mode === 'edit';
|
||||||
const v = (field) => escHtml(isEdit && contact[field] ? contact[field] : '');
|
const v = (field) => escHtml(isEdit && contact[field] ? contact[field] : '');
|
||||||
|
|
||||||
|
const catLabels = CATEGORY_LABELS();
|
||||||
const catOpts = CATEGORIES.map((c) =>
|
const catOpts = CATEGORIES.map((c) =>
|
||||||
`<option value="${c}" ${isEdit && contact.category === c ? 'selected' : ''}>${c}</option>`
|
`<option value="${c}" ${isEdit && contact.category === c ? 'selected' : ''}>${catLabels[c] || escHtml(c)}</option>`
|
||||||
).join('');
|
).join('');
|
||||||
|
|
||||||
const content = `
|
const content = `
|
||||||
|
|||||||
Reference in New Issue
Block a user