-
{message}
+const ErrorBox = ({ children, language, message, styleSet }) => (
+
);
@@ -17,6 +18,7 @@ ErrorBox.defaultProps = {
ErrorBox.propTypes = {
children: PropTypes.any,
+ language: PropTypes.string.isRequired,
message: PropTypes.string,
styleSet: PropTypes.shape({
errorBox: PropTypes.any.isRequired
diff --git a/packages/component/src/Localization/Localize.js b/packages/component/src/Localization/Localize.js
index b692b0e865..767c9c12e2 100644
--- a/packages/component/src/Localization/Localize.js
+++ b/packages/component/src/Localization/Localize.js
@@ -2,6 +2,7 @@
/* eslint complexity: "off" */
import connectToWebChat from '../connectToWebChat';
+import getLocaleString from './getLocaleString';
import csCZ from './cs-CZ';
import daDK from './da-DK';
@@ -150,4 +151,4 @@ export default connectToWebChat(({ language }) => ({ language }))(({ args, langu
localize(text, language, ...(args || []))
);
-export { localize };
+export { getLocaleString, localize };
diff --git a/packages/component/src/Localization/en-US.js b/packages/component/src/Localization/en-US.js
index d2c744b417..dff5b715b5 100644
--- a/packages/component/src/Localization/en-US.js
+++ b/packages/component/src/Localization/en-US.js
@@ -1,5 +1,7 @@
/* eslint no-magic-numbers: ["error", { "ignore": [1, 5, 24, 48, 60000, 3600000] }] */
+import getLocaleString from './getLocaleString';
+
function xMinutesAgo(dateStr) {
const date = new Date(dateStr);
const dateTime = date.getTime();
@@ -27,24 +29,19 @@ function xMinutesAgo(dateStr) {
return `Today`;
} else if (deltaInHours <= 48) {
return `Yesterday`;
- } else if (window.Intl) {
- return new Intl.DateTimeFormat('en-US').format(date);
}
-
- return date.toLocaleString('en-US', {
- day: '2-digit',
- hour: '2-digit',
- hour12: false,
- minute: '2-digit',
- month: '2-digit',
- year: 'numeric'
- });
+ return getLocaleString(date, 'en-US');
}
function botSaidSomething(avatarInitials, text) {
return `Bot ${avatarInitials} said, ${text}`;
}
+function downloadFileWithFileSize(downloadFileText, fileName, size) {
+ // Full text should read: "Download file
of size "
+ return `${downloadFileText} ${fileName} of size ${size}`;
+}
+
function userSaidSomething(avatarInitials, text) {
return `User ${avatarInitials} said, ${text}`;
}
@@ -64,8 +61,11 @@ export default {
// '[Unknown Card '%1']': '[Unknown Card '%1']',
'Adaptive Card parse error': 'Adaptive Card parse error',
'Adaptive Card render error': 'Adaptive Card render error',
+ BotSent: 'Bot sent: ',
Chat: 'Chat',
'Download file': 'Download file',
+ DownloadFileWithFileSize: downloadFileWithFileSize,
+ ErrorMessage: 'Error message',
'Microphone off': 'Microphone off',
'Microphone on': 'Microphone on',
Left: 'Left',
@@ -75,11 +75,15 @@ export default {
Right: 'Right',
Send: 'Send',
Sending: 'Sending',
+ SendStatus: 'Send status: ',
+ SentAt: 'Sent at: ',
Speak: 'Speak',
'Starting…': 'Starting…',
Tax: 'Tax',
Total: 'Total',
'Type your message': 'Type your message',
+ TypingIndicator: 'Showing typing indicator',
'Upload file': 'Upload file',
+ UserSent: 'User sent: ',
VAT: 'VAT'
};
diff --git a/packages/component/src/Localization/getLocaleString.js b/packages/component/src/Localization/getLocaleString.js
new file mode 100644
index 0000000000..b6a64f0a72
--- /dev/null
+++ b/packages/component/src/Localization/getLocaleString.js
@@ -0,0 +1,15 @@
+export default function getLocaleString(value, language) {
+ const date = new Date(value);
+ const options = {
+ day: '2-digit',
+ hour: '2-digit',
+ hour12: false,
+ minute: '2-digit',
+ month: 'long'
+ };
+
+ if (window.Intl) {
+ return !!date && new Intl.DateTimeFormat(language, options).format(date);
+ }
+ return date.toLocaleDateString(language, options);
+}
diff --git a/packages/component/src/SendBox/ConnectivityStatus.js b/packages/component/src/SendBox/ConnectivityStatus.js
index 1b4159704a..8995398dea 100644
--- a/packages/component/src/SendBox/ConnectivityStatus.js
+++ b/packages/component/src/SendBox/ConnectivityStatus.js
@@ -1,3 +1,5 @@
+/* eslint react/no-unsafe: off */
+
import PropTypes from 'prop-types';
import React from 'react';
@@ -19,7 +21,7 @@ class DebouncedConnectivityStatus extends React.Component {
};
}
- componentWillReceiveProps(nextProps) {
+ UNSAFE_componentWillReceiveProps(nextProps) {
const { children, interval } = this.props;
const { children: nextChildren, interval: nextInterval } = nextProps;
const { since } = this.state;
diff --git a/packages/component/src/Utils/TimeAgo.js b/packages/component/src/Utils/TimeAgo.js
index 51b393e2a2..c27e8a61ad 100644
--- a/packages/component/src/Utils/TimeAgo.js
+++ b/packages/component/src/Utils/TimeAgo.js
@@ -1,7 +1,9 @@
+/* eslint react/no-unsafe: off */
+
import PropTypes from 'prop-types';
import React from 'react';
-import { localize } from '../Localization/Localize';
+import { getLocaleString, localize } from '../Localization/Localize';
import connectToWebChat from '../connectToWebChat';
import Timer from './Timer';
@@ -30,7 +32,7 @@ class TimeAgo extends React.Component {
this.state = getStateFromProps(props);
}
- componentWillReceiveProps({ language, value }) {
+ UNSAFE_componentWillReceiveProps({ language, value }) {
this.updateText({ language, value });
}
@@ -47,9 +49,15 @@ class TimeAgo extends React.Component {
render() {
const { text, timer } = this.state;
+ const { language, value } = this.props;
+
+ const localizedSentAtTime = localize('SentAt', language) + getLocaleString(value, language);
+
return (
- {text}
+ {/* Because of differences in browser implementations, is used to make the screen reader perform the same on different browsers in Edge v44 */}
+
+ {text}
);
diff --git a/packages/component/src/Utils/Timer.js b/packages/component/src/Utils/Timer.js
index c057b3e612..c7c864d46c 100644
--- a/packages/component/src/Utils/Timer.js
+++ b/packages/component/src/Utils/Timer.js
@@ -1,3 +1,5 @@
+/* eslint react/no-unsafe: off */
+
import PropTypes from 'prop-types';
import React from 'react';
@@ -8,7 +10,7 @@ export default class Timer extends React.Component {
this.schedule(at);
}
- componentWillReceiveProps({ at: nextAt }) {
+ UNSAFE_componentWillReceiveProps({ at: nextAt }) {
const { at } = this.props;
if (at !== nextAt) {
diff --git a/packages/playground/src/App.js b/packages/playground/src/App.js
index d01a58a2d6..0d9363c114 100644
--- a/packages/playground/src/App.js
+++ b/packages/playground/src/App.js
@@ -100,7 +100,8 @@ export default class extends React.Component {
faulty: false,
groupTimestamp: window.sessionStorage.getItem('PLAYGROUND_GROUP_TIMESTAMP'),
hideSendBox: false,
- language: window.sessionStorage.getItem('PLAYGROUND_LANGUAGE') || '',
+ language: window.sessionStorage.getItem('PLAYGROUND_LANGUAGE') || undefined,
+ richCardWrapTitle: false,
sendTimeout: window.sessionStorage.getItem('PLAYGROUND_SEND_TIMEOUT') || '',
sendTypingIndicator: true,
userAvatarInitials: 'WC',