mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
Allow splitting long notifications
This adds the ability to split notification messages in to multiple paragraphs.
This commit is contained in:
@@ -20,5 +20,20 @@ export default function Notification(props: OwnProps): JSX.Element {
|
||||
fallback: en,
|
||||
});
|
||||
const { messageId, replacements } = props;
|
||||
return <>{i18n.translate(messageId, replacements)}</>;
|
||||
let message = i18n.translate(messageId, replacements) as
|
||||
| React.ReactElement
|
||||
| string;
|
||||
|
||||
// Use newline characters to create paragraphs
|
||||
if (typeof message === 'string') {
|
||||
message = (
|
||||
<>
|
||||
{message.split('\n').map((x, i) => (
|
||||
<p key={i}>{x}</p>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
},
|
||||
"ble": {
|
||||
"gattPermission": "The web browser did not give permission to use Bluetooth Low Energy",
|
||||
"gattServiceNotFound": "Connected to hub but failed to get {serviceName} service. Ensure that you are using the most recent firmware. If the problem persists, try removing the \"{hubName}\" device in your OS Bluetooth settings, then try connecting again.",
|
||||
"gattServiceNotFound": "Connected to hub but failed to get {serviceName} service.\nEnsure that you are using the most recent firmware.\nIf the problem persists, try removing the \"{hubName}\" device in your OS Bluetooth settings, then try connecting again.",
|
||||
"noWebBluetooth": "This web browser does not support Web Bluetooth or it is not enabled.",
|
||||
"noBluetooth": "No Bluetooth adapter could be found. Bluetooth won't work.",
|
||||
"unexpectedError": "Unexpected error while trying to connect: {errorMessage}"
|
||||
},
|
||||
"editor": {
|
||||
"programChanged": {
|
||||
"message": "The program was changed in another window. Do you want to delete this program and replace it with the new program?",
|
||||
"message": "The program was changed in another window.\nDo you want to delete this program and replace it with the new program?",
|
||||
"action": "Reload"
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user