When a locale is loaded with #lang:xx, the names of the new project and the sprite it contains are now localized
pull/3/merge
Nathan Dinsmore 2013-04-08 21:51:15 -04:00
rodzic 4c9fee58ee
commit 40922d360c
1 zmienionych plików z 17 dodań i 9 usunięć

10
gui.js
Wyświetl plik

@ -269,7 +269,7 @@ IDE_Morph.prototype.openIn = function (world) {
); );
} else if (location.hash.substr(0, 6) === '#lang:') { } else if (location.hash.substr(0, 6) === '#lang:') {
this.setLanguage(location.hash.substr(6)); this.setLanguage(location.hash.substr(6));
this.newProject(); this.loadNewProject = true;
} else if (location.hash.substr(0, 7) === '#signup') { } else if (location.hash.substr(0, 7) === '#signup') {
this.createCloudAccount(); this.createCloudAccount();
} }
@ -2177,7 +2177,9 @@ IDE_Morph.prototype.newProject = function () {
if (this.stage) { if (this.stage) {
this.stage.destroy(); this.stage.destroy();
} }
if (location.hash.substr(0, 6) !== '#lang:') {
location.hash = ''; location.hash = '';
}
this.globalVariables = new VariableFrame(); this.globalVariables = new VariableFrame();
this.currentSprite = new SpriteMorph(this.globalVariables); this.currentSprite = new SpriteMorph(this.globalVariables);
this.sprites = new List([this.currentSprite]); this.sprites = new List([this.currentSprite]);
@ -2788,6 +2790,7 @@ IDE_Morph.prototype.setLanguage = function (lang) {
IDE_Morph.prototype.reflectLanguage = function (lang) { IDE_Morph.prototype.reflectLanguage = function (lang) {
var projectData; var projectData;
SnapTranslator.language = lang; SnapTranslator.language = lang;
if (!this.loadNewProject) {
if (Process.prototype.isCatchingErrors) { if (Process.prototype.isCatchingErrors) {
try { try {
projectData = this.serializer.serialize(this.stage); projectData = this.serializer.serialize(this.stage);
@ -2797,12 +2800,17 @@ IDE_Morph.prototype.reflectLanguage = function (lang) {
} else { } else {
projectData = this.serializer.serialize(this.stage); projectData = this.serializer.serialize(this.stage);
} }
}
SpriteMorph.prototype.initBlocks(); SpriteMorph.prototype.initBlocks();
this.spriteBar.tabBar.tabTo('scripts'); this.spriteBar.tabBar.tabTo('scripts');
this.createCategories(); this.createCategories();
this.createCorralBar(); this.createCorralBar();
this.fixLayout(); this.fixLayout();
if (this.loadNewProject){
this.newProject();
} else {
this.openProjectString(projectData); this.openProjectString(projectData);
}
}; };
// IDE_Morph blocks scaling // IDE_Morph blocks scaling