Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate src/notifications #4087

Merged
merged 3 commits into from May 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 25 additions & 10 deletions src/components/structures/CompatibilityPage.js
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
'use strict';

var React = require('react');
import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler';

module.exports = React.createClass({
displayName: 'CompatibilityPage',
Expand All @@ -39,23 +40,37 @@ module.exports = React.createClass({
return (
<div className="mx_CompatibilityPage">
<div className="mx_CompatibilityPage_box">
<p>Sorry, your browser is <b>not</b> able to run Riot.</p>
<p>{ _tJsx("Sorry, your browser is <b>not</b> able to run Riot.", /<b>(.*?)<\/b>/, (sub) => <b>{sub}</b>) } </p>
<p>
Riot uses many advanced browser features, some of which are not
available or experimental in your current browser.
{ _t("Riot uses many advanced browser features, some of which are not available or experimental in your current browser.") }
</p>
<p>
Please install <a href="https://www.google.com/chrome">Chrome</a> or <a href="https://getfirefox.com">Firefox</a> for
the best experience. <a href="http://apple.com/safari">Safari</a> and <a href="http://opera.com">Opera</a> work too.
{ _tJsx('Please install <a href="https://www.google.com/chrome">Chrome</a> or <a href="https://getfirefox.com">Firefox</a> for the best experience.',
[
/<a href="https:\/\/www.google.com\/chrome">(.*?)<\/a>/,
/<a href="https:\/\/getfirefox.com">(.*?)<\/a>/,
],
[
(sub) => <a href="https://www.google.com/chrome">{sub}</a>,
(sub) => <a href="https://getfirefox.com">{sub}</a>,
]
)}
{ _tJsx('<a href="http://apple.com/safari">Safari</a> and <a href="http://opera.com">Opera</a> work too.',
[
/<a href="http:\/\/apple\.com\/safari">(.*?)<\/a>/,
/<a href="http:\/\/opera\.com">(.*?)<\/a>/,
],
[
(sub) => <a href="http://apple.com/safari">{sub}</a>,
(sub) => <a href="http://opera.com">{sub}</a>,
]
)}
</p>
<p>
With your current browser, the look and feel of the application may
be completely incorrect, and some or all features may not function.
If you want to try it anyway you can continue, but you are on your own
in terms of any issues you may encounter!
{ _t("With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!") }
</p>
<button onClick={this.onAccept}>
I understand the risks and wish to continue
{ _t("I understand the risks and wish to continue") }
</button>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/structures/RightPanel.js
Expand Up @@ -93,7 +93,7 @@ module.exports = React.createClass({
var NeedToRegisterDialog = sdk.getComponent("dialogs.NeedToRegisterDialog");
Modal.createDialog(NeedToRegisterDialog, {
title: _t('Please Register'),
description: _t('Guest users can\'t invite users. Please register to invite') + '.'
description: _t('Guest users can\'t invite users. Please register to invite.')
});
return;
}
Expand Down Expand Up @@ -218,7 +218,7 @@ module.exports = React.createClass({
<TintableSvg src="img/icons-notifications.svg" width="25" height="25"/>
{ notificationsHighlight }
</AccessibleButton>
<div className="mx_RightPanel_headerButton mx_RightPanel_collapsebutton" title="Hide panel" onClick={ this.onCollapseClick }>
<div className="mx_RightPanel_headerButton mx_RightPanel_collapsebutton" title={ _t("Hide panel") } onClick={ this.onCollapseClick }>
<TintableSvg src="img/minimise.svg" width="10" height="16"/>
</div>
</div>;
Expand Down
6 changes: 3 additions & 3 deletions src/components/structures/RoomDirectory.js
Expand Up @@ -213,11 +213,11 @@ module.exports = React.createClass({

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

MatrixClientPeg.get().setRoomDirectoryVisibility(room.room_id, 'private').then(() => {
if (!alias) return;
step = _t('delete the alias') + '.';
step = _t('delete the alias.');
return MatrixClientPeg.get().deleteAlias(alias);
}).done(() => {
modal.close();
Expand Down Expand Up @@ -356,7 +356,7 @@ module.exports = React.createClass({
var NeedToRegisterDialog = sdk.getComponent("dialogs.NeedToRegisterDialog");
Modal.createDialog(NeedToRegisterDialog, {
title: _t('Failed to join the room'),
description: _t('This room is inaccessible to guests. You may be able to join if you register') + '.'
description: _t('This room is inaccessible to guests. You may be able to join if you register.')
});
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/structures/SearchBox.js
Expand Up @@ -100,13 +100,13 @@ module.exports = React.createClass({
if (this.props.collapsed) {
toggleCollapse =
<AccessibleButton className="mx_SearchBox_maximise" tabIndex={collapseTabIndex} onClick={ this.onToggleCollapse.bind(this, true) }>
<TintableSvg src="img/maximise.svg" width="10" height="16" alt="Expand panel"/>
<TintableSvg src="img/maximise.svg" width="10" height="16" alt={ _t("Expand panel") }/>
</AccessibleButton>
}
else {
toggleCollapse =
<AccessibleButton className="mx_SearchBox_minimise" tabIndex={collapseTabIndex} onClick={ this.onToggleCollapse.bind(this, false) }>
<TintableSvg src="img/minimise.svg" width="10" height="16" alt="Collapse panel"/>
<TintableSvg src="img/minimise.svg" width="10" height="16" alt={ _t("Collapse panel") }/>
</AccessibleButton>
}

Expand Down
18 changes: 14 additions & 4 deletions src/components/views/settings/Notifications.js
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

'use strict';
var React = require('react');
import { _t } from 'matrix-react-sdk/lib/languageHandler';
import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler';
var q = require("q");
var sdk = require('matrix-react-sdk');
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
Expand Down Expand Up @@ -535,7 +535,16 @@ module.exports = React.createClass({
// it corresponds to all content push rules (stored in self.state.vectorContentRule)
self.state.vectorPushRules.push({
"vectorRuleId": "_keywords",
"description" : (<span>Messages containing <span className="mx_UserNotifSettings_keywords" onClick={ self.onKeywordsClicked }>keywords</span></span>),
"description" : (
<span>
{ _tJsx('Messages containing <span>keywords</span>',
/<span>(.*?)<\/span>/,
(sub) => {
return <span className="mx_UserNotifSettings_keywords" onClick={ self.onKeywordsClicked }>{sub}</span>;
}
)}
</span>
),
"vectorState": self.state.vectorContentRules.vectorState
});
}
Expand All @@ -549,7 +558,7 @@ module.exports = React.createClass({

self.state.vectorPushRules.push({
"vectorRuleId": vectorRuleId,
"description" : ruleDefinition.description,
"description" : _t(ruleDefinition.description), // Text from VectorPushRulesDefinitions.js
"rule": rule,
"vectorState": vectorState,
});
Expand Down Expand Up @@ -590,6 +599,7 @@ module.exports = React.createClass({
phase: self.phases.DISPLAY
});
}, function(error) {
console.error(error);
self.setState({
phase: self.phases.ERROR
});
Expand Down Expand Up @@ -624,7 +634,7 @@ module.exports = React.createClass({
return (
<tr key={ className }>
<th>
{title}
{ title }
</th>

<th>
Expand Down
11 changes: 10 additions & 1 deletion src/i18n/strings/en_EN.json
@@ -1,4 +1,5 @@
{
"<a href=\"http://apple.com/safari\">Safari</a> and <a href=\"http://opera.com\">Opera</a> work too.": "<a href=\"http://apple.com/safari\">Safari</a> and <a href=\"http://opera.com\">Opera</a> work too.",
"Add an email address above to configure email notifications": "Add an email address above to configure email notifications",
"Advanced notification settings": "Advanced notification settings",
"All messages": "All messages",
Expand All @@ -9,6 +10,7 @@
"Cancel Sending": "Cancel Sending",
"Can't update user notification settings": "Can't update user notification settings",
"Close": "Close",
"Collapse panel": "Collapse panel",
"Create new room": "Create new room",
"Couldn't find a matching Matrix room": "Couldn't find a matching Matrix room",
"Custom Server Options": "Custom Server Options",
Expand All @@ -29,6 +31,7 @@
"Error": "Error",
"Error saving email notification preferences": "Error saving email notification preferences",
"#example": "#example",
"Expand panel": "Expand panel",
"Failed to": "Failed to",
"Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room",
"Failed to change settings": "Failed to change settings",
Expand All @@ -48,13 +51,15 @@
" from room": " from room",
"Guests can join": "Guests can join",
"Guest users can't invite users. Please register to invite": "Guest users can't invite users. Please register to invite",
"I understand the risks and wish to continue": "I understand the risks and wish to continue",
"Invite to this room": "Invite to this room",
"Keywords": "Keywords",
"Leave": "Leave",
"Low Priority": "Low Priority",
"Members": "Members",
"Mentions only": "Mentions only",
"Messages containing my display name": "Messages containing my display name",
"Messages containing <span>keywords</span>": "Messages containing <span>keywords</span>",
"Messages containing my user name": "Messages containing my user name",
"Messages in group chats": "Messages in group chats",
"Messages in one-to-one chats": "Messages in one-to-one chats",
Expand All @@ -72,6 +77,7 @@
"On": "On",
"Operation failed": "Operation failed",
"Permalink": "Permalink",
"Please install <a href=\"https://www.google.com/chrome\">Chrome</a> or <a href=\"https://getfirefox.com\">Firefox</a> for the best experience.": "Please install <a href=\"https://www.google.com/chrome\">Chrome</a> or <a href=\"https://getfirefox.com\">Firefox</a> for the best experience.",
"Please Register": "Please Register",
"powered by Matrix": "powered by Matrix",
"Quote": "Quote",
Expand All @@ -83,11 +89,13 @@
"Remove from Directory": "Remove from Directory",
"Resend": "Resend",
"Riot does not know how to join a room on this network": "Riot does not know how to join a room on this network",
"Riot uses many advanced browser features, some of which are not available or experimental in your current browser.": "Riot uses many advanced browser features, some of which are not available or experimental in your current browser.",
"Room directory": "Room directory",
"Room not found": "Room not found",
"Search for a room": "Search for a room",
"Settings": "Settings",
"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.",
"Start chat": "Start chat",
"The Home Server may be too old to support third party networks": "The Home Server may be too old to support third party networks",
"There are advanced notifications which are not shown here": "There are advanced notifications which are not shown here",
Expand Down Expand Up @@ -118,5 +126,6 @@
"Saturday": "Saturday",
"Today": "Today",
"Yesterday": "Yesterday",
"Welcome page": "Welcome page"
"Welcome page": "Welcome page",
"With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!": "With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!"
}
14 changes: 7 additions & 7 deletions src/notifications/VectorPushRulesDefinitions.js
Expand Up @@ -65,7 +65,7 @@ module.exports = {
// Messages containing user's display name
".m.rule.contains_display_name": new VectorPushRuleDefinition({
kind: "override",
description: "Messages containing my display name",
description: "Messages containing my display name", // passed through _t() translation in src/components/views/settings/Notifications.js
vectorStateToActions: { // The actions for each vector state, or null to disable the rule.
on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_HIGHLIGHT_DEFAULT_SOUND,
Expand All @@ -76,7 +76,7 @@ module.exports = {
// Messages containing user's username (localpart/MXID)
".m.rule.contains_user_name": new VectorPushRuleDefinition({
kind: "override",
description: "Messages containing my user name",
description: "Messages containing my user name", // passed through _t() translation in src/components/views/settings/Notifications.js
vectorStateToActions: { // The actions for each vector state, or null to disable the rule.
on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_HIGHLIGHT_DEFAULT_SOUND,
Expand All @@ -87,7 +87,7 @@ module.exports = {
// Messages just sent to the user in a 1:1 room
".m.rule.room_one_to_one": new VectorPushRuleDefinition({
kind: "underride",
description: "Messages in one-to-one chats",
description: "Messages in one-to-one chats", // passed through _t() translation in src/components/views/settings/Notifications.js
vectorStateToActions: {
on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND,
Expand All @@ -100,7 +100,7 @@ module.exports = {
// By opposition, all other room messages are from group chat rooms.
".m.rule.message": new VectorPushRuleDefinition({
kind: "underride",
description: "Messages in group chats",
description: "Messages in group chats", // passed through _t() translation in src/components/views/settings/Notifications.js
vectorStateToActions: {
on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND,
Expand All @@ -111,7 +111,7 @@ module.exports = {
// Invitation for the user
".m.rule.invite_for_me": new VectorPushRuleDefinition({
kind: "underride",
description: "When I'm invited to a room",
description: "When I'm invited to a room", // passed through _t() translation in src/components/views/settings/Notifications.js
vectorStateToActions: {
on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND,
Expand All @@ -122,7 +122,7 @@ module.exports = {
// Incoming call
".m.rule.call": new VectorPushRuleDefinition({
kind: "underride",
description: "Call invitation",
description: "Call invitation", // passed through _t() translation in src/components/views/settings/Notifications.js
vectorStateToActions: {
on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_NOTIFY_RING_SOUND,
Expand All @@ -133,7 +133,7 @@ module.exports = {
// Notifications from bots
".m.rule.suppress_notices": new VectorPushRuleDefinition({
kind: "override",
description: "Messages sent by bot",
description: "Messages sent by bot", // passed through _t() translation in src/components/views/settings/Notifications.js
vectorStateToActions: {
// .m.rule.suppress_notices is a "negative" rule, we have to invert its enabled value for vector UI
on: StandardActions.ACTION_DISABLED,
Expand Down