mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-28 22:30:40 -04:00
Check for empty menuMap
This commit is contained in:
parent
5e84441542
commit
7011084517
1 changed files with 12 additions and 10 deletions
|
@ -628,17 +628,19 @@ class Scratch3Text2SpeechBlocks {
|
|||
};
|
||||
|
||||
// Get the array of localized language names
|
||||
let nameArray = languageNames.menuMap[this.getEditorLanguage()];
|
||||
// Also, get any localized names of spoken languages
|
||||
const spokenNameArray = languageNames.spokenLanguages[this.getEditorLanguage()];
|
||||
if (spokenNameArray) {
|
||||
nameArray = nameArray.concat(spokenNameArray);
|
||||
}
|
||||
// Create a map of language code to localized name
|
||||
const localizedNameMap = {};
|
||||
nameArray.forEach(lang => {
|
||||
localizedNameMap[lang.code] = lang.name;
|
||||
});
|
||||
let nameArray = languageNames.menuMap[this.getEditorLanguage()];
|
||||
if (nameArray) {
|
||||
// Also get any localized names of spoken languages
|
||||
const spokenNameArray = languageNames.spokenLanguages[this.getEditorLanguage()];
|
||||
if (spokenNameArray) {
|
||||
nameArray = nameArray.concat(spokenNameArray);
|
||||
}
|
||||
// Create a map of language code to localized name
|
||||
nameArray.forEach(lang => {
|
||||
localizedNameMap[lang.code] = lang.name;
|
||||
});
|
||||
}
|
||||
|
||||
return Object.keys(this.LANGUAGE_INFO).map(key => {
|
||||
let name = this.LANGUAGE_INFO[key].name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue