Skip to content

Commit

Permalink
Merge pull request element-hq#17 from coletivoEITA/translations
Browse files Browse the repository at this point in the history
Added more strings to translate
  • Loading branch information
MTRNord authored May 4, 2017
2 parents 20f79de + 748b705 commit 6d44824
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 57 deletions.
6 changes: 3 additions & 3 deletions src/components/structures/RoomDirectory.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ module.exports = React.createClass({

var desc;
if (alias) {
desc = counterpart.translate("Delete the room alias") + " " + alias + " " + counterpart.translate("and remove") + " " + name + " " + counterpart.translate("from the directory") + "?";
desc = counterpart.translate("Delete the room alias %(alias)s and remove %(name)s from the directory?", {alias: alias, name: name});
} else {
desc = counterpart.translate("Remove") + " " + name + " " + counterpart.translate("from the directory") + "?";
desc = counterpart.translate("Remove %(name)s from the directory?", {name: name});
}

Modal.createDialog(QuestionDialog, {
Expand All @@ -197,7 +197,7 @@ module.exports = React.createClass({

var Loader = sdk.getComponent("elements.Spinner");
var modal = Modal.createDialog(Loader);
var step = counterpart.translate("remove") + " " + name + " " + counterpart.translate("from the directory") + ".";
var step = counterpart.translate("remove %(name)s from the directory", {name: name}) + ".";

MatrixClientPeg.get().setRoomDirectoryVisibility(room.room_id, 'private').then(() => {
if (!alias) return;
Expand Down
4 changes: 2 additions & 2 deletions src/components/structures/RoomSubList.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ var RoomSubList = React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to add tag " + self.props.tagName + " to room" + err);
Modal.createDialog(ErrorDialog, {
title: "Failed to add tag " + self.props.tagName + " to room",
description: ((err && err.message) ? err.message : "Operation failed"),
title: counterpart.translate("Failed to add tag %(tagName)s to room", {tagName: self.props.tagName}),
description: ((err && err.message) ? err.message : counterpart.translate("Operation failed")),
});
});
break;
Expand Down
23 changes: 12 additions & 11 deletions src/components/views/context_menus/MessageContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var React = require('react');
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
var dis = require('matrix-react-sdk/lib/dispatcher');
var sdk = require('matrix-react-sdk');
import counterpart from 'counterpart';
var Modal = require('matrix-react-sdk/lib/Modal');
var Resend = require("matrix-react-sdk/lib/Resend");
import * as UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore';
Expand Down Expand Up @@ -74,8 +75,8 @@ module.exports = React.createClass({
// display error message stating you couldn't delete this.
var code = e.errcode || e.statusCode;
Modal.createDialog(ErrorDialog, {
title: "Error",
description: "You cannot delete this message. (" + code + ")"
title: counterpart.translate("Error"),
description: counterpart.translate("You cannot delete this message. (%(code)s)", {code: code})
});
}).done();
},
Expand Down Expand Up @@ -121,37 +122,37 @@ module.exports = React.createClass({
if (eventStatus === 'not_sent') {
resendButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onResendClick}>
Resend
{ counterpart.translate("Resend") }
</div>
);
}

if (!eventStatus && !this.props.mxEvent.isRedacted()) { // sent and not redacted
redactButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onRedactClick}>
Redact
{ counterpart.translate("Redact") }
</div>
);
}

if (eventStatus === "queued" || eventStatus === "not_sent") {
cancelButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onCancelSendClick}>
Cancel Sending
{ counterpart.translate("Cancel Sending") }
</div>
);
}

viewSourceButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onViewSourceClick}>
View Source
{ counterpart.translate("View Source") }
</div>
);

if (this.props.mxEvent.getType() !== this.props.mxEvent.getWireType()) {
viewClearSourceButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onViewClearSourceClick}>
View Decrypted Source
{ counterpart.translate("View Decrypted Source") }
</div>
);
}
Expand All @@ -160,7 +161,7 @@ module.exports = React.createClass({
if (this.props.eventTileOps.isWidgetHidden()) {
unhidePreviewButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onUnhidePreviewClick}>
Unhide Preview
{ counterpart.translate("Unhide Preview") }
</div>
)
}
Expand All @@ -170,13 +171,13 @@ module.exports = React.createClass({
permalinkButton = (
<div className="mx_MessageContextMenu_field">
<a href={ "https://matrix.to/#/" + this.props.mxEvent.getRoomId() +"/"+ this.props.mxEvent.getId() }
target="_blank" rel="noopener" onClick={ this.closeMenu }>Permalink</a>
target="_blank" rel="noopener" onClick={ this.closeMenu }>{ counterpart.translate("Permalink") }</a>
</div>
);

const quoteButton = (
<div className="mx_MessageContextMenu_field" onClick={this.onQuoteClick}>
Quote
{ counterpart.translate("Quote") }
</div>
);

Expand All @@ -185,7 +186,7 @@ module.exports = React.createClass({
externalURLButton = (
<div className="mx_MessageContextMenu_field">
<a href={ this.props.mxEvent.event.content.external_url }
rel="noopener" target="_blank" onClick={ this.closeMenu }>Source URL</a>
rel="noopener" target="_blank" onClick={ this.closeMenu }>{ counterpart.translate("Source URL") }</a>
</div>
);
}
Expand Down
30 changes: 15 additions & 15 deletions src/components/views/context_menus/RoomTileContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ module.exports = React.createClass({
}).fail(function(err) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "Failed to remove tag " + tagNameOff + " from room",
description: ((err && err.message) ? err.message : "Operation failed"),
title: counterpart.translate("Failed to remove tag %(tagName)s from room", {tagName: tagNameOff}),
description: ((err && err.message) ? err.message : counterpart.translate("Operation failed")),
});
});
}
Expand All @@ -88,8 +88,8 @@ module.exports = React.createClass({
}).fail(function(err) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "Failed to add tag " + tagNameOn + " to room",
description: ((err && err.message) ? err.message : "Operation failed"),
title: counterpart.translate("Failed to remove tag %(tagName)s from room", {tagName: tagNameOn}),
description: ((err && err.message) ? err.message : counterpart.translate("Operation failed")),
});
});
}
Expand Down Expand Up @@ -149,8 +149,8 @@ module.exports = React.createClass({
}, (err) => {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "Failed to set Direct Message status of room",
description: ((err && err.message) ? err.message : "Operation failed"),
title: counterpart.translate("Failed to set Direct Message status of room"),
description: ((err && err.message) ? err.message : counterpart.translate("Operation failed")),
});
});
},
Expand Down Expand Up @@ -188,8 +188,8 @@ module.exports = React.createClass({
var errCode = err.errcode || "unknown error code";
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: `Failed to forget room (${errCode})`,
description: ((err && err.message) ? err.message : "Operation failed"),
title: counterpart.translate("Failed to forget room %(errCode)s", {errCode: errCode}),
description: ((err && err.message) ? err.message : counterpart.translate("Operation failed")),
});
});

Expand Down Expand Up @@ -275,22 +275,22 @@ module.exports = React.createClass({
<div className={ alertMeClasses } onClick={this._onClickAlertMe} >
<img className="mx_RoomTileContextMenu_notif_activeIcon" src="img/notif-active.svg" width="12" height="12" />
<img className="mx_RoomTileContextMenu_notif_icon mx_filterFlipColor" src="img/icon-context-mute-off-copy.svg" width="16" height="12" />
All messages (loud)
{ counterpart.translate("All messages (loud)") }
</div>
<div className={ allNotifsClasses } onClick={this._onClickAllNotifs} >
<img className="mx_RoomTileContextMenu_notif_activeIcon" src="img/notif-active.svg" width="12" height="12" />
<img className="mx_RoomTileContextMenu_notif_icon mx_filterFlipColor" src="img/icon-context-mute-off.svg" width="16" height="12" />
All messages
{ counterpart.translate("All messages") }
</div>
<div className={ mentionsClasses } onClick={this._onClickMentions} >
<img className="mx_RoomTileContextMenu_notif_activeIcon" src="img/notif-active.svg" width="12" height="12" />
<img className="mx_RoomTileContextMenu_notif_icon mx_filterFlipColor" src="img/icon-context-mute-mentions.svg" width="16" height="12" />
Mentions only
{ counterpart.translate("Mentions only") }
</div>
<div className={ muteNotifsClasses } onClick={this._onClickMute} >
<img className="mx_RoomTileContextMenu_notif_activeIcon" src="img/notif-active.svg" width="12" height="12" />
<img className="mx_RoomTileContextMenu_notif_icon mx_filterFlipColor" src="img/icon-context-mute.svg" width="16" height="12" />
Mute
{ counterpart.translate("Mute") }
</div>
</div>
);
Expand All @@ -307,16 +307,16 @@ module.exports = React.createClass({
switch (membership) {
case "join":
leaveClickHandler = this._onClickLeave;
leaveText = "Leave";
leaveText = counterpart.translate("Leave");
break;
case "leave":
case "ban":
leaveClickHandler = this._onClickForget;
leaveText = "Forget";
leaveText = counterpart.translate("Forget");
break;
case "invite":
leaveClickHandler = this._onClickReject;
leaveText = "Reject";
leaveText = counterpart.translate("Reject");
break;
}

Expand Down
13 changes: 7 additions & 6 deletions src/components/views/elements/ImageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var filesize = require('filesize');
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
const Modal = require('matrix-react-sdk/lib/Modal');
const sdk = require('matrix-react-sdk');
import counterpart from 'counterpart';

module.exports = React.createClass({
displayName: 'ImageView',
Expand Down Expand Up @@ -76,8 +77,8 @@ module.exports = React.createClass({
// display error message stating you couldn't delete this.
var code = e.errcode || e.statusCode;
Modal.createDialog(ErrorDialog, {
title: "Error",
description: "You cannot delete this image. (" + code + ")"
title: counterpart.translate("Error"),
description: counterpart.translate("You cannot delete this image. (%(code)s)", {code: code})
});
}).done();
}
Expand Down Expand Up @@ -150,14 +151,14 @@ module.exports = React.createClass({
var eventMeta;
if(showEventMeta) {
eventMeta = (<div className="mx_ImageView_metadata">
Uploaded on { DateUtils.formatDate(new Date(this.props.mxEvent.getTs())) } by { this.props.mxEvent.getSender() }
{ counterpart.translate("Uploaded on %(date)s by %(user)s", {date: DateUtils.formatDate(new Date(this.props.mxEvent.getTs())), user: this.props.mxEvent.getSender()}) }
</div>);
}

var eventRedact;
if(showEventMeta) {
eventRedact = (<div className="mx_ImageView_button" onClick={this.onRedactClick}>
Redact
{ counterpart.translate("Redact") }
</div>);
}

Expand All @@ -169,7 +170,7 @@ module.exports = React.createClass({
<img src={this.props.src} style={style}/>
<div className="mx_ImageView_labelWrapper">
<div className="mx_ImageView_label">
<AccessibleButton className="mx_ImageView_cancel" onClick={ this.props.onFinished }><img src="img/cancel-white.svg" width="18" height="18" alt="Close"/></AccessibleButton>
<AccessibleButton className="mx_ImageView_cancel" onClick={ this.props.onFinished }><img src="img/cancel-white.svg" width="18" height="18" alt={ counterpart.translate("Close") }/></AccessibleButton>
<div className="mx_ImageView_shim">
</div>
<div className="mx_ImageView_name">
Expand All @@ -178,7 +179,7 @@ module.exports = React.createClass({
{ eventMeta }
<a className="mx_ImageView_link" href={ this.props.src } download={ this.props.name } target="_blank" rel="noopener">
<div className="mx_ImageView_download">
Download this file<br/>
{ counterpart.translate("Download this file") }<br/>
<span className="mx_ImageView_size">{ size_res }</span>
</div>
</a>
Expand Down
13 changes: 7 additions & 6 deletions src/components/views/rooms/DNDRoomTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {DropTarget} from 'react-dnd';
import dis from 'matrix-react-sdk/lib/dispatcher';
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
import sdk from 'matrix-react-sdk';
import counterpart from 'counterpart';
import RoomTile from 'matrix-react-sdk/lib/components/views/rooms/RoomTile';
import * as Rooms from 'matrix-react-sdk/lib/Rooms';
import Modal from 'matrix-react-sdk/lib/Modal';
Expand Down Expand Up @@ -90,8 +91,8 @@ var roomTileSource = {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to set direct chat tag " + err);
Modal.createDialog(ErrorDialog, {
title: "Failed to set direct chat tag",
description: ((err && err.message) ? err.message : "Operation failed"),
title: counterpart.translate("Failed to set direct chat tag"),
description: ((err && err.message) ? err.message : counterpart.translate("Operation failed")),
});
});
return;
Expand All @@ -115,8 +116,8 @@ var roomTileSource = {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to remove tag " + prevTag + " from room: " + err);
Modal.createDialog(ErrorDialog, {
title: "Failed to remove tag " + prevTag + " from room",
description: ((err && err.message) ? err.message : "Operation failed"),
title: counterpart.translate("Failed to remove tag %(tagName)s from room", {tagName: prevTag}),
description: ((err && err.message) ? err.message : counterpart.translate("Operation failed")),
});
});
}
Expand All @@ -137,8 +138,8 @@ var roomTileSource = {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Failed to add tag " + newTag + " to room: " + err);
Modal.createDialog(ErrorDialog, {
title: "Failed to add tag " + newTag + " to room",
description: ((err && err.message) ? err.message : "Operation failed"),
title: counterpart.translate("Failed to add tag %(tagName)s to room", {tagName: newTag}),
description: ((err && err.message) ? err.message : counterpart.translate("Operation failed")),
});
});
}
Expand Down
Loading

0 comments on commit 6d44824

Please sign in to comment.