diff --git a/src/containers/costume-tab.jsx b/src/containers/costume-tab.jsx index 92a3e65d8cfb313e08d06e16d9cba87c648f755f..708e84adc6ea0740febdaf72a4156a38066ed1c6 100644 --- a/src/containers/costume-tab.jsx +++ b/src/containers/costume-tab.jsx @@ -195,7 +195,8 @@ class CostumeTab extends React.Component { } handleCameraBuffer (buffer) { const storage = this.props.vm.runtime.storage; - costumeUpload(buffer, 'image/png', 'costume1', storage, this.handleNewCostume); + const name = this.props.intl.formatMessage(messages.costume, {index: 1}); + costumeUpload(buffer, 'image/png', name, storage, this.handleNewCostume); } handleFileUploadClick () { this.fileInput.click(); diff --git a/src/containers/target-pane.jsx b/src/containers/target-pane.jsx index a34fb8e39bd0ca337ea90d48350007cddecfd2fe..a2e5fdcc5f11eeb516375c2908da2214f75ffeb4 100644 --- a/src/containers/target-pane.jsx +++ b/src/containers/target-pane.jsx @@ -132,8 +132,9 @@ class TargetPane extends React.Component { } handleSpriteUpload (e) { const storage = this.props.vm.runtime.storage; + const costumeSuffix = this.props.intl.formatMessage(sharedMessages.costume, {index: 1}); handleFileUpload(e.target, (buffer, fileType, fileName) => { - spriteUpload(buffer, fileType, fileName, storage, this.handleNewSprite); + spriteUpload(buffer, fileType, fileName, storage, this.handleNewSprite, costumeSuffix); }); } setFileInput (input) { diff --git a/src/lib/file-uploader.js b/src/lib/file-uploader.js index 53d0ab8f651442ebfe4e2d27e5484fe52fdeabbd..afa4371dde134bf46ea4af540d24d74ec309bf26 100644 --- a/src/lib/file-uploader.js +++ b/src/lib/file-uploader.js @@ -180,7 +180,8 @@ const soundUpload = function (fileData, fileType, soundName, storage, handleSoun handleSound(vmSound); }; -const spriteUpload = function (fileData, fileType, spriteName, storage, handleSprite) { +const spriteUpload = function (fileData, fileType, spriteName, storage, handleSprite, costumeSuffix) { + const costumeName = costumeSuffix || 'costume1'; switch (fileType) { case '': case 'application/zip': { // We think this is a .sprite2 or .sprite3 file @@ -191,7 +192,7 @@ const spriteUpload = function (fileData, fileType, spriteName, storage, handleSp case 'image/png': case 'image/jpeg': { // Make a sprite from an image by making it a costume first - costumeUpload(fileData, fileType, `${spriteName}-costume1`, storage, (vmCostume => { + costumeUpload(fileData, fileType, `${spriteName}-${costumeName}`, storage, (vmCostume => { const newSprite = { name: spriteName, isStage: false,