Merge pull request #104 from chrisgarrity/bug/gh102

Localize sample project name
This commit is contained in:
chrisgarrity 2016-06-23 15:37:22 -04:00 committed by GitHub
commit 576bf9d0e7
2 changed files with 6 additions and 2 deletions

View file

@ -16,6 +16,7 @@ import ScriptsPane from './ui/ScriptsPane';
import Events from '../utils/Events'; import Events from '../utils/Events';
import BlockSpecs from './blocks/BlockSpecs'; import BlockSpecs from './blocks/BlockSpecs';
import Runtime from './engine/Runtime'; import Runtime from './engine/Runtime';
import Localization from '../utils/Localization';
import {libInit, gn, scaleMultiplier, newHTML, import {libInit, gn, scaleMultiplier, newHTML,
isAndroid, isTablet, getUrlVars, CSSTransition3D, frame} from '../utils/lib'; isAndroid, isTablet, getUrlVars, CSSTransition3D, frame} from '../utils/lib';
@ -362,9 +363,11 @@ export default class ScratchJr {
static saveProject (e, onDone) { static saveProject (e, onDone) {
if (ScratchJr.isEditable() && editmode == 'storyStarter' && storyStarted && !Project.error) { if (ScratchJr.isEditable() && editmode == 'storyStarter' && storyStarted && !Project.error) {
iOS.analyticsEvent('samples', 'story_starter_edited', Project.metadata.name); iOS.analyticsEvent('samples', 'story_starter_edited', Project.metadata.name);
// Localize sample project names
var sampleName = Localization.localize('SAMPLE_' + Project.metadata.name);
// Get the new project name // Get the new project name
IO.uniqueProjectName({ IO.uniqueProjectName({
name: Project.metadata.name name: sampleName
}, function (jsonData) { }, function (jsonData) {
var newName = jsonData.name; var newName = jsonData.name;
Project.metadata.name = newName; Project.metadata.name = newName;

View file

@ -316,8 +316,9 @@ export default class UI {
if (ScratchJr.isEditable() && ScratchJr.editmode == 'storyStarter' && !Project.error) { if (ScratchJr.isEditable() && ScratchJr.editmode == 'storyStarter' && !Project.error) {
iOS.analyticsEvent('samples', 'story_starter_edited', Project.metadata.name); iOS.analyticsEvent('samples', 'story_starter_edited', Project.metadata.name);
// Get the new project name // Get the new project name
var sampleName = Localization.localize('SAMPLE_' + Project.metadata.name);
IO.uniqueProjectName({ IO.uniqueProjectName({
name: Project.metadata.name name: sampleName
}, function (jsonData) { }, function (jsonData) {
var newName = jsonData.name; var newName = jsonData.name;
Project.metadata.name = newName; Project.metadata.name = newName;