feat(i18n): notes.js Strings auf t() umstellen

This commit is contained in:
2026-03-22 14:19:13 +01:00
parent f937f7c39c
commit daea57a9df
+16 -16
View File
@@ -75,15 +75,15 @@ const Notes = {
async create(template) { async create(template) {
if (this._notes.length >= this.MAX_NOTES) { if (this._notes.length >= this.MAX_NOTES) {
await HellionDialog.alert( await HellionDialog.alert(
'Maximale Anzahl erreicht! Du kannst maximal ' + this.MAX_NOTES + ' Notes gleichzeitig haben. Lösche eine bestehende Note um eine neue zu erstellen.', t('notes.limit_message', { max: this.MAX_NOTES }),
{ type: 'warning', title: 'Limit erreicht' } { type: 'warning', title: t('notes.limit_title') }
); );
return null; return null;
} }
const noteData = { const noteData = {
id: 'note_' + uid(), id: 'note_' + uid(),
title: template === 'checklist' ? 'Checkliste' : 'Note', title: template === 'checklist' ? t('notes.checklist_title') : t('notes.default_title'),
content: '', content: '',
template: template, template: template,
x: 120 + (this._notes.length * 30), x: 120 + (this._notes.length * 30),
@@ -138,7 +138,7 @@ const Notes = {
_renderTextBody(noteData, bodyEl) { _renderTextBody(noteData, bodyEl) {
const textarea = document.createElement('textarea'); const textarea = document.createElement('textarea');
textarea.className = 'widget-textarea'; textarea.className = 'widget-textarea';
textarea.placeholder = 'Notiz schreiben...'; textarea.placeholder = t('notes.placeholder');
textarea.spellcheck = false; textarea.spellcheck = false;
textarea.value = noteData.content || ''; textarea.value = noteData.content || '';
textarea.maxLength = this.MAX_CHARS; textarea.maxLength = this.MAX_CHARS;
@@ -204,7 +204,7 @@ const Notes = {
const addInput = document.createElement('input'); const addInput = document.createElement('input');
addInput.className = 'checklist-add-input'; addInput.className = 'checklist-add-input';
addInput.type = 'text'; addInput.type = 'text';
addInput.placeholder = 'Neues Item...'; addInput.placeholder = t('notes.checklist_placeholder');
addInput.maxLength = 100; addInput.maxLength = 100;
addInput.addEventListener('keydown', async (e) => { addInput.addEventListener('keydown', async (e) => {
@@ -276,11 +276,11 @@ const Notes = {
// Auto-Titel: "X/Y erledigt" falls kein manueller Titel // Auto-Titel: "X/Y erledigt" falls kein manueller Titel
const widgetEntry = WidgetManager._widgets.get(noteData.id); const widgetEntry = WidgetManager._widgets.get(noteData.id);
if (widgetEntry) { if (widgetEntry) {
const defaultTitle = done + '/' + total + ' erledigt'; const defaultTitle = t('notes.checklist_progress', { done: done, total: total });
const titleEl = widgetEntry.el.querySelector('.widget-title'); const titleEl = widgetEntry.el.querySelector('.widget-title');
if (titleEl && titleEl.contentEditable !== 'true') { if (titleEl && titleEl.contentEditable !== 'true') {
// Nur wenn Titel noch Standard ist // Nur wenn Titel noch Standard ist
if (noteData.title === 'Checkliste' || /^\d+\/\d+ erledigt$/.test(noteData.title)) { if (noteData.title === t('notes.checklist_title') || /^\d+\/\d+\s/.test(noteData.title)) {
noteData.title = defaultTitle; noteData.title = defaultTitle;
titleEl.textContent = defaultTitle; titleEl.textContent = defaultTitle;
widgetEntry.state.title = defaultTitle; widgetEntry.state.title = defaultTitle;
@@ -307,8 +307,8 @@ const Notes = {
if (idx === -1) return; if (idx === -1) return;
const ok = await HellionDialog.confirm( const ok = await HellionDialog.confirm(
'Note endgültig löschen? Das kann nicht rückgängig gemacht werden.', t('notes.delete_confirm'),
{ type: 'danger', title: 'Note löschen', confirmText: 'Löschen' } { type: 'danger', title: t('notes.delete_title'), confirmText: t('notes.delete_button') }
); );
if (!ok) return; if (!ok) return;
@@ -330,7 +330,7 @@ const Notes = {
} else { } else {
md += noteData.content || ''; md += noteData.content || '';
} }
md += '\n\n---\n*Exportiert aus Hellion Dashboard*\n'; md += '\n\n---\n*' + t('notes.export_footer') + '*\n';
const blob = new Blob([md], { type: 'text/markdown' }); const blob = new Blob([md], { type: 'text/markdown' });
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
@@ -419,9 +419,9 @@ const Notes = {
if (note.template === 'checklist') { if (note.template === 'checklist') {
const total = note.checklistItems ? note.checklistItems.length : 0; const total = note.checklistItems ? note.checklistItems.length : 0;
const done = note.checklistItems ? note.checklistItems.filter(i => i.checked).length : 0; const done = note.checklistItems ? note.checklistItems.filter(i => i.checked).length : 0;
preview.textContent = done + '/' + total + ' erledigt'; preview.textContent = t('notes.checklist_progress', { done: done, total: total });
} else { } else {
preview.textContent = (note.content || '').slice(0, 50) || 'Leer'; preview.textContent = (note.content || '').slice(0, 50) || t('notes.empty_preview');
} }
// Actions // Actions
@@ -430,7 +430,7 @@ const Notes = {
const btnExport = document.createElement('button'); const btnExport = document.createElement('button');
btnExport.className = 'notebook-slot-btn'; btnExport.className = 'notebook-slot-btn';
btnExport.textContent = 'Export'; btnExport.textContent = t('notes.export');
btnExport.addEventListener('click', (e) => { btnExport.addEventListener('click', (e) => {
e.stopPropagation(); e.stopPropagation();
this.exportNote(note); this.exportNote(note);
@@ -470,7 +470,7 @@ const Notes = {
slot.className = 'notebook-slot-empty'; slot.className = 'notebook-slot-empty';
const label = document.createElement('span'); const label = document.createElement('span');
label.textContent = '+ Note erstellen'; label.textContent = t('notes.create');
slot.appendChild(label); slot.appendChild(label);
// Klick zeigt Typ-Auswahl // Klick zeigt Typ-Auswahl
@@ -485,7 +485,7 @@ const Notes = {
const btnText = document.createElement('button'); const btnText = document.createElement('button');
btnText.className = 'notebook-type-btn'; btnText.className = 'notebook-type-btn';
btnText.textContent = '\u270E Freitext'; btnText.textContent = t('notes.text_type');
btnText.addEventListener('click', async (e) => { btnText.addEventListener('click', async (e) => {
e.stopPropagation(); e.stopPropagation();
await this.create('text'); await this.create('text');
@@ -494,7 +494,7 @@ const Notes = {
const btnCheck = document.createElement('button'); const btnCheck = document.createElement('button');
btnCheck.className = 'notebook-type-btn'; btnCheck.className = 'notebook-type-btn';
btnCheck.textContent = '\u2611 Checkliste'; btnCheck.textContent = t('notes.checklist_type');
btnCheck.addEventListener('click', async (e) => { btnCheck.addEventListener('click', async (e) => {
e.stopPropagation(); e.stopPropagation();
await this.create('checklist'); await this.create('checklist');