From 0e621ae34ec1c8c0d81b83ce95eed51f0ab2d617 Mon Sep 17 00:00:00 2001 From: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Date: Tue, 28 May 2024 00:09:39 +0200 Subject: [PATCH] fix: add type check for undefined, use fallback when no translation for aspect ratios was given (#3025) --- javascript/localization.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/javascript/localization.js b/javascript/localization.js index 9f13d6fcb..21b3b3332 100644 --- a/javascript/localization.js +++ b/javascript/localization.js @@ -81,9 +81,12 @@ function refresh_style_localization() { } function refresh_aspect_ratios_label(value) { - label = document.querySelector('#aspect_ratios_accordion div span[data-original-text="Aspect Ratios"]') - translation = getTranslation("Aspect Ratios") - label.textContent = translation + " " + htmlDecode(value) + label = document.querySelector('#aspect_ratios_accordion div span[data-original-text="Aspect Ratios"]'); + translation = getTranslation("Aspect Ratios"); + if (typeof translation == "undefined") { + translation = "Aspect Ratios"; + } + label.textContent = translation + " " + htmlDecode(value); } function localizeWholePage() {