This commit is contained in:
David Baker 2017-05-23 14:12:53 +01:00
parent 7d59742a22
commit 6b6fa59f3e
36 changed files with 7547 additions and 186 deletions

View file

@ -16,6 +16,7 @@ limitations under the License.
'use strict';
var React = require('react');
import _t from 'counterpart-riot';
var q = require("q");
var sdk = require('matrix-react-sdk');
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
@ -131,8 +132,8 @@ module.exports = React.createClass({
}, (error) => {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "Error saving email notification preferences",
description: "An error occurred whilst saving your email notification preferences.",
title: _t('Error saving email notification preferences'),
description: _t('An error occurred whilst saving your email notification preferences') + '.',
});
});
},
@ -175,9 +176,10 @@ module.exports = React.createClass({
var TextInputDialog = sdk.getComponent("dialogs.TextInputDialog");
Modal.createDialog(TextInputDialog, {
title: "Keywords",
description: "Enter keywords separated by a comma:",
title: _t('Keywords'),
description: _t('Enter keywords separated by a comma') + ':',
value: keywords,
button: _t('OK'),
onFinished: function onFinished(should_leave, newValue) {
if (should_leave && newValue !== keywords) {
@ -240,8 +242,8 @@ module.exports = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to change settings: " + error);
Modal.createDialog(ErrorDialog, {
title: "Failed to change settings",
description: ((error && error.message) ? error.message : "Operation failed"),
title: _t('Failed to change settings'),
description: ((error && error.message) ? error.message : _t('Operation failed')),
onFinished: self._refreshFromServer
});
});
@ -310,8 +312,8 @@ module.exports = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Can't update user notification settings: " + error);
Modal.createDialog(ErrorDialog, {
title: "Can't update user notification settings",
description: ((error && error.message) ? error.message : "Operation failed"),
title: _t('Can\'t update user notification settings'),
description: ((error && error.message) ? error.message : _t('Operation failed')),
onFinished: self._refreshFromServer
});
});
@ -352,8 +354,8 @@ module.exports = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to update keywords: " + error);
Modal.createDialog(ErrorDialog, {
title: "Failed to update keywords",
description: ((error && error.message) ? error.message : "Operation failed"),
title: _t('Failed to update keywords'),
description: ((error && error.message) ? error.message : _t('Operation failed')),
onFinished: self._refreshFromServer
});
}
@ -562,8 +564,8 @@ module.exports = React.createClass({
// Build the rules not managed by Vector UI
var otherRulesDescriptions = {
'.m.rule.message': "Notify for all other messages/rooms",
'.m.rule.fallback': "Notify me for anything else"
'.m.rule.message': _t('Notify for all other messages/rooms'),
'.m.rule.fallback': _t('Notify me for anything else'),
};
for (var i in defaultRules.others) {
@ -698,7 +700,7 @@ module.exports = React.createClass({
</div>
<div className="mx_UserNotifSettings_labelCell">
<label htmlFor="enableNotifications">
Enable notifications for this account
{ _t('Enable notifications for this account') }
</label>
</div>
</div>
@ -713,7 +715,7 @@ module.exports = React.createClass({
{masterPushRuleDiv}
<div className="mx_UserSettings_notifTable">
All notifications are currently disabled for all targets.
{ _t('All notifications are currently disabled for all targets') }.
</div>
</div>
);
@ -723,13 +725,13 @@ module.exports = React.createClass({
let emailNotificationsRow;
if (emailThreepids.length === 0) {
emailNotificationsRow = <div>
Add an email address above to configure email notifications
{ _t('Add an email address above to configure email notifications') }
</div>;
} else {
// This only supports the first email address in your profile for now
emailNotificationsRow = this.emailNotificationsRow(
emailThreepids[0].address,
"Enable email notifications ("+emailThreepids[0].address+")"
_t('Enable email notifications') + ' (' + emailThreepids[0].address + ')'
);
}
@ -737,7 +739,7 @@ module.exports = React.createClass({
var externalRules = [];
for (var i in this.state.externalPushRules) {
var rule = this.state.externalPushRules[i];
externalRules.push(<li>{ rule.description }</li>);
externalRules.push(<li>{ _t(rule.description) }</li>);
}
// Show keywords not displayed by the vector UI as a single external push rule
@ -748,12 +750,12 @@ module.exports = React.createClass({
}
if (externalKeyWords.length) {
externalKeyWords = externalKeyWords.join(", ");
externalRules.push(<li>Notifications on the following keywords follow rules which cant be displayed here: { externalKeyWords }</li>);
externalRules.push(<li>{ _t('Notifications on the following keywords follow rules which cant be displayed here:') } { externalKeyWords }</li>);
}
var devicesSection;
if (this.state.pushers === undefined) {
devicesSection = <div className="error">Unable to fetch notification target list</div>
devicesSection = <div className="error">{ _t('Unable to fetch notification target list') }</div>
} else if (this.state.pushers.length == 0) {
devicesSection = null;
} else {
@ -774,7 +776,7 @@ module.exports = React.createClass({
}
if (devicesSection) {
devicesSection = (<div>
<h3>Notification targets</h3>
<h3>{ _t('Notification targets') }</h3>
{ devicesSection }
</div>);
}
@ -783,9 +785,9 @@ module.exports = React.createClass({
if (externalRules.length) {
advancedSettings = (
<div>
<h3>Advanced notifications settings</h3>
There are advanced notifications which are not shown here.<br/>
You might have configured them in a client other than Riot. You cannot tune them in Riot but they still apply.
<h3>{ _t('Advanced notifications settings') }</h3>
{ _t('There are advanced notifications which are not shown here') }.<br/>
{ _t('You might have configured them in a client other than Riot. You cannot tune them in Riot but they still apply') }.
<ul>
{ externalRules }
</ul>
@ -812,7 +814,7 @@ module.exports = React.createClass({
</div>
<div className="mx_UserNotifSettings_labelCell">
<label htmlFor="enableDesktopNotifications">
Enable desktop notifications
{ _t('Enable desktop notifications') }
</label>
</div>
</div>
@ -830,7 +832,7 @@ module.exports = React.createClass({
</div>
<div className="mx_UserNotifSettings_labelCell">
<label htmlFor="enableDesktopAudioNotifications">
Enable audible notifications in web client
{ _t('Enable audible notifications in web client') }
</label>
</div>
</div>
@ -842,9 +844,9 @@ module.exports = React.createClass({
<thead>
<tr>
<th width="55%"></th>
<th width="15%">Off</th>
<th width="15%">On</th>
<th width="15%">Noisy</th>
<th width="15%">{ _t('Off') }</th>
<th width="15%">{ _t('On') }</th>
<th width="15%">{ _t('Noisy') }</th>
</tr>
</thead>
<tbody>