fix sonar findings and translation structure
This commit is contained in:
+16
-16
@@ -5,14 +5,14 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
|
||||
const DROPDOWN_ANIMATION_MS = 180;
|
||||
const pageTitles = Object.freeze({
|
||||
get privacy() { return ns.I18n.t("legal-ui.datenschutzerklarung"); },
|
||||
get imprint() { return ns.I18n.t("legal-ui.impressum"); },
|
||||
get technology() { return ns.I18n.t("legal-ui.speichern.und.berechtigungen"); }
|
||||
get privacy() { return ns.I18n.t("info.privacy"); },
|
||||
get imprint() { return ns.I18n.t("info.imprint"); },
|
||||
get technology() { return ns.I18n.t("info.storage"); }
|
||||
});
|
||||
function menuEntries() { return [
|
||||
['privacy', ns.I18n.t("legal-ui.datenschutzerklarung")],
|
||||
['imprint', ns.I18n.t("legal-ui.impressum")],
|
||||
['technology', ns.I18n.t("legal-ui.speichern.und.berechtigungen")]
|
||||
['privacy', ns.I18n.t("info.privacy")],
|
||||
['imprint', ns.I18n.t("info.imprint")],
|
||||
['technology', ns.I18n.t("info.storage")]
|
||||
]; }
|
||||
const selectors = Object.freeze({
|
||||
content: '.info-dialog-content',
|
||||
@@ -159,8 +159,8 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
id: 'info-button',
|
||||
className: 'info-button',
|
||||
type: 'button',
|
||||
'aria-label': ns.I18n.t("legal-ui.hilfe.und.informationen.offnen"),
|
||||
title: ns.I18n.t("legal-ui.informationen")
|
||||
'aria-label': ns.I18n.t("info.open"),
|
||||
title: ns.I18n.t("info.title")
|
||||
});
|
||||
append(infoButton, createElement('span', { 'aria-hidden': 'true' }, 'i'));
|
||||
append(control, infoButton);
|
||||
@@ -173,7 +173,7 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
const dropdown = createElement('nav', {
|
||||
id: 'info-dropdown',
|
||||
className: 'info-dropdown',
|
||||
'aria-label': ns.I18n.t("legal-ui.rechtliche.und.technische.informationen")
|
||||
'aria-label': ns.I18n.t("info.menu-label")
|
||||
});
|
||||
append(control, dropdown);
|
||||
return dropdown;
|
||||
@@ -191,7 +191,7 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
|
||||
function setInfoButtonLabel(infoButton) {
|
||||
if (typeof infoButton.getAttribute === 'function' && infoButton.getAttribute('aria-label')) return;
|
||||
setAttribute(infoButton, 'aria-label', ns.I18n.t("legal-ui.hilfe.und.informationen.offnen"));
|
||||
setAttribute(infoButton, 'aria-label', ns.I18n.t("info.open"));
|
||||
}
|
||||
|
||||
function ensureInfoButtonIcon(infoButton) {
|
||||
@@ -201,7 +201,7 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
|
||||
function configureDropdown(dropdown) {
|
||||
if (!dropdown) return;
|
||||
setAttribute(dropdown, 'aria-label', ns.I18n.t("legal-ui.rechtliche.und.technische.informationen"));
|
||||
setAttribute(dropdown, 'aria-label', ns.I18n.t("info.menu-label"));
|
||||
setHidden(dropdown, true);
|
||||
menuEntries().forEach(([target, label]) => ensureMenuButton(dropdown, target, label));
|
||||
}
|
||||
@@ -277,7 +277,7 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
|
||||
function configureBackButton(backButton) {
|
||||
setAttribute(backButton, 'type', 'button');
|
||||
setAttribute(backButton, 'aria-label', ns.I18n.t("legal-ui.zuruck.zum.informationsmenu"));
|
||||
setAttribute(backButton, 'aria-label', ns.I18n.t("info.back"));
|
||||
setHidden(backButton, true);
|
||||
return backButton;
|
||||
}
|
||||
@@ -293,8 +293,8 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
const closeButton = createElement('button', {
|
||||
id: 'info-close',
|
||||
type: 'button',
|
||||
'aria-label': ns.I18n.t("legal-ui.informationsfenster.schliessen"),
|
||||
title: ns.I18n.t("legal-ui.schliessen")
|
||||
'aria-label': ns.I18n.t("info.close-label"),
|
||||
title: ns.I18n.t("info.close")
|
||||
}, '×');
|
||||
append(header, closeButton);
|
||||
return configureCloseButton(closeButton);
|
||||
@@ -302,7 +302,7 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
|
||||
function configureCloseButton(closeButton) {
|
||||
setAttribute(closeButton, 'type', 'button');
|
||||
setAttribute(closeButton, 'aria-label', ns.I18n.t("legal-ui.informationsfenster.schliessen"));
|
||||
setAttribute(closeButton, 'aria-label', ns.I18n.t("info.close-label"));
|
||||
if (closeButton && !String(closeButton.textContent ?? '').trim()) closeButton.textContent = '×';
|
||||
return closeButton;
|
||||
}
|
||||
@@ -436,7 +436,7 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
}
|
||||
|
||||
function updateDialogTitle(pageName) {
|
||||
if (elements?.title) elements.title.textContent = pageTitles[pageName] ?? ns.I18n.t("legal-ui.informationen");
|
||||
if (elements?.title) elements.title.textContent = pageTitles[pageName] ?? ns.I18n.t("info.title");
|
||||
}
|
||||
|
||||
function focusSafely(element) {
|
||||
|
||||
Reference in New Issue
Block a user