summaryrefslogtreecommitdiff
path: root/gui.js
diff options
context:
space:
mode:
authorNathan Dinsmore <queryselector@gmail.com>2013-04-08 21:51:15 -0400
committerNathan Dinsmore <queryselector@gmail.com>2013-04-08 21:51:20 -0400
commit40922d360ca86d4c96b4115fa336661480350ca6 (patch)
treef07e03b0102363e5f7ad1bece41ff4f9482b63fb /gui.js
parent4c9fee58ee2da2191c589a3b4fd5c601d281eea0 (diff)
downloadsnap-40922d360ca86d4c96b4115fa336661480350ca6.tar.gz
snap-40922d360ca86d4c96b4115fa336661480350ca6.zip
Fixed #3
When a locale is loaded with #lang:xx, the names of the new project and the sprite it contains are now localized
Diffstat (limited to 'gui.js')
-rw-r--r--gui.js26
1 files changed, 17 insertions, 9 deletions
diff --git a/gui.js b/gui.js
index cafd100..4faa1a1 100644
--- a/gui.js
+++ b/gui.js
@@ -269,7 +269,7 @@ IDE_Morph.prototype.openIn = function (world) {
);
} else if (location.hash.substr(0, 6) === '#lang:') {
this.setLanguage(location.hash.substr(6));
- this.newProject();
+ this.loadNewProject = true;
} else if (location.hash.substr(0, 7) === '#signup') {
this.createCloudAccount();
}
@@ -2177,7 +2177,9 @@ IDE_Morph.prototype.newProject = function () {
if (this.stage) {
this.stage.destroy();
}
- location.hash = '';
+ if (location.hash.substr(0, 6) !== '#lang:') {
+ location.hash = '';
+ }
this.globalVariables = new VariableFrame();
this.currentSprite = new SpriteMorph(this.globalVariables);
this.sprites = new List([this.currentSprite]);
@@ -2788,21 +2790,27 @@ IDE_Morph.prototype.setLanguage = function (lang) {
IDE_Morph.prototype.reflectLanguage = function (lang) {
var projectData;
SnapTranslator.language = lang;
- if (Process.prototype.isCatchingErrors) {
- try {
+ if (!this.loadNewProject) {
+ if (Process.prototype.isCatchingErrors) {
+ try {
+ projectData = this.serializer.serialize(this.stage);
+ } catch (err) {
+ this.showMessage('Serialization failed: ' + err);
+ }
+ } else {
projectData = this.serializer.serialize(this.stage);
- } catch (err) {
- this.showMessage('Serialization failed: ' + err);
}
- } else {
- projectData = this.serializer.serialize(this.stage);
}
SpriteMorph.prototype.initBlocks();
this.spriteBar.tabBar.tabTo('scripts');
this.createCategories();
this.createCorralBar();
this.fixLayout();
- this.openProjectString(projectData);
+ if (this.loadNewProject){
+ this.newProject();
+ } else {
+ this.openProjectString(projectData);
+ }
};
// IDE_Morph blocks scaling