Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-08-26 18:48:24 +01:00
parent 78aa0a59de
commit a437f23e9d
No known key found for this signature in database
GPG Key ID: 3F879DA5AD802A5E
2 changed files with 27 additions and 16 deletions

View File

@ -16,6 +16,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import sdk from 'matrix-react-sdk'; import sdk from 'matrix-react-sdk';
import { _t } from 'matrix-react-sdk/lib/languageHandler';
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
class SendCustomEvent extends React.Component { class SendCustomEvent extends React.Component {
@ -44,8 +45,8 @@ class SendCustomEvent extends React.Component {
_buttons() { _buttons() {
return <div className="mx_Dialog_buttons"> return <div className="mx_Dialog_buttons">
<button onClick={this.onBack}>Back</button> <button onClick={this.onBack}>{ _t('Back') }</button>
{!this.state.message && <button onClick={this._send}>Send</button>} {!this.state.message && <button onClick={this._send}>{ _t('Send') }</button>}
</div>; </div>;
} }
@ -58,9 +59,9 @@ class SendCustomEvent extends React.Component {
try { try {
const content = JSON.parse(this.refs.evContent.value); const content = JSON.parse(this.refs.evContent.value);
await this.send(content); await this.send(content);
message = 'Event sent!'; message = _t('Event sent!');
} catch (e) { } catch (e) {
message = 'Failed to send custom event.' + ` (${e.toString()})`; message = `${_t('Failed to send custom event.')} (${e.toString()})`;
} }
this.setState({ message }); this.setState({ message });
} }
@ -78,14 +79,14 @@ class SendCustomEvent extends React.Component {
return <div> return <div>
<div className="mx_Dialog_content"> <div className="mx_Dialog_content">
<div className="mx_TextInputDialog_label"> <div className="mx_TextInputDialog_label">
<label htmlFor="eventType"> Event Type </label> <label htmlFor="eventType"> { _t('Event Type') } </label>
</div> </div>
<div> <div>
<input id="eventType" ref="eventType" className="mx_TextInputDialog_input" size="64" /> <input id="eventType" ref="eventType" className="mx_TextInputDialog_input" size="64" />
</div> </div>
<div className="mx_TextInputDialog_label"> <div className="mx_TextInputDialog_label">
<label htmlFor="evContent"> Event Content </label> <label htmlFor="evContent"> { _t('Event Content') } </label>
</div> </div>
<div> <div>
<textarea id="evContent" ref="evContent" className="mx_TextInputDialog_input" defaultValue={"{\n\n}"} cols="63" rows="5" /> <textarea id="evContent" ref="evContent" className="mx_TextInputDialog_input" defaultValue={"{\n\n}"} cols="63" rows="5" />
@ -115,21 +116,21 @@ class SendCustomStateEvent extends SendCustomEvent {
return <div> return <div>
<div className="mx_Dialog_content"> <div className="mx_Dialog_content">
<div className="mx_TextInputDialog_label"> <div className="mx_TextInputDialog_label">
<label htmlFor="stateKey"> State Key </label> <label htmlFor="stateKey"> { _t('State Key') } </label>
</div> </div>
<div> <div>
<input id="stateKey" ref="stateKey" className="mx_TextInputDialog_input" size="64" /> <input id="stateKey" ref="stateKey" className="mx_TextInputDialog_input" size="64" />
</div> </div>
<div className="mx_TextInputDialog_label"> <div className="mx_TextInputDialog_label">
<label htmlFor="eventType"> Event Type </label> <label htmlFor="eventType"> { _t('Event Type') } </label>
</div> </div>
<div> <div>
<input id="eventType" ref="eventType" className="mx_TextInputDialog_input" size="64" /> <input id="eventType" ref="eventType" className="mx_TextInputDialog_input" size="64" />
</div> </div>
<div className="mx_TextInputDialog_label"> <div className="mx_TextInputDialog_label">
<label htmlFor="evContent"> Event Content </label> <label htmlFor="evContent"> { _t('Event Content') } </label>
</div> </div>
<div> <div>
<textarea id="evContent" ref="evContent" className="mx_TextInputDialog_input" defaultValue={"{\n\n}"} cols="63" rows="5" /> <textarea id="evContent" ref="evContent" className="mx_TextInputDialog_input" defaultValue={"{\n\n}"} cols="63" rows="5" />
@ -191,7 +192,7 @@ class RoomStateExplorer extends React.Component {
<pre>{JSON.stringify(this.state.event, null, 2)}</pre> <pre>{JSON.stringify(this.state.event, null, 2)}</pre>
</div> </div>
<div className="mx_Dialog_buttons"> <div className="mx_Dialog_buttons">
<button onClick={this.onBack}>Back</button> <button onClick={this.onBack}>{ _t('Back') }</button>
</div> </div>
</div>; </div>;
} }
@ -226,7 +227,7 @@ class RoomStateExplorer extends React.Component {
{rows} {rows}
</div> </div>
<div className="mx_Dialog_buttons"> <div className="mx_Dialog_buttons">
<button onClick={this.onBack}>Back</button> <button onClick={this.onBack}>{ _t('Back') }</button>
</div> </div>
</div>; </div>;
} }
@ -274,18 +275,18 @@ export default class DevtoolsDialog extends React.Component {
} else { } else {
body = <div> body = <div>
<div className="mx_Dialog_content"> <div className="mx_Dialog_content">
<button onClick={this._setMode(SendCustomEvent)}>Send Custom Event</button> <button onClick={this._setMode(SendCustomEvent)}>{ _t('Send Custom Event') }</button>
<button onClick={this._setMode(SendCustomStateEvent)}>Send Custom State Event</button> <button onClick={this._setMode(SendCustomStateEvent)}>{ _t('Send Custom State Event') }</button>
<button onClick={this._setMode(RoomStateExplorer)}>Explore Room State</button> <button onClick={this._setMode(RoomStateExplorer)}>{ _t('Explore Room State') }</button>
</div> </div>
<div className="mx_Dialog_buttons"> <div className="mx_Dialog_buttons">
<button onClick={this.onCancel}>Cancel</button> <button onClick={this.onCancel}>{ _t('Cancel') }</button>
</div> </div>
</div>; </div>;
} }
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
return <BaseDialog className="mx_QuestionDialog" onFinished={this.props.onFinished} title="Developer Tools"> return <BaseDialog className="mx_QuestionDialog" onFinished={this.props.onFinished} title={_t('Developer Tools')}>
<div>Room ID: {this.props.roomId}</div> <div>Room ID: {this.props.roomId}</div>
{ body } { body }
</BaseDialog>; </BaseDialog>;

View File

@ -9,6 +9,7 @@
"All Rooms": "All Rooms", "All Rooms": "All Rooms",
"All notifications are currently disabled for all targets.": "All notifications are currently disabled for all targets.", "All notifications are currently disabled for all targets.": "All notifications are currently disabled for all targets.",
"An error occurred whilst saving your email notification preferences.": "An error occurred whilst saving your email notification preferences.", "An error occurred whilst saving your email notification preferences.": "An error occurred whilst saving your email notification preferences.",
"Back": "Back",
"Call invitation": "Call invitation", "Call invitation": "Call invitation",
"Cancel": "Cancel", "Cancel": "Cancel",
"Cancel Sending": "Cancel Sending", "Cancel Sending": "Cancel Sending",
@ -25,6 +26,7 @@
"delete the alias.": "delete the alias.", "delete the alias.": "delete the alias.",
"Delete the room alias %(alias)s and remove %(name)s from the directory?": "Delete the room alias %(alias)s and remove %(name)s from the directory?", "Delete the room alias %(alias)s and remove %(name)s from the directory?": "Delete the room alias %(alias)s and remove %(name)s from the directory?",
"Describe your problem here.": "Describe your problem here.", "Describe your problem here.": "Describe your problem here.",
"Developer Tools": "Developer Tools",
"Direct Chat": "Direct Chat", "Direct Chat": "Direct Chat",
"Directory": "Directory", "Directory": "Directory",
"Dismiss": "Dismiss", "Dismiss": "Dismiss",
@ -49,6 +51,7 @@
"Failed to get public room list": "Failed to get public room list", "Failed to get public room list": "Failed to get public room list",
"Failed to join the room": "Failed to join the room", "Failed to join the room": "Failed to join the room",
"Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room", "Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room",
"Failed to send custom event.": "Failed to send custom event.",
"Failed to send report: ": "Failed to send report: ", "Failed to send report: ": "Failed to send report: ",
"Failed to set direct chat tag": "Failed to set direct chat tag", "Failed to set direct chat tag": "Failed to set direct chat tag",
"Failed to set Direct Message status of room": "Failed to set Direct Message status of room", "Failed to set Direct Message status of room": "Failed to set Direct Message status of room",
@ -116,6 +119,9 @@
"Search for a room": "Search for a room", "Search for a room": "Search for a room",
"Send": "Send", "Send": "Send",
"Send logs": "Send logs", "Send logs": "Send logs",
"Send Custom Event": "Send Custom Event",
"Send Custom State Event": "Send Custom State Event",
"Explore Room State": "Explore Room State",
"Settings": "Settings", "Settings": "Settings",
"Source URL": "Source URL", "Source URL": "Source URL",
"Sorry, your browser is <b>not</b> able to run Riot.": "Sorry, your browser is <b>not</b> able to run Riot.", "Sorry, your browser is <b>not</b> able to run Riot.": "Sorry, your browser is <b>not</b> able to run Riot.",
@ -162,6 +168,10 @@
"Warning": "Warning", "Warning": "Warning",
"Checking for an update...": "Checking for an update...", "Checking for an update...": "Checking for an update...",
"Error encountered (%(errorDetail)s).": "Error encountered (%(errorDetail)s).", "Error encountered (%(errorDetail)s).": "Error encountered (%(errorDetail)s).",
"Event sent!": "Event sent!",
"Event Type": "Event Type",
"Event Content": "Event Content",
"State Key": "State Key",
"No update available.": "No update available.", "No update available.": "No update available.",
"Downloading update...": "Downloading update...", "Downloading update...": "Downloading update...",
"You need to be using HTTPS to place a screen-sharing call.": "You need to be using HTTPS to place a screen-sharing call.", "You need to be using HTTPS to place a screen-sharing call.": "You need to be using HTTPS to place a screen-sharing call.",