From 4ffa6a0aaa6a34a32878d88f66a170d86c4f518c Mon Sep 17 00:00:00 2001 From: "Aman Chadha(IVIXMMI)" <79802170+ac-mmi@users.noreply.github.com> Date: Sat, 25 Oct 2025 21:41:54 +0530 Subject: [PATCH 1/3] Simplify translation fallback mechanism Refactor translation logic to remove title case fallback. --- js/utils/utils.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/js/utils/utils.js b/js/utils/utils.js index c6940e2359..e0c6df4075 100644 --- a/js/utils/utils.js +++ b/js/utils/utils.js @@ -108,10 +108,6 @@ function _(text, options = {}) { translated = i18next.t(text, options); if (!translated || translated === text) translated = i18next.t(cleanedText, options); if (!translated || translated === text) translated = i18next.t(text.toLowerCase(), options); - if (!translated || translated === text) { - const titleCase = text.charAt(0).toUpperCase() + text.slice(1).toLowerCase(); - translated = i18next.t(titleCase, options); - } if (!translated || translated === text) { const hyphenatedText = cleanedText.replace(/ /g, "-"); translated = i18next.t(hyphenatedText, options); @@ -1649,4 +1645,4 @@ if (typeof module !== "undefined" && module.exports) { hexToRGB, hex2rgb }; -} \ No newline at end of file +} From 88c1b94ef9d4143c9c61d573a733899e8bb00494 Mon Sep 17 00:00:00 2001 From: "Aman Chadha(IVIXMMI)" <79802170+ac-mmi@users.noreply.github.com> Date: Sun, 26 Oct 2025 02:29:06 +0530 Subject: [PATCH 2/3] Update utils.js --- js/utils/utils.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/js/utils/utils.js b/js/utils/utils.js index e0c6df4075..93317952ae 100644 --- a/js/utils/utils.js +++ b/js/utils/utils.js @@ -94,24 +94,8 @@ function _(text, options = {}) { }; translated = resolveObj(text); - if (!translated || translated === text) translated = resolveObj(cleanedText); - if (!translated || translated === text) translated = resolveObj(text.toLowerCase()); - if (!translated || translated === text) { - const titleCase = text.charAt(0).toUpperCase() + text.slice(1).toLowerCase(); - translated = resolveObj(titleCase); - } - if (!translated || translated === text) { - const hyphenatedText = cleanedText.replace(/ /g, "-"); - translated = resolveObj(hyphenatedText); - } } else { translated = i18next.t(text, options); - if (!translated || translated === text) translated = i18next.t(cleanedText, options); - if (!translated || translated === text) translated = i18next.t(text.toLowerCase(), options); - if (!translated || translated === text) { - const hyphenatedText = cleanedText.replace(/ /g, "-"); - translated = i18next.t(hyphenatedText, options); - } } return translated || text; From 23db80719e064d7601e4ed51784283c4a6499ac7 Mon Sep 17 00:00:00 2001 From: "Aman Chadha(IVIXMMI)" <79802170+ac-mmi@users.noreply.github.com> Date: Sun, 26 Oct 2025 15:49:06 +0530 Subject: [PATCH 3/3] Updated _getPitch(c) in block.js --- js/block.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/js/block.js b/js/block.js index ff125a27b6..2af7be4db5 100644 --- a/js/block.js +++ b/js/block.js @@ -2471,28 +2471,35 @@ class Block { c2 = this.blocks.blockList[c].connections[2]; if (this.blocks.blockList[c2].name === "number") { if (this.blocks.blockList[c1].name === "solfege") { - const solfnotes_ = _("ti la sol fa mi re do").split(" "); + // English reference for logic + const solfnotesRef = ["ti", "la", "sol", "fa", "mi", "re", "do"]; + // Localized notes for display + const solfnotesLocalized = _("ti la sol fa mi re do").split(" "); + const stripped = this.blocks.blockList[c1].value .replace(SHARP, "") .replace(FLAT, "") .replace(DOUBLESHARP, "") .replace(DOUBLEFLAT, ""); - const i = ["ti", "la", "sol", "fa", "mi", "re", "do"].indexOf(stripped); + + const i = solfnotesRef.indexOf(stripped); + if (i === -1) { + // fallback if note not found + return stripped + " " + this.blocks.blockList[c2].value; + } + if (this.blocks.blockList[c1].value.includes(SHARP)) { - return solfnotes_[i] + SHARP + " " + this.blocks.blockList[c2].value; + return solfnotesLocalized[i] + SHARP + " " + this.blocks.blockList[c2].value; } else if (this.blocks.blockList[c1].value.includes(FLAT)) { - return solfnotes_[i] + FLAT + " " + this.blocks.blockList[c2].value; + return solfnotesLocalized[i] + FLAT + " " + this.blocks.blockList[c2].value; } else if (this.blocks.blockList[c1].value.includes(DOUBLESHARP)) { - return ( - solfnotes_[i] + DOUBLESHARP + " " + this.blocks.blockList[c2].value - ); + return solfnotesLocalized[i] + DOUBLESHARP + " " + this.blocks.blockList[c2].value; } else if (this.blocks.blockList[c1].value.includes(DOUBLEFLAT)) { - return ( - solfnotes_[i] + DOUBLEFLAT + " " + this.blocks.blockList[c2].value - ); + return solfnotesLocalized[i] + DOUBLEFLAT + " " + this.blocks.blockList[c2].value; } else { - return solfnotes_[i] + " " + this.blocks.blockList[c2].value; + return solfnotesLocalized[i] + " " + this.blocks.blockList[c2].value; } + } else if (this.blocks.blockList[c1].name === "notename") { return ( this.blocks.blockList[c1].value + " " + this.blocks.blockList[c2].value