Skip to content

Commit c508aef

Browse files
committed
fix i18n issue with interval names
1 parent a8f6de1 commit c508aef

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

js/block.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,10 +544,10 @@ function Block(protoblock, blocks, overrideName) {
544544
this.value = getModeName(DEFAULTMODE);
545545
break;
546546
case 'intervalname':
547-
this.value = DEFAULTINTERVAL;
547+
this.value = getIntervalName(DEFAULTINTERVAL);
548548
break;
549549
case 'voicename':
550-
this.value = DEFAULTVOICE;
550+
this.value = getVoiceName(DEFAULTVOICE);
551551
break;
552552
case 'drumname':
553553
this.value = getDrumName(DEFAULTDRUM);

js/logo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7689,7 +7689,7 @@ function Logo () {
76897689

76907690
if (that.blocks.blockList[blk].name === 'intervalname') {
76917691
if (typeof(that.blocks.blockList[blk].value) === 'string') {
7692-
return INTERVALVALUES[that.blocks.blockList[blk].value];
7692+
return getIntervalNumber(that.blocks.blockList[blk].value);
76937693
} else {
76947694
return 0;
76957695
}

js/musicutils.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,20 @@ function getIntervalName(name) {
526526
};
527527

528528

529+
function getIntervalNumber(name) {
530+
for (var interval in INTERVALNAMES) {
531+
if (INTERVALNAMES[interval][0] === name) {
532+
return INTERVALVALUES[INTERVALNAMES[interval][1]];
533+
} else if (INTERVALNAMES[interval][1] === name) {
534+
return INTERVALVALUES[INTERVALNAMES[interval][1]];
535+
}
536+
}
537+
538+
console.log(name + ' not found in INTERVALNAMES');
539+
return 0;
540+
};
541+
542+
529543
function getModeName(name) {
530544
for (var mode in MODENAMES) {
531545
if (MODENAMES[mode][0] === name || MODENAMES[mode][1].toLowerCase() === name.toLowerCase()) {

0 commit comments

Comments
 (0)