From 4a9f2931d47c8c2fcc94858e3e9e9ddecb3a41c0 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Thu, 15 Dec 2022 20:22:13 +0100 Subject: [PATCH] firmware/bootloaderInstructions: Group instruction steps. --- .../BootloaderInstructions.tsx | 60 ++++++++++++------- .../translations/en.json | 46 +++++++------- 2 files changed, 63 insertions(+), 43 deletions(-) diff --git a/src/firmware/bootloaderInstructions/BootloaderInstructions.tsx b/src/firmware/bootloaderInstructions/BootloaderInstructions.tsx index f6175288..b03b08ee 100644 --- a/src/firmware/bootloaderInstructions/BootloaderInstructions.tsx +++ b/src/firmware/bootloaderInstructions/BootloaderInstructions.tsx @@ -206,19 +206,21 @@ const BootloaderInstructions: React.VoidFunctionComponent<

- {i18n.translate('prepare.start')} + {i18n.translate('instructionGroup.prepare.title')}

  1. {i18n.translate( - hubHasUSB(hubType) ? 'prepare.usb' : 'prepare.batteries', + hubHasUSB(hubType) + ? 'instructionGroup.prepare.usb' + : 'instructionGroup.prepare.batteries', )}
  2. -
  3. {i18n.translate('prepare.turnOff')}
  4. +
  5. {i18n.translate('instructionGroup.prepare.turnOff')}
  6. {/* For non-usb recovery, show step about official app */} {recovery && !hubHasUSB(hubType) ? (
  7. - {i18n.translate('prepare.app', { + {i18n.translate('instructionGroup.prepare.app', { lego: legoRegisteredTrademark, })}
  8. @@ -227,7 +229,9 @@ const BootloaderInstructions: React.VoidFunctionComponent< )}

- {i18n.translate('step.start')} + + {i18n.translate('instructionGroup.bootloaderMode.title')} +

    {/* City hub has power issues and requires disconnecting motors/sensors */} @@ -237,7 +241,7 @@ const BootloaderInstructions: React.VoidFunctionComponent< activeStep === 'disconnect-io' && 'pb-active-step', )} > - {i18n.translate('step.disconnectIo')} + {i18n.translate('instructionGroup.bootloaderMode.disconnectIo')} )} @@ -246,7 +250,9 @@ const BootloaderInstructions: React.VoidFunctionComponent< activeStep === 'hold-button' && 'pb-active-step', )} > - {i18n.translate('step.holdButton', { button })} + {i18n.translate('instructionGroup.bootloaderMode.holdButton', { + button, + })} {/* not strictly necessary, but order is swapped in the video, @@ -257,7 +263,7 @@ const BootloaderInstructions: React.VoidFunctionComponent< activeStep === 'connect-usb' && 'pb-active-step', )} > - {i18n.translate('step.connectUsb')} + {i18n.translate('instructionGroup.bootloaderMode.connectUsb')} )} @@ -266,7 +272,7 @@ const BootloaderInstructions: React.VoidFunctionComponent< activeStep === 'wait-for-light' && 'pb-active-step', )} > - {i18n.translate('step.waitForLight', { + {i18n.translate('instructionGroup.bootloaderMode.waitForLight', { button, light, lightPattern, @@ -279,7 +285,7 @@ const BootloaderInstructions: React.VoidFunctionComponent< activeStep === 'connect-usb' && 'pb-active-step', )} > - {i18n.translate('step.connectUsb')} + {i18n.translate('instructionGroup.bootloaderMode.connectUsb')} )} @@ -289,7 +295,9 @@ const BootloaderInstructions: React.VoidFunctionComponent< activeStep === 'wait-app-connect' && 'pb-active-step', )} > - {i18n.translate('step.waitAppConnect')} + {i18n.translate( + 'instructionGroup.bootloaderMode.waitAppConnect', + )} )} @@ -300,9 +308,12 @@ const BootloaderInstructions: React.VoidFunctionComponent< activeStep === 'release-button' && 'pb-active-step', )} > - {i18n.translate('step.releaseButton', { - button, - })} + {i18n.translate( + 'instructionGroup.bootloaderMode.releaseButton', + { + button, + }, + )} ) : (
  1. - {i18n.translate('step.keepHolding', { + {i18n.translate('instructionGroup.bootloaderMode.keepHolding', { button, })}
  2. @@ -319,16 +330,21 @@ const BootloaderInstructions: React.VoidFunctionComponent< {hubHasUSB(hubType) || (!hubHasUSB(hubType) && !recovery) ? ( <>

    - {i18n.translate('connect.start')} + + {i18n.translate('instructionGroup.connect.title')} +

    1. - {i18n.translate('connect.clickConnectAndFlash', { - flashButton: {flashButtonText}, - })} + {i18n.translate( + 'instructionGroup.connect.clickConnectAndFlash', + { + flashButton: {flashButtonText}, + }, + )}
    2. - {i18n.translate('connect.selectDevice', { + {i18n.translate('instructionGroup.connect.selectDevice', { deviceName: ( {bootloaderDeviceNameMap.get(hubType)} @@ -336,7 +352,9 @@ const BootloaderInstructions: React.VoidFunctionComponent< ), connectButton: ( - {i18n.translate('connect.connectButton')} + {i18n.translate( + 'instructionGroup.connect.connectButton', + )} ), })} diff --git a/src/firmware/bootloaderInstructions/translations/en.json b/src/firmware/bootloaderInstructions/translations/en.json index c6df4bba..306f8aee 100644 --- a/src/firmware/bootloaderInstructions/translations/en.json +++ b/src/firmware/bootloaderInstructions/translations/en.json @@ -4,13 +4,6 @@ "windows": " If you have never used Pybricks with USB on Windows, you may need to manually install a USB driver before you can flash the hub firmware.", "learnMore": "Learn more." }, - "prepare": { - "start": "Preparation:", - "batteries": "Make sure the hub has new or fully-charged batteries.", - "turnOff": "Make sure the hub is turned off.", - "usb": "Disconnect the USB cable.", - "app": "Open the {lego} PoweredUp app in 'Create' mode and start a new project." - }, "button": { "bluetooth": "Bluetooth button", "power": "button" @@ -23,20 +16,29 @@ "bluetooth": "pink-green-blue-off", "status": "light purple" }, - "step": { - "start": "Enter update mode (see video):", - "disconnectIo": "Disconnect any device from port A on the hub.", - "holdButton": "Press and hold the {button} on the hub.", - "connectUsb": "Connect the USB cable.", - "waitForLight": "Wait for the {light} to start blinking {lightPattern}.", - "waitAppConnect": "The app will automatically connect and start restoring the firmware.", - "releaseButton": "Release the {button}.", - "keepHolding": "Keep holding the {button}." - }, - "connect": { - "start": "Install:", - "clickConnectAndFlash": "Click the {flashButton} button below.", - "selectDevice": "In the pop-up dialog, select {deviceName} and click {connectButton}.", - "connectButton": "Connect" + "instructionGroup": { + "prepare": { + "title": "Preparation:", + "batteries": "Make sure the hub has new or fully-charged batteries.", + "turnOff": "Make sure the hub is turned off.", + "usb": "Disconnect the USB cable.", + "app": "Open the {lego} PoweredUp app in 'Create' mode and start a new project." + }, + "bootloaderMode": { + "title": "Enter update mode (see video):", + "disconnectIo": "Disconnect any device from port A on the hub.", + "holdButton": "Press and hold the {button} on the hub.", + "connectUsb": "Connect the USB cable.", + "waitForLight": "Wait for the {light} to start blinking {lightPattern}.", + "waitAppConnect": "The app will automatically connect and start restoring the firmware.", + "releaseButton": "Release the {button}.", + "keepHolding": "Keep holding the {button}." + }, + "connect": { + "title": "Install:", + "clickConnectAndFlash": "Click the {flashButton} button below.", + "selectDevice": "In the pop-up dialog, select {deviceName} and click {connectButton}.", + "connectButton": "Connect" + } } }