Singularise unsent message prompt, if applicable

Adds vector-im/riot-web#1217

Signed-off-by: Travis Ralston <travpc@gmail.com>
pull/21833/head
Travis Ralston 2017-10-11 20:08:09 -06:00
parent 757e42ddca
commit ba386e3417
3 changed files with 11 additions and 2 deletions

View File

@ -39,6 +39,9 @@ module.exports = React.createClass({
// string to display when there are messages in the room which had errors on send
unsentMessageError: React.PropTypes.string,
// the number of messages not sent.
numUnsentMessages: React.PropTypes.number,
// this is true if we are fully scrolled-down, and are looking at
// the end of the live timeline.
atEndOfLiveTimeline: React.PropTypes.bool,
@ -252,6 +255,8 @@ module.exports = React.createClass({
}
if (this.props.unsentMessageError) {
let resendStr = "<a>Resend message</a> or <a>cancel message</a> now.";
if (this.props.numUnsentMessages > 1) resendStr = "<a>Resend all</a> or <a>cancel all</a> now. You can also select individual messages to resend or cancel.";
return (
<div className="mx_RoomStatusBar_connectionLostBar">
<img src="img/warning.svg" width="24" height="23" title="/!\ " alt="/!\ " />
@ -259,7 +264,7 @@ module.exports = React.createClass({
{ this.props.unsentMessageError }
</div>
<div className="mx_RoomStatusBar_connectionLostBar_desc">
{ _tJsx("<a>Resend all</a> or <a>cancel all</a> now. You can also select individual messages to resend or cancel.",
{ _tJsx(resendStr,
[/<a>(.*?)<\/a>/, /<a>(.*?)<\/a>/],
[
(sub) => <a className="mx_RoomStatusBar_resend_link" key="resend" onClick={this.props.onResendAllClick}>{ sub }</a>,

View File

@ -748,7 +748,8 @@ module.exports = React.createClass({
for (const event of unsentMessages) {
if (!event.error || event.error.name !== "UnknownDeviceError") {
return _t("Some of your messages have not been sent.");
if (unsentMessages.length > 1) return _t("Some of your messages have not been sent.");
return _t("Your message was not sent.");
}
}
return _t("Message not sent due to unknown devices being present");
@ -1570,6 +1571,7 @@ module.exports = React.createClass({
isStatusAreaExpanded = this.state.statusBarVisible;
statusBar = <RoomStatusBar
room={this.state.room}
numUnsentMessages={this._getUnsentMessages().length}
numUnreadMessages={this.state.numUnreadMessages}
unsentMessageError={this.state.unsentMessageError}
atEndOfLiveTimeline={this.state.atEndOfLiveTimeline}

View File

@ -416,6 +416,7 @@
"since they joined": "since they joined",
"since they were invited": "since they were invited",
"Some of your messages have not been sent.": "Some of your messages have not been sent.",
"Your message was not sent.": "Your message was not sent.",
"Someone": "Someone",
"Sorry, this homeserver is using a login which is not recognised ": "Sorry, this homeserver is using a login which is not recognised ",
"Start a chat": "Start a chat",
@ -612,6 +613,7 @@
"Connectivity to the server has been lost.": "Connectivity to the server has been lost.",
"Sent messages will be stored until your connection has returned.": "Sent messages will be stored until your connection has returned.",
"<a>Resend all</a> or <a>cancel all</a> now. You can also select individual messages to resend or cancel.": "<a>Resend all</a> or <a>cancel all</a> now. You can also select individual messages to resend or cancel.",
"<a>Resend message</a> or <a>cancel message</a> now.": "<a>Resend message</a> or <a>cancel message</a> now.",
"(~%(count)s results)|one": "(~%(count)s result)",
"(~%(count)s results)|other": "(~%(count)s results)",
"Cancel": "Cancel",