Fixing dropdown translations

pull/89/head
Joan Guillén i Pelegay 2019-11-06 04:36:48 +01:00
rodzic eec606fa18
commit 946939209f
1 zmienionych plików z 22 dodań i 24 usunięć

Wyświetl plik

@ -578,7 +578,7 @@ SyntaxElementMorph.prototype.getVarNamesDict = function () {
var block = this.parentThatIsA(BlockMorph), var block = this.parentThatIsA(BlockMorph),
rcvr, rcvr,
tempVars = [], tempVars = [],
dict = {}; dict;
if (!block) { if (!block) {
return {}; return {};
@ -611,11 +611,9 @@ SyntaxElementMorph.prototype.getVarNamesDict = function () {
} }
}); });
if (rcvr) { if (rcvr) {
rcvr.variables.allNames().forEach(function (name) { dict = rcvr.variables.allNamesDict();
dict[name] = [name, false]; // don't translate
});
tempVars.forEach(function (name) { tempVars.forEach(function (name) {
dict[name] = [name, false]; // don't translate dict[name] = name;
}); });
if (block.selector === 'doSetVar') { if (block.selector === 'doSetVar') {
// add settable object attributes // add settable object attributes
@ -8745,21 +8743,21 @@ InputSlotMorph.prototype.menuFromDict = function (
} else if (choices[key] instanceof Object && } else if (choices[key] instanceof Object &&
!(choices[key] instanceof Array) && !(choices[key] instanceof Array) &&
(typeof choices[key] !== 'function')) { (typeof choices[key] !== 'function')) {
menu.addMenu(key, this.menuFromDict(choices[key], true)); menu.addMenu(
} else if (choices[key].length === 2) { // don't translate key,
this.menuFromDict(choices[key],true));
} else {
menu.addItem( menu.addItem(
key, key,
choices[key][0], choices[key],
null, // hint null, // hint
null, // color null, // color
null, // bold null, // bold
null, // italic null, // italic
null, // doubleClickAction null, // doubleClickAction
null, // shortcut null, // shortcut
true // verbatim - do not translate choices[key].length === 1 || typeof choices[key] === 'function' ? false : true // verbatim?
); );
} else { // translate
menu.addItem(key, choices[key]);
} }
} }
} }
@ -8779,7 +8777,7 @@ InputSlotMorph.prototype.messagesMenu = function () {
} }
}); });
allNames.forEach(function (name) { allNames.forEach(function (name) {
dict[name] = [name, false]; // don't translate dict[name] = name;
}); });
if (this.world().currentKey === 16) { // shift if (this.world().currentKey === 16) { // shift
dict.__shout__go__ = ['__shout__go__']; dict.__shout__go__ = ['__shout__go__'];
@ -8816,7 +8814,7 @@ InputSlotMorph.prototype.messagesReceivedMenu = function () {
}); });
allNames.forEach(function (name) { allNames.forEach(function (name) {
if (name !== '__shout__go__') { if (name !== '__shout__go__') {
dict[name] = [name, false]; // don't translate dict[name] = name;
} }
}); });
dict['~'] = null; dict['~'] = null;
@ -8855,7 +8853,7 @@ InputSlotMorph.prototype.collidablesMenu = function () {
if (allNames.length > 0) { if (allNames.length > 0) {
dict['~'] = null; dict['~'] = null;
allNames.forEach(function (name) { allNames.forEach(function (name) {
dict[name] = [name, false]; // don't translate dict[name] = name;
}); });
} }
return dict; return dict;
@ -8880,7 +8878,7 @@ InputSlotMorph.prototype.locationMenu = function () {
if (allNames.length > 0) { if (allNames.length > 0) {
dict['~'] = null; dict['~'] = null;
allNames.forEach(function (name) { allNames.forEach(function (name) {
dict[name] = [name, false]; // don't translate dict[name] = name;
}); });
} }
return dict; return dict;
@ -8909,7 +8907,7 @@ InputSlotMorph.prototype.distancesMenu = function () {
if (allNames.length > 0) { if (allNames.length > 0) {
dict['~'] = null; dict['~'] = null;
allNames.forEach(function (name) { allNames.forEach(function (name) {
dict[name] = [name, false]; // don't translate dict[name] = name;
}); });
} }
return dict; return dict;
@ -8932,7 +8930,7 @@ InputSlotMorph.prototype.clonablesMenu = function () {
if (allNames.length > 0) { if (allNames.length > 0) {
dict['~'] = null; dict['~'] = null;
allNames.forEach(function (name) { allNames.forEach(function (name) {
dict[name] = [name, false]; // don't translate dict[name] = name;
}); });
} }
return dict; return dict;
@ -8951,7 +8949,7 @@ InputSlotMorph.prototype.objectsMenu = function (includeMyself) {
if (includeMyself) { if (includeMyself) {
dict.myself = ['myself']; dict.myself = ['myself'];
} }
dict[stage.name] = [stage.name, false]; // don't translate dict[stage.name] = stage.name;
stage.children.forEach(function (morph) { stage.children.forEach(function (morph) {
if (morph instanceof SpriteMorph && !morph.isTemporary) { if (morph instanceof SpriteMorph && !morph.isTemporary) {
allNames.push(morph.name); allNames.push(morph.name);
@ -8960,7 +8958,7 @@ InputSlotMorph.prototype.objectsMenu = function (includeMyself) {
if (allNames.length > 0) { if (allNames.length > 0) {
dict['~'] = null; dict['~'] = null;
allNames.forEach(function (name) { allNames.forEach(function (name) {
dict[name] = [name, false]; // don't translate dict[name] = name;
}); });
} }
return dict; return dict;
@ -9081,7 +9079,7 @@ InputSlotMorph.prototype.attributesMenu = function () {
if (varNames.length > 0) { if (varNames.length > 0) {
dict['~'] = null; dict['~'] = null;
varNames.forEach(function (name) { varNames.forEach(function (name) {
dict[name] = [name, false]; // don't translate dict[name] = name;
}); });
} }
obj.allBlocks(true).forEach(function (def, i) { obj.allBlocks(true).forEach(function (def, i) {
@ -9109,7 +9107,7 @@ InputSlotMorph.prototype.costumesMenu = function () {
if (allNames.length > 0) { if (allNames.length > 0) {
dict['~'] = null; dict['~'] = null;
allNames.forEach(function (name) { allNames.forEach(function (name) {
dict[name] = [name, false]; // don't translate dict[name] = name;
}); });
} }
return dict; return dict;
@ -9125,7 +9123,7 @@ InputSlotMorph.prototype.soundsMenu = function () {
}); });
if (allNames.length > 0) { if (allNames.length > 0) {
allNames.forEach(function (name) { allNames.forEach(function (name) {
dict[name] = [name, false]; // don't translate dict[name] = name;
}); });
} }
return dict; return dict;
@ -9146,7 +9144,7 @@ InputSlotMorph.prototype.shadowedVariablesMenu = function () {
// inside TELL, ASK or OF or when initializing a new clone // inside TELL, ASK or OF or when initializing a new clone
vars = rcvr.variables.names(); vars = rcvr.variables.names();
vars.forEach(function (name) { vars.forEach(function (name) {
dict[name] = [name, false]; // don't translate dict[name] = name;
}); });
attribs = rcvr.attributes; attribs = rcvr.attributes;
/* /*
@ -9161,7 +9159,7 @@ InputSlotMorph.prototype.shadowedVariablesMenu = function () {
// only show shadowed vars and attributes // only show shadowed vars and attributes
vars = rcvr.inheritedVariableNames(true); vars = rcvr.inheritedVariableNames(true);
vars.forEach(function (name) { vars.forEach(function (name) {
dict[name] = [name, false]; dict[name] = name;
}); });
attribs = rcvr.shadowedAttributes(); attribs = rcvr.shadowedAttributes();
/* /*