1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-14 19:02:33 +03:00

Put back default strings on dialogs

But make them work by calling _t in render rather than
getDefaultProps().

Also sort out some 'Warning!' strings
This commit is contained in:
David Baker
2017-05-25 18:20:48 +01:00
parent 9112fc231a
commit 443ab1add7
30 changed files with 31 additions and 78 deletions

View File

@@ -378,7 +378,6 @@ module.exports = React.createClass({
Modal.createDialog(QuestionDialog, {
title: _t('Reject invitation'),
description: _t('Are you sure you want to reject the invitation?'),
button: "OK",
onFinished: (confirm) => {
if (confirm) {
// FIXME: controller shouldn't be loading a view :(
@@ -395,7 +394,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t('Failed to reject invitation'),
description: err.toString(),
button: _t("OK"),
});
});
}
@@ -895,7 +893,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t('Signed Out'),
description: _t('For security, this session has been signed out. Please sign in again.'),
button: _t("OK"),
});
dis.dispatch({
action: 'logout',

View File

@@ -531,7 +531,7 @@ module.exports = React.createClass({
if (!userHasUsedEncryption) {
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createDialog(QuestionDialog, {
title: _t("Warning") + "!",
title: _t("Warning!"),
hasCancelButton: false,
description: (
<div>
@@ -541,7 +541,6 @@ module.exports = React.createClass({
<p>{ _t("Encrypted messages will not be visible on clients that do not yet implement encryption") }.</p>
</div>
),
button: "OK",
});
}
if (localStorage) {
@@ -882,7 +881,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Failed to join room"),
description: msg,
button: _t("OK"),
});
}
}).done();
@@ -964,7 +962,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t('Failed to upload file'),
description: ((error && error.message) ? error.message : _t("Server may be unavailable, overloaded, or the file too big")),
button: _t("OK"),
});
});
},
@@ -1052,7 +1049,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Search failed"),
description: ((error && error.message) ? error.message : _t("Server may be unavailable, overloaded, or search timed out :(")),
button: _t("OK"),
});
}).finally(function() {
self.setState({
@@ -1180,7 +1176,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Failed to save settings"),
description: fails.map(function(result) { return result.reason; }).join("\n"),
button: _t("OK"),
});
// still editing room settings
}
@@ -1220,7 +1215,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Error"),
description: _t("Failed to forget room %(errCode)s", { errCode: errCode }),
button: _t("OK"),
});
});
},
@@ -1243,7 +1237,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Failed to reject invite"),
description: msg,
button: _t("OK"),
});
self.setState({

View File

@@ -914,7 +914,6 @@ var TimelinePanel = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Failed to load timeline position"),
description: message,
button: _t("OK"),
onFinished: onFinished,
});
};

View File

@@ -249,7 +249,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Can't load user settings"),
description: ((error && error.message) ? error.message : _t("Server may be unavailable or overloaded")),
button: _t("OK"),
});
});
},
@@ -292,7 +291,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Failed to set avatar"),
description: ((err && err.message) ? err.message : _t("Operation failed")),
button: _t("OK")
});
});
},
@@ -335,7 +333,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Error"),
description: errMsg,
button: _t("OK"),
});
},
@@ -344,7 +341,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Success"),
description: _t("Your password was successfully changed. You will not receive push notifications on other devices until you log back in to them") + ".",
button: _t("OK"),
});
},
@@ -372,7 +368,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Invalid Email Address"),
description: _t("This doesn't appear to be a valid email address"),
button: _t("OK"),
});
return;
}
@@ -392,7 +387,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Unable to add email address"),
description: ((err && err.message) ? err.message : _t("Operation failed")),
button: _t("OK"),
});
});
ReactDOM.findDOMNode(this.refs.add_email_input).blur();
@@ -418,7 +412,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Unable to remove contact information"),
description: ((err && err.message) ? err.message : _t("Operation failed")),
button: _t("OK"),
});
}).done();
}
@@ -460,7 +453,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Unable to verify email address"),
description: ((err && err.message) ? err.message : _t("Operation failed")),
button: _t("OK"),
});
}
});

View File

@@ -90,7 +90,7 @@ module.exports = React.createClass({
else {
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createDialog(QuestionDialog, {
title: _t('Warning'),
title: _t('Warning!'),
description:
<div>
{ _t(
@@ -157,7 +157,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: title,
description: body,
button: _t("OK"),
});
},

View File

@@ -307,7 +307,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: "Failed to invite",
description: ((err && err.message) ? err.message : "Operation failed"),
button: _t("OK"),
});
return null;
})
@@ -321,7 +320,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: "Failed to invite user",
description: ((err && err.message) ? err.message : "Operation failed"),
button: _t("OK"),
});
return null;
})
@@ -343,7 +341,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: "Failed to invite",
description: ((err && err.message) ? err.message : "Operation failed"),
button: _t("OK"),
});
return null;
})
@@ -403,7 +400,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: "Failed to invite the following users to the " + room.name + " room:",
description: errorList.join(", "),
button: _t("OK"),
});
}
return addrs;

View File

@@ -27,6 +27,7 @@ limitations under the License.
import React from 'react';
import sdk from '../../../index';
import { _t } from '../../../languageHandler';
export default React.createClass({
displayName: 'ErrorDialog',
@@ -44,6 +45,9 @@ export default React.createClass({
getDefaultProps: function() {
return {
focus: true,
title: null,
description: null,
button: null,
};
},
@@ -57,13 +61,13 @@ export default React.createClass({
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
return (
<BaseDialog className="mx_ErrorDialog" onFinished={this.props.onFinished}
title={this.props.title}>
title={this.props.title || _t('Error')}>
<div className="mx_Dialog_content">
{this.props.description}
{this.props.description || _t('An error has occurred.')}
</div>
<div className="mx_Dialog_buttons">
<button ref="button" className="mx_Dialog_primary" onClick={this.props.onFinished}>
{this.props.button}
{this.props.button || _t('OK')}
</button>
</div>
</BaseDialog>

View File

@@ -20,6 +20,7 @@ import Matrix from 'matrix-js-sdk';
import React from 'react';
import sdk from '../../../index';
import { _t } from '../../../languageHandler';
import AccessibleButton from '../elements/AccessibleButton';
@@ -99,7 +100,7 @@ export default React.createClass({
return (
<BaseDialog className="mx_InteractiveAuthDialog"
onFinished={this.props.onFinished}
title={this.state.authError ? 'Error' : this.props.title}
title={this.state.authError ? 'Error' : (this.props.title || _t('Authentication'))}
>
{content}
</BaseDialog>

View File

@@ -26,6 +26,7 @@ limitations under the License.
import React from 'react';
import dis from '../../../dispatcher';
import sdk from '../../../index';
import { _t } from '../../../languageHandler';
module.exports = React.createClass({
displayName: 'NeedToRegisterDialog',
@@ -52,10 +53,10 @@ module.exports = React.createClass({
return (
<BaseDialog className="mx_NeedToRegisterDialog"
onFinished={this.props.onFinished}
title={this.props.title}
title={this.props.title || _t('Registration required')}
>
<div className="mx_Dialog_content">
{this.props.description}
{this.props.description || _t('A registered account is required for this action')}
</div>
<div className="mx_Dialog_buttons">
<button className="mx_Dialog_primary" onClick={this.props.onFinished} autoFocus={true}>

View File

@@ -16,6 +16,7 @@ limitations under the License.
import React from 'react';
import sdk from '../../../index';
import { _t } from '../../../languageHandler';
export default React.createClass({
displayName: 'QuestionDialog',
@@ -63,7 +64,7 @@ export default React.createClass({
</div>
<div className="mx_Dialog_buttons">
<button className="mx_Dialog_primary" onClick={this.onOk} autoFocus={this.props.focus}>
{this.props.button}
{this.props.button || _t('OK')}
</button>
{this.props.extraButtons}
{cancelButton}

View File

@@ -100,7 +100,7 @@ module.exports = React.createClass({
if (this.refs.email.value == '') {
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createDialog(QuestionDialog, {
title: "Warning",
title: "Warning!",
description:
<div>
If you don't specify an email address, you won't be able to reset your password.<br/>

View File

@@ -157,7 +157,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t('Invalid alias format'),
description: _t('"%(alias)s" is not a valid format for an alias', { alias: alias }),
button: _t('OK'),
});
}
},
@@ -174,7 +173,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t('Invalid address format'),
description: _t('"%(alias)s" is not a valid format for an address', { alias: alias }),
button: _t('OK'),
});
}
},

View File

@@ -244,7 +244,6 @@ module.exports = WithMatrixClient(React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Failed to kick"),
description: ((err && err.message) ? err.message : "Operation failed"),
button: _t("OK"),
});
}
).finally(()=>{
@@ -287,7 +286,6 @@ module.exports = WithMatrixClient(React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Error"),
description: _t("Failed to ban user"),
button: _t("OK"),
});
}
).finally(()=>{
@@ -338,7 +336,6 @@ module.exports = WithMatrixClient(React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Error"),
description: _t("Failed to mute user"),
button: _t("OK"),
});
}
).finally(()=>{
@@ -388,7 +385,6 @@ module.exports = WithMatrixClient(React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Error"),
description: _t("Failed to toggle moderator status"),
button: _t("OK"),
});
}
}
@@ -410,7 +406,6 @@ module.exports = WithMatrixClient(React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Error"),
description: _t("Failed to change power level"),
button: _t("OK"),
});
}
).finally(()=>{
@@ -438,7 +433,7 @@ module.exports = WithMatrixClient(React.createClass({
if (parseInt(myPower) === parseInt(powerLevel)) {
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createDialog(QuestionDialog, {
title: _t("Warning"),
title: _t("Warning!"),
description:
<div>
{ _t("You will not be able to undo this change as you are promoting the user to have the same power level as yourself") }.<br/>

View File

@@ -127,7 +127,6 @@ export default class MessageComposer extends React.Component {
</ul>
</div>
),
button: _t("OK"),
onFinished: (shouldUpload) => {
if(shouldUpload) {
// MessageComposer shouldn't have to rely on its parent passing in a callback to upload a file

View File

@@ -507,7 +507,6 @@ export default class MessageComposerInput extends React.Component {
Modal.createDialog(ErrorDialog, {
title: _t("Server error"),
description: ((err && err.message) ? err.message : _t("Server unavailable, overloaded, or something else went wrong") + "."),
button: _t("OK"),
});
});
}
@@ -517,7 +516,6 @@ export default class MessageComposerInput extends React.Component {
Modal.createDialog(ErrorDialog, {
title: _t("Command error"),
description: cmd.error,
button: _t("OK"),
});
}
return true;

View File

@@ -297,7 +297,6 @@ export default React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Unknown command"),
description: _t("Usage") + ": /markdown on|off",
button: _t("OK"),
});
}
return;
@@ -318,7 +317,6 @@ export default React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Server error"),
description: ((err && err.message) ? err.message : _t("Server unavailable, overloaded, or something else went wrong") + "."),
button: _t("OK"),
});
});
}
@@ -328,7 +326,6 @@ export default React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Command error"),
description: cmd.error,
button: _t("OK"),
});
}
return;

View File

@@ -122,7 +122,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Error"),
description: _t("Failed to set avatar") + ".",
button: _t("OK"),
});
}).done();
},

View File

@@ -59,7 +59,6 @@ const BannedUser = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t('Error'),
description: _t('Failed to unban'),
button: _t("OK"),
});
}).done();
},
@@ -530,7 +529,6 @@ module.exports = React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t('Error'),
description: _t("Failed to forget room %(errCode)s", { errCode: errCode }),
button: _t("OK"),
});
});
},
@@ -540,7 +538,7 @@ module.exports = React.createClass({
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createDialog(QuestionDialog, {
title: _t('Warning') + '!',
title: _t('Warning!'),
description: (
<div>
<p>{ _t('End-to-end encryption is in beta and may not be reliable') }.</p>
@@ -550,7 +548,6 @@ module.exports = React.createClass({
<p>{ _t('Encrypted messages will not be visible on clients that do not yet implement encryption') }.</p>
</div>
),
button: "OK",
onFinished: confirm=>{
if (!confirm) {
this.refs.encrypt.checked = false;

View File

@@ -85,7 +85,6 @@ export default WithMatrixClient(React.createClass({
Modal.createDialog(ErrorDialog, {
title: _t("Error"),
description: msg,
button: _t("OK"),
});
}).finally(() => {
if (this._unmounted) return;

View File

@@ -70,7 +70,7 @@ module.exports = React.createClass({
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createDialog(QuestionDialog, {
title: _t("Warning"),
title: _t("Warning!"),
description:
<div>
{ _t(