diff --git a/src/KeyboardInputModal.js b/src/KeyboardInputModal.js index 27f1a8e6..b2d982a1 100644 --- a/src/KeyboardInputModal.js +++ b/src/KeyboardInputModal.js @@ -10,6 +10,7 @@ import type {KeyDef, KeyboardInputScheme, KeyboardInputSchemeName} from './Keybo import {KeyboardInputSchemes, getLabelMessageKeyFromKeyDef, getIconMessageKeyFromKeyDef} from './KeyboardInputSchemes'; import ToggleSwitch from './ToggleSwitch'; +import { isAppleDevice } from './Utils'; import { ReactComponent as KeyboardIcon} from './svg/Keyboard.svg' @@ -94,6 +95,8 @@ class KeyboardInputModal extends React.Component { const itemKey = "binding-" + index; const keyDef: KeyDef = keyboardInputScheme[key].keyDef; @@ -115,12 +118,12 @@ class KeyboardInputModal extends React.Component {altKeyIcon} @@ -141,7 +144,15 @@ class KeyboardInputModal extends React.Component); } - const labelKeyString = labelKeySegments.join(" + ") + let labelKeyString = labelKeySegments[0]; + if (labelKeySegments.length > 1) { + if (labelKeySegments.length > 2) { + labelKeyString += ", " + labelKeySegments.slice(1, labelKeySegments.length - 1).join(", ") + ","; + } + + labelKeyString += " and " + labelKeySegments[labelKeySegments.length - 1]; + } + const descriptionMessageKey = "KeyboardInputModal.Description." + key; const descriptionMessageId = "key-binding-description-" + index; keyBindingElements.push(
  • @@ -163,10 +174,15 @@ class KeyboardInputModal extends React.Component { const messageId = "KeyboardInputModal.Scheme.Descriptions." + schemeName; - const optionText = this.props.intl.formatMessage({ id: messageId }); + const optionText = this.props.intl.formatMessage({ id: messageId }, { alt: altKeyLabel }); selectOptionElements.push(); diff --git a/src/Utils.js b/src/Utils.js index a443d655..d156a4f3 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -93,4 +93,15 @@ function focusByQuerySelector (selectors: string) { } } -export { extend, focusByQuerySelector, generateId, makeDelayedPromise, generateEncodedProgramURL, getThemeFromString, getWorldFromString }; +const ApplePlatforms = [ + "iPad", + "iPhone", + "iPod", + "MacIntel" +] + +function isAppleDevice () :boolean { + return ApplePlatforms.indexOf(window.navigator.platform) !== -1; +} + +export { extend, focusByQuerySelector, generateId, makeDelayedPromise, generateEncodedProgramURL, getThemeFromString, getWorldFromString, isAppleDevice }; diff --git a/src/messages.json b/src/messages.json index 52015bb6..0ad9202a 100644 --- a/src/messages.json +++ b/src/messages.json @@ -128,33 +128,35 @@ "Jungle.pond": "the Pond", "Jungle.tree": "a Tree", "KeyboardInputModal.Cancel": "Cancel", - "KeyboardInputModal.Description.addCommandToBeginning": "Press {key} to add the selected command to the beginning of the program.", - "KeyboardInputModal.Description.addCommandToEnd": "Press {key} to add the selected command to the end of the program.", - "KeyboardInputModal.Description.announceScene": "Press {key} to announce the character position and orientation.", - "KeyboardInputModal.Description.deleteCurrentStep": "Press {key} to delete the currently focused step.", - "KeyboardInputModal.Description.decreaseProgramSpeed": "Press {key} to make the program play slower.", - "KeyboardInputModal.Description.increaseProgramSpeed": "Press {key} to make the program play faster.", - "KeyboardInputModal.Description.playPauseProgram": "Press {key} to play or pause the program.", - "KeyboardInputModal.Description.refreshScene": "Press {key} to refresh the scene.", + "KeyboardInputModal.Description.addCommandToBeginning": "Press {key} together to add the selected command to the beginning of the program.", + "KeyboardInputModal.Description.addCommandToEnd": "Press {key} together to add the selected command to the end of the program.", + "KeyboardInputModal.Description.announceScene": "Press {key} together to announce the charactaer position and orientation.", + "KeyboardInputModal.Description.deleteCurrentStep": "Press {key} together to delete the currently focused step.", + "KeyboardInputModal.Description.decreaseProgramSpeed": "Press {key} together to make the program play slower.", + "KeyboardInputModal.Description.increaseProgramSpeed": "Press {key} together to make the program play faster.", + "KeyboardInputModal.Description.playPauseProgram": "Press {key} together to play or pause the program.", + "KeyboardInputModal.Description.refreshScene": "Press {key} together to refresh the scene.", "KeyboardInputModal.Description.showHide": "Press {key} to show / hide the keyboard shortcuts menu.", - "KeyboardInputModal.Description.stopProgram": "Press {key} to stop the program.", - "KeyboardInputModal.Description.toggleAnnouncements": "Press {key} to toggle announcements.", + "KeyboardInputModal.Description.stopProgram": "Press {key} together to stop the program.", + "KeyboardInputModal.Description.toggleAnnouncements": "Press {key} together to toggle announcements.", "KeyboardInputModal.KeyLabels.Alt": "Alt", "KeyboardInputModal.KeyLabels.Control": "Control", + "KeyboardInputModal.KeyLabels.Option": "Option", "KeyboardInputModal.KeyLabels.QuestionMark": "question mark", "KeyboardInputModal.KeyLabels.GreaterThan": "greater than", "KeyboardInputModal.KeyLabels.LessThan": "less than", - "KeyboardInputModal.KeyLabels.A": "a", - "KeyboardInputModal.KeyLabels.B": "b", - "KeyboardInputModal.KeyLabels.D": "d", - "KeyboardInputModal.KeyLabels.E": "e", - "KeyboardInputModal.KeyLabels.I": "i", - "KeyboardInputModal.KeyLabels.P": "p", - "KeyboardInputModal.KeyLabels.S": "s", - "KeyboardInputModal.KeyLabels.R": "r", + "KeyboardInputModal.KeyLabels.A": "A", + "KeyboardInputModal.KeyLabels.B": "B", + "KeyboardInputModal.KeyLabels.D": "D", + "KeyboardInputModal.KeyLabels.E": "E", + "KeyboardInputModal.KeyLabels.I": "I", + "KeyboardInputModal.KeyLabels.P": "P", + "KeyboardInputModal.KeyLabels.S": "S", + "KeyboardInputModal.KeyLabels.R": "R", "KeyboardInputModal.KeyIcons.Alt": "Alt", "KeyboardInputModal.KeyIcons.Control": "Ctrl", "KeyboardInputModal.KeyIcons.Shift": "Shift", + "KeyboardInputModal.KeyIcons.Option": "⌥", "KeyboardInputModal.KeyIcons.QuestionMark": "?", "KeyboardInputModal.KeyIcons.GreaterThan": ">", "KeyboardInputModal.KeyIcons.LessThan": "<", @@ -167,8 +169,8 @@ "KeyboardInputModal.KeyIcons.S": "S", "KeyboardInputModal.KeyIcons.R": "R", "KeyboardInputModal.Save": "Save", - "KeyboardInputModal.Scheme.Descriptions.controlalt": "Control+Alt (Apple: Control+Option)", - "KeyboardInputModal.Scheme.Descriptions.alt": "Alt (Apple: Option)", + "KeyboardInputModal.Scheme.Descriptions.controlalt": "Control+{alt}", + "KeyboardInputModal.Scheme.Descriptions.alt": "{alt}", "KeyboardInputModal.ShowHide.AriaLabel": "Display keyboard shortcuts menu", "KeyboardInputModal.Title": "Keyboard Shortcuts", "KeyboardInputModal.Toggle.AriaLabel": "Turn keyboard shortcuts on or off",